summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js4
-rw-r--r--content/flickr.js12
2 files changed, 6 insertions, 10 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 0f01d26..f180379 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -45,25 +45,27 @@ var fireflix = {
45 this.menu_auth_done.hidden = !inp; 45 this.menu_auth_done.hidden = !inp;
46 this.cmd_auth_done.setAttribute('disabled',!inp); 46 this.cmd_auth_done.setAttribute('disabled',!inp);
47 this.auth_info.disabled = !au; 47 this.auth_info.disabled = !au;
48 if(au) { 48 if(au) {
49 this.auth_info.value = this.flickr.user.fullname+' ['+this.flickr.user.username+']'; /* TODO: move to locale */ 49 this.auth_info.value = this.flickr.user.fullname+' ['+this.flickr.user.username+']'; /* TODO: move to locale */
50 }else{ 50 }else{
51 this.auth_info.value = this.no_auth_info_label; 51 this.auth_info.value = this.no_auth_info_label;
52 } 52 }
53 }, 53 },
54 on_cmd_auth: function() { 54 on_cmd_auth: function() {
55 var _this = this; 55 var _this = this;
56 this.flickr.authorize_0( 56 this.flickr.authorize_0(
57 function() { 57 'delete',
58 function(x,f,u) {
59 _this.openTab(u);
58 _this.set_auth_state(_this.flickr.token,true); 60 _this.set_auth_state(_this.flickr.token,true);
59 }, function(x,s,c,m) { 61 }, function(x,s,c,m) {
60 _this.flickr_failure(x,s,c,m); 62 _this.flickr_failure(x,s,c,m);
61 } 63 }
62 ); 64 );
63 }, 65 },
64 on_cmd_auth_done: function() { 66 on_cmd_auth_done: function() {
65 this.set_auth_state(this.flickr.token,false); 67 this.set_auth_state(this.flickr.token,false);
66 var _this = this; 68 var _this = this;
67 this.flickr.authorize_1( 69 this.flickr.authorize_1(
68 function() { 70 function() {
69 _this.flickr.save_token(); 71 _this.flickr.save_token();
diff --git a/content/flickr.js b/content/flickr.js
index add628a..b5bfa43 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -136,39 +136,33 @@ Flickr.prototype = {
136 if(on_failure) on_failure(x,stat,ecode,emsg); 136 if(on_failure) on_failure(x,stat,ecode,emsg);
137 } 137 }
138 }else{ 138 }else{
139 if(on_failure) on_failure(x); 139 if(on_failure) on_failure(x);
140 } 140 }
141 return true; 141 return true;
142 } 142 }
143 x.send(null); 143 x.send(null);
144 return true; 144 return true;
145 }, 145 },
146 146
147 frob: null, 147 frob: null,
148 authorize_0: function(on_s, on_f) { 148 authorize_0: function(perms, on_s, on_f) {
149 var _this = this; 149 var _this = this;
150 this.api_call( 150 this.api_call(
151 { method: 'flickr.auth.getFrob' }, 151 { method: 'flickr.auth.getFrob' },
152 function(x) { 152 function(x) {
153 _this.frob = xp_str('/rsp/frob',x.responseXML); 153 _this.frob = xp_str('/rsp/frob',x.responseXML);
154 var u = _this.api_call_url( 154 var u = _this.api_call_url(
155 { frob: _this.frob, perms: 'delete' }, _this.auth_url ); 155 { frob: _this.frob, perms: perms?perms:'delete' }, _this.auth_url );
156 var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService( 156 if(on_s) on_s(x,_this.frob,u);
157 Components.interfaces.nsIWindowMediator );
158 var bw = wm.getMostRecentWindow('navigator:browser');
159 var b = bw.getBrowser();
160 var t = b.addTab(u);
161 b.selectedTab = t;
162 if(on_s) on_s();
163 }, function(x,s,c,m) { 157 }, function(x,s,c,m) {
164 if(on_f) on_f(x,s,c,m); 158 if(on_f) on_f(x,s,c,m);
165 } 159 }
166 ); 160 );
167 }, 161 },
168 token: null, 162 token: null,
169 perms: null, 163 perms: null,
170 user: null, 164 user: null,
171 authorize_1: function(on_s, on_f) { 165 authorize_1: function(on_s, on_f) {
172 var _this = this; 166 var _this = this;
173 this.api_call( 167 this.api_call(
174 { method: 'flickr.auth.getToken', frob: this.frob }, 168 { method: 'flickr.auth.getToken', frob: this.frob },