-rw-r--r-- | content/fireflix.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index 337354e..6773134 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -751,23 +751,42 @@ var fireflix = { _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 */ + }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'); + } + }, 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.searchresult_description.value = null; + 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( { @@ -777,21 +796,21 @@ var fireflix = { 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.searchresult_description.value=pp.description?pp.description:null; + _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.searchresult_description.value=p.description?p.description:null; + this.render_description_frame(p.description); } } } }, on_cmd_open: function(ev) { if(this.selection.currentIndex<0) |