| 1 |
/* |
|---|
| 2 |
* Flickr Uploadr |
|---|
| 3 |
* |
|---|
| 4 |
* Copyright (c) 2007-2009 Yahoo! Inc. All rights reserved. This library is |
|---|
| 5 |
* free software; you can redistribute it and/or modify it under the terms of |
|---|
| 6 |
* the GNU General Public License (GPL), version 2 only. This library is |
|---|
| 7 |
* distributed WITHOUT ANY WARRANTY, whether express or implied. See the GNU |
|---|
| 8 |
* GPL for more details (http://www.gnu.org/licenses/gpl.html) |
|---|
| 9 |
*/ |
|---|
| 10 |
|
|---|
| 11 |
// Check the command line queue for arguments |
|---|
| 12 |
var clh = function(silent, queue) { |
|---|
| 13 |
if(!threads.initialized) { |
|---|
| 14 |
window.setTimeout(clh, 100, silent, queue); |
|---|
| 15 |
return; |
|---|
| 16 |
} |
|---|
| 17 |
if (null == queue) { |
|---|
| 18 |
var comp = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=flcmdline"] |
|---|
| 19 |
.getService(Ci.flICLH); |
|---|
| 20 |
queue = comp.getQueue(); |
|---|
| 21 |
} |
|---|
| 22 |
if(checkCmdLineForFrob(queue)) { |
|---|
| 23 |
//logStringMessage("buttons.auth.click from clh"); |
|---|
| 24 |
buttons.auth.click(); |
|---|
| 25 |
} |
|---|
| 26 |
else |
|---|
| 27 |
{ // regular command line handling |
|---|
| 28 |
photos.add(queue.split('|||||'), silent); |
|---|
| 29 |
} |
|---|
| 30 |
}; |
|---|
| 31 |
|
|---|
| 32 |
var checkCmdLineForFrob = function(queue) { |
|---|
| 33 |
if (null == queue) { |
|---|
| 34 |
var comp = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=flcmdline"] |
|---|
| 35 |
.getService(Ci.flICLH); |
|---|
| 36 |
queue = comp.getQueue(); |
|---|
| 37 |
} |
|---|
| 38 |
if( queue && (0 == queue.indexOf("flickrup")) ) { |
|---|
| 39 |
if(0 == queue.indexOf("flickrup://auth/?&frob=")) {// on Windows, there is this / |
|---|
| 40 |
users.frob = queue.substr(23); |
|---|
| 41 |
return true; |
|---|
| 42 |
} else if(0 == queue.indexOf("flickrup://auth?&frob=")) { // on Mac not. Go figure. |
|---|
| 43 |
users.frob = queue.substr(22); |
|---|
| 44 |
return true; |
|---|
| 45 |
} |
|---|
| 46 |
else { //something is fishy |
|---|
| 47 |
alert("!?"); |
|---|
| 48 |
} |
|---|
| 49 |
} |
|---|
| 50 |
return false; |
|---|
| 51 |
} |
|---|