summaryrefslogtreecommitdiffabout
path: root/content/fireflix.js
Side-by-side diff
Diffstat (limited to 'content/fireflix.js') (more/less context) (show whitespace changes)
-rw-r--r--content/fireflix.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 78e56c2..225e21c 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -607,48 +607,59 @@ var fireflix = {
for(var i=this.files.length-1;i>=0;--i) {
if(this.selection.isSelected(i)) {
this.files.splice(i,1);
this.rowCount--;
}
}
this.tree.endUpdateBatch();
this.selection.clearSelection();
}
},
on_add: function() {
var ifp = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp);
fp.init(window, "Select a File", ifp.modeOpenMultiple);
fp.appendFilters(ifp.filterImages);
var rv = fp.show();
if(rv==ifp.returnOK) {
var ff = fp.files;
while(ff.hasMoreElements()) {
var f = ff.getNext();
f.QueryInterface(Components.interfaces.nsIFile);
this.add(f.path);
}
}
+ },
+ on_cmd_open: function(ev) {
+ if(this.selection.currentIndex<0) return;
+ var f = this.files[this.selection.currentIndex];
+ if(f.photoid) {
+ this.fireflix.openTab(
+ this.fireflix.flickr.make_uploader_edit_url(f.photoid)
+ );
+ }else{
+ this.fireflix.openTab( 'file://'+f.file);
+ }
}
},
on_set_props: function() {
var pset = this.photosets.sets[this.photosets.selection.currentIndex];
window.openDialog(
"chrome://fireflix/content/photoset-props.xul",
null, "dependent,modal,dialog,chrome", this,
pset );
if(pset.dirty) {
var _this = this;
this.flickr.api_call(
{
method: 'flickr.photosets.editMeta',
auth_token: 'default',
photoset_id: pset.id,
title: pset.title,
description: pset.description
}, function(xr) {
pset.dirty = false;
_this.flickr.api_call(
{
method: 'flickr.photosets.getPhotos',
auth_token: 'default',
@@ -892,53 +903,51 @@ var fireflix = {
{
method: 'flickr.photos.getInfo',
auth_token: 'default',
photo_id: p.id,
secret: p.secret
}, function(xr) {
var pp = _this.photos[ci];
if(ci==_this.selection.currentIndex && pp.id==pid) {
var n = xp_node('/rsp/photo',xr.responseXML);
pp.fromNode_(n);
_this.render_description_frame(pp.description);
}
}, function(x,s,c,m) {
_this.fireflix.flickr_failure(x,s,c,m);
}
);
this.searchresult_props.hidden = false;
}else{
this.render_description_frame(p.description);
}
}
}
},
on_cmd_open: function(ev) {
- if(this.selection.currentIndex<0)
- return;
+ if(this.selection.currentIndex<0) return;
var p = this.photos[this.selection.currentIndex];
- if(!p.id)
- return;
+ if(!p.id) return;
this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p'));
}
},
photo_html: function(p,i,l) {
// TODO: add alt/title when possible
var rv =
'<a href="'+this.flickr.make_photo_url(p,l)+'">' +
'<img src="'+this.flickr.make_photo_url(p,i)+'" />'+
'</a>';
return rv;
},
build_html: function(photos,uti,utl) {
var rv = '';
for(var i in photos) {
var p = photos[i];
rv += this.photo_html(p,uti,utl)+'\n';
}
return rv;
},
popup_content: function(s) {
window.openDialog(
"chrome://fireflix/content/generated-content.xul",