-rw-r--r-- | content/fireflix.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index 98b6d41..337354e 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -85,24 +85,25 @@ var fireflix = { refresh_sets: function() { this.photosets.refresh_sets(); }, refresh_stuff: function() { this.refresh_sets(); this.refresh_user_tags(); }, /* photoset treeview */ photoset: { photos: new Array(), fireflix: null, init: function(f) { this.fireflix = f; + pull_elements(this,document,[ 'set_photo' ]); }, rowCount: 0, getCellText: function(r,c) { var p = this.photos[r]; if(c.id=='sp_title') return p.title; if(c.id=='sp_taken') return p.datetaken; if(c.id=='sp_upload') return p.dateupload; /* TODO: unixtime conversion */ return c.id; }, setTree: function(t) { this.tree = t }, isContainer: function(r) { return false; }, isSeparator: function(r) { return false; }, @@ -139,29 +140,29 @@ var fireflix = { var xp = x.evaluate( '/rsp/photoset/photo', x, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); _this.importXPR(xp); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); }, on_select: function() { if(this.selection.count==1) { var p = this.photos[this.selection.currentIndex]; - document.getElementById('set_photo').src = + this.set_photo.src = this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t'); - document.getElementById('set_photo').hidden = false; + this.set_photo.hidden = false; }else{ - document.getElementById('set_photo').hidden = true; + this.set_photo.hidden = true; } } }, /* photosets treeview */ photosets: { sets: new Array(), fireflix: null, init: function(f) { this.fireflix = f; }, rowCount: 0, @@ -301,25 +302,26 @@ var fireflix = { this.fireflix.uploads.add(us[ui]); document.getElementById('fireflix_tabs').selectedTab = document.getElementById('tab_upload'); } }, uploads: { fireflix: null, init: function(f) { this.fireflix=f; pull_elements(this,document,[ 'upload_filename','upload_title','upload_file_preview', - 'upload_file_props','upload_progress','upload_tags' + 'upload_file_props','upload_progress','upload_tags', + 'cmd_uploads_upload' ]); }, files: new Array(), rowCount: 0, getCellText: function(r,c) { var f = this.files[r]; if(c.id=='up_file') return f.file; if(c.id=='up_title') return f.title; if(c.id=='up_status') return f.state; return c.id; }, setTree: function(t) { this.tree = t }, @@ -392,25 +394,25 @@ var fireflix = { _this.tree.invalidate(); window.setTimeout(_this.upload_to,0,_this); } ); return; } } dump('uploading done\n'); this.on_finish_upload(); }, upload_to: function(_this) { _this.upload_worker(); }, on_file_upload: function(f) { - document.getElementById('cmd_uploads_upload').setAttribute('disabled','true'); + this.cmd_uploads_upload.setAttribute('disabled','true'); for(var fi in this.files) { if(this.files[fi].file==f.file) { this.tree.ensureRowIsVisible(fi); this.selection.rangedSelect(fi,fi,false); this.selection.currentIndex = fi; this.selToProps(); break; } } }, on_finish_upload: function() { if(this.batch_ids.length) { @@ -439,25 +441,25 @@ var fireflix = { _this.fireflix.refresh_sets(); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); } } this.selection.clearSelection(); - document.getElementById('cmd_uploads_upload').setAttribute('disabled','false'); + this.cmd_uploads_upload.setAttribute('disabled','false'); this.upload_progress.setAttribute('hidden','true'); }, clear_list: function() { this.tree.beginUpdateBatch(); this.rowCount = 0; this.files = new Array(); this.tree.endUpdateBatch(); this.selToProps(); }, selectionChanged: function() { this.selToProps(); |