author | Michael Krelin <hacker@klever.net> | 2011-08-28 16:23:16 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2011-08-28 16:23:16 (UTC) |
commit | 63b7d8b9cd7b4c4fd010a46bb2737a47d5afa65e (patch) (unidiff) | |
tree | 3533952c3632c34b25c399c2d9b6cf586d1cd4b0 /content | |
parent | e58247a43552504e34ae31a5262a8a9dd338243c (diff) | |
download | fireflix-63b7d8b9cd7b4c4fd010a46bb2737a47d5afa65e.zip fireflix-63b7d8b9cd7b4c4fd010a46bb2737a47d5afa65e.tar.gz fireflix-63b7d8b9cd7b4c4fd010a46bb2737a47d5afa65e.tar.bz2 |
more jsonification (is this code ever used?)
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | content/fireflix.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index d70ab4d..34cfd3e 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -204,80 +204,74 @@ var fireflix = { | |||
204 | refresh_sets: function() { | 204 | refresh_sets: function() { |
205 | var that = this; | 205 | var that = this; |
206 | this.fireflix.flickr.api_call_json( | 206 | this.fireflix.flickr.api_call_json( |
207 | { | 207 | { |
208 | method: 'flickr.photosets.getList', | 208 | method: 'flickr.photosets.getList', |
209 | auth_token: 'default' | 209 | auth_token: 'default' |
210 | }, function(x,j) { | 210 | }, function(x,j) { |
211 | that.import_json(j.photosets.photoset); | 211 | that.import_json(j.photosets.photoset); |
212 | }, function(x,s,c,m) { | 212 | }, function(x,s,c,m) { |
213 | that.fireflix.flickr_failure(x,s,c,m); | 213 | that.fireflix.flickr_failure(x,s,c,m); |
214 | } | 214 | } |
215 | ); | 215 | ); |
216 | }, | 216 | }, |
217 | on_select: function() { | 217 | on_select: function() { |
218 | if(this.selection.count==1) { | 218 | if(this.selection.count==1) { |
219 | this.fireflix.cmd_set_props.setAttribute('disabled','false'); | 219 | this.fireflix.cmd_set_props.setAttribute('disabled','false'); |
220 | var s = this.sets[this.selection.currentIndex]; | 220 | var s = this.sets[this.selection.currentIndex]; |
221 | this.fireflix.photoset.load_photos(s.id); | 221 | this.fireflix.photoset.load_photos(s.id); |
222 | }else{ | 222 | }else{ |
223 | this.fireflix.cmd_set_props.setAttribute('disabled','true'); | 223 | this.fireflix.cmd_set_props.setAttribute('disabled','true'); |
224 | } | 224 | } |
225 | }, | 225 | }, |
226 | on_cmd_open_in_flickr: function(ev) { | 226 | on_cmd_open_in_flickr: function(ev) { |
227 | if(this.selection.currentIndex<0) return; | 227 | if(this.selection.currentIndex<0) return; |
228 | var p = this.sets[this.selection.currentIndex]; | 228 | var p = this.sets[this.selection.currentIndex]; |
229 | if(!p.id) return; | 229 | if(!p.id) return; |
230 | this.fireflix.openTab(this.fireflix.flickr.make_photoset_url(p)); | 230 | this.fireflix.openTab(this.fireflix.flickr.make_photoset_url(p)); |
231 | } | 231 | } |
232 | }, | 232 | }, |
233 | 233 | ||
234 | refresh_user_tags: function() { | 234 | refresh_user_tags: function() { |
235 | var lb = document.getElementById('tagslist'); | 235 | var lb = document.getElementById('tagslist'); |
236 | var _this = this; | 236 | var that = this; |
237 | this.flickr.api_call( | 237 | this.flickr.api_call_json( |
238 | { | 238 | { |
239 | method: 'flickr.tags.getListUser', | 239 | method: 'flickr.tags.getListUser', |
240 | auth_token: 'default', | 240 | auth_token: 'default', |
241 | }, function(xr) { | 241 | }, function(x,j) { |
242 | var x = xr.responseXML; | 242 | var tt = j.who.tags.tag; |
243 | var xp = x.evaluate( | 243 | for(var i in tt) lb.appendItem(tt[i]._content); |
244 | '/rsp/who/tags/tag', x, null, | ||
245 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | ||
246 | // TODO: clear list | ||
247 | var n; while(n=xp.iterateNext()) { | ||
248 | lb.appendItem(n.firstChild.nodeValue); | ||
249 | } | ||
250 | }, function(x,s,c,m) { | 244 | }, function(x,s,c,m) { |
251 | _this.flickr_failure(x,s,c,m); | 245 | that.flickr_failure(x,s,c,m); |
252 | } | 246 | } |
253 | ); | 247 | ); |
254 | }, | 248 | }, |
255 | 249 | ||
256 | uploadObserver: { | 250 | uploadObserver: { |
257 | fireflix: null, | 251 | fireflix: null, |
258 | init: function(f) { | 252 | init: function(f) { |
259 | this.fireflix = f; | 253 | this.fireflix = f; |
260 | }, | 254 | }, |
261 | getSupportedFlavours: function() { | 255 | getSupportedFlavours: function() { |
262 | var rv = new FlavourSet(); | 256 | var rv = new FlavourSet(); |
263 | rv.appendFlavour('application/x-moz-file','nsIFile'); | 257 | rv.appendFlavour('application/x-moz-file','nsIFile'); |
264 | rv.appendFlavour('application/x-moz-url'); | 258 | rv.appendFlavour('application/x-moz-url'); |
265 | rv.appendFlavour('text/uri-list'); | 259 | rv.appendFlavour('text/uri-list'); |
266 | rv.appendFlavour('text/unicode'); | 260 | rv.appendFlavour('text/unicode'); |
267 | return rv; | 261 | return rv; |
268 | }, | 262 | }, |
269 | canHandleMultipleItems: true, | 263 | canHandleMultipleItems: true, |
270 | onDragOver: function(ev,fl,sess) { | 264 | onDragOver: function(ev,fl,sess) { |
271 | return true; | 265 | return true; |
272 | }, | 266 | }, |
273 | onDrop: function(ev,dd,s) { | 267 | onDrop: function(ev,dd,s) { |
274 | var ldf = null; | 268 | var ldf = null; |
275 | for(var i in dd.dataList) { | 269 | for(var i in dd.dataList) { |
276 | var di = dd.dataList[i]; | 270 | var di = dd.dataList[i]; |
277 | var dif = di.first; | 271 | var dif = di.first; |
278 | if( | 272 | if( |
279 | ldf==null | 273 | ldf==null |
280 | || ldf.flavour.contentType!=dif.flavour.contentType | 274 | || ldf.flavour.contentType!=dif.flavour.contentType |
281 | || ldf.contentLength!=dif.contentLength | 275 | || ldf.contentLength!=dif.contentLength |
282 | || ldf.data!=dif.data ) | 276 | || ldf.data!=dif.data ) |
283 | this.drop_item(ev,di,s); | 277 | this.drop_item(ev,di,s); |