summaryrefslogtreecommitdiffabout
path: root/content/fireflix.js
Side-by-side diff
Diffstat (limited to 'content/fireflix.js') (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js2
1 files changed, 0 insertions, 2 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index a4f13b6..0f51397 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -353,89 +353,87 @@ var fireflix = {
getParentIndex: function(r) { return -1; },
drop: function(r,o) { },
canDropBeforeAfter: function(r,b) { return false },
add: function(f) {
if(f.indexOf('file:/')==0) {
f = f.substr(5);
while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-)
f = f.substr(1);
}
}
var t = f;
var ls = t.lastIndexOf('/');
if(ls>0) t = t.substr(ls+1);
ls = t.lastIndexOf('\\');
if(ls>0) t = t.substr(ls+1);
var ld = t.lastIndexOf('.');
if(ld>0) t = t.substr(0,ld);
this.files.push( {
file: f,
title: t,
tags: '',
state: 'pending'
} );
this.rowCount = this.files.length;
this.tree.rowCountChanged(this.rowCount-1,1);
},
upload_worker: function() {
for(var f in this.files) {
if(this.files[f].state=='pending') {
var ff = this.files[f];
- dump('upload '+ff.file+'\n');
this.on_file_upload(ff);
ff.state='uploading';
this.tree.invalidate();
var _this = this;
this.fireflix.flickr.upload_file(
ff.file, { title: ff.title, tags: ff.tags },
function(x,p) {
ff.photoid = p;
_this.batch_ids.push(p);
ff.state='completed';
_this.tree.invalidate();
window.setTimeout(_this.upload_to,0,_this);
}, function(x,s,c,m) {
ff.state='failed';
ff.flickr_errcode = c;
ff.flickr_errmsg = m;
_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) {
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) {
var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset'));
if(psn!=null) {
var pids = this.batch_ids.join(',');
var ppid = this.batch_ids[0];
var _this = this;
this.fireflix.flickr.api_call(
{
method: 'flickr.photosets.create',
auth_token: 'default',
title: psn,
primary_photo_id: ppid
}, function(x) {
var npid =
x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id');
_this.fireflix.flickr.api_call(