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.js20
1 files changed, 6 insertions, 14 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 6773134..6681303 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -711,111 +711,103 @@ var fireflix = {
getCellProperties: function(cid,cel,p) { },
getColumnProperties: function(cid,cel,p) { },
cycleHeader: function(cid,e) { },
getParentIndex: function(r) { return -1 },
drop: function(r,o) { },
canDropBeforeAfter: function(r,b) { return false },
importXPR: function(xp) {
this.selection.clearSelection();
this.selection.currentIndex = -1;
this.searchresult_props.hidden = true;
this.tree.beginUpdateBatch();
this.photos = new Array();
var n; while(n=xp.iterateNext()) {
this.photos.push(new Photo(n));
}
this.rowCount = this.photos.length;
this.tree.endUpdateBatch();
},
search_photos: function() {
var pars = {
method: 'flickr.photos.search',
auth_token: 'default',
extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo'
};
if(this.search_mine.checked)
pars.user_id='me';
if(this.search_tags.checked) {
pars.tags=this.search_for.value.split(/ +/).join(',');
}else{
pars.text=this.search_for.value;
}
var _this = this;
this.fireflix.flickr.api_call( pars,
function(xr) {
var x = xr.responseXML;
var xp = x.evaluate(
'/rsp/photos/photo', x, null,
XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
_this.importXPR(xp);
_this.on_select();
}, function(x,s,c,m) {
_this.fireflix.flickr_failure(x,s,c,m);
}
);
},
render_description_frame: function(content) {
if(!content) {
- try {
- this.searchresult_description.contentDocument.lastChild.innerHTML
- = '';
- }catch(e) { } /* it will throw exceptions when the iframe isn't well
- prepared to meet me, but it's unimportant then, anyway */
+ this.searchresult_description.innerHTML = '';
}else{
- this.searchresult_description.contentDocument.lastChild.setAttribute(
- 'style',
- 'font-size: 80%; margin: 1px 3px; font-family: arial, sans-serif'
- );
- this.searchresult_description.contentDocument.lastChild.innerHTML
- = content;
- var ls = this.searchresult_description.contentDocument.links;
- for(var l=0;l<ls.length;++l)
- ls.item(l).setAttribute('target','_blank');
+ this.searchresult_description.innerHTML = content?content:'';
+ /* of all linking elements flickr only allows a */
+ var as = this.searchresult_description.getElementsByTagName('a');
+ for(var a=0;a<as.length;++a)
+ as.item(a).setAttribute('target','_blank');
}
},
on_select: function() {
if(this.selection.currentIndex<0) {
this.searchresult_props.hidden = true;
}else{
var p = this.photos[this.selection.currentIndex];
if(!p) {
this.searchresult_props.hidden = true;
}else{
this.search_photo.src = this.fireflix.flickr.make_photo_url(p,'t');
this.searchresult_title.value = p.title;
this.render_description_frame(null);
if(p.description==null && p.description==undefined) {
var pid = p.id;
var ci = this.selection.currentIndex;
var _this = this;
this.fireflix.flickr.api_call(
{
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;
var p = this.photos[this.selection.currentIndex];
if(!p.id)
return;
this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p'));