author | Michael Krelin <hacker@klever.net> | 2006-10-09 19:03:13 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-10-09 19:03:13 (UTC) |
commit | 55ea41380cc2bcbaebf8cb0a2c1ee401b79f5016 (patch) (side-by-side diff) | |
tree | 03a2704067dc5dea4c5c10a8ab0401d6b1f74656 | |
parent | da97ac566cb06a583bd8b84b9e1275e37ea0a3ca (diff) | |
download | fireflix-55ea41380cc2bcbaebf8cb0a2c1ee401b79f5016.zip fireflix-55ea41380cc2bcbaebf8cb0a2c1ee401b79f5016.tar.gz fireflix-55ea41380cc2bcbaebf8cb0a2c1ee401b79f5016.tar.bz2 |
html generation was mistakenly reversed
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@189 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index 63a4118..85b4d39 100644 --- a/content/fireflix.js +++ b/content/fireflix.js @@ -687,267 +687,267 @@ var fireflix = { */ foundphotos: { fireflix: null, init: function(f) { this.fireflix = f; pull_elements(this,document,[ 'search_for','search_tags','search_mine', 'searchresult_props','search_photo', 'searchresult_title','searchresult_description', 'search_page','cmd_search_prev_page','cmd_search_next_page' ]); document.getElementById('searchresults').view = this; }, photos: new Array(), rowCount: 0, getCellText: function(r,c) { var p = this.photos[r]; if(c.id=='sr_title') return p.title; return c.id; }, setTree: function(t) { this.tree = t }, isContainer: function(r) { return false }, isSeparator: function(r) { return false }, isSorted: function(r) { return false }, getLevel: function(r) { return 0 }, getImageSrc: function(r,c) { return null }, getRowProperties: function(r,p) { }, 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(); }, paging: { pars: null, page: null, pages: null, perpage: null, total: null }, 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; } this.paging.pars = new Object(); this.paging.page = null; this.paging.pages = null; this.paging.perpage = null; this.paging.total = null; for(var p in pars) this.paging.pars[p] = pars[p]; this.perform_search(pars); }, perform_search: function(p) { var _this = this; this.fireflix.flickr.api_call( p, function(xr) { var x = xr.responseXML; var xp = xp_nodes('/rsp/photos/photo',x); _this.importXPR(xp); _this.tree.ensureRowIsVisible(0); xp = xp_node('/rsp/photos',x); _this.paging.page = parseInt(xp.getAttribute('page')); _this.paging.pages = parseInt(xp.getAttribute('pages')); _this.paging.perpage = parseInt(xp.getAttribute('perpage')); _this.paging.total = parseInt(xp.getAttribute('total')); _this.update_paging(); _this.on_select(); }, function(x,s,c,m) { _this.fireflix.flickr_failure(x,s,c,m); } ); }, on_cmd_prev: function(ev) { var pars = new Object(); for(var p in this.paging.pars) pars[p] = this.paging.pars[p]; pars.page=this.paging.page-1; pars.per_page=this.paging.perpage; this.perform_search(pars); }, on_cmd_next: function(ev) { var pars = new Object(); for(var p in this.paging.pars) pars[p] = this.paging.pars[p]; pars.page=this.paging.page+1; pars.per_page=this.paging.perpage; this.perform_search(pars); }, update_paging: function() { if(! (this.paging.pars && this.paging.page && this.paging.pages) ) { this.search_page.value=''; this.search_page.hidden = true; this.cmd_search_prev_page.setAttribute('disabled','true'); this.cmd_search_next_page.setAttribute('disabled','true'); }else{ this.search_page.value=this.fireflix.loc_strings.getFormattedString('search_page',[this.paging.page,this.paging.pages]); this.search_page.hidden=false; this.cmd_search_prev_page.setAttribute('disabled',(this.paging.page>1)?'false':'true'); this.cmd_search_next_page.setAttribute('disabled',(this.paging.page<this.paging.pages)?'false':'true'); } }, render_description_frame: function(content) { this.searchresult_description.innerHTML = ''; if(content) { var dp = new DOMParser(); var pd = dp.parseFromString( '<div xmlns="http://www.w3.org/1999/xhtml">'+content+'</div>', 'text/xml' ); var de = pd.documentElement; if(de.tagName=='parsererror') this.searchresult_description.innerHTML=this.fireflix.loc_strings.getString('broken_description'); else this.searchresult_description.appendChild(de); /* 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.searchresult_title.tooltipText = 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')); } }, 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,utl,uti)+'\n'; + rv += this.photo_html(p,uti,utl)+'\n'; } return rv; }, popup_content: function(s) { window.openDialog( "chrome://fireflix/content/generated-content.xul", null, "dialog,chrome", this, s ); }, copy_to_clipboard: function(s) { var ch = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper); ch.copyString(s); }, openTab: function(l) { var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService( Components.interfaces.nsIWindowMediator ); var bw = wm.getMostRecentWindow('navigator:browser'); var b = bw.getBrowser(); var t = b.addTab(l); b.selectedTab = t; }, build_menus: function() { this.append_html_menu( document.getElementById('sets_html_menu'), 'stm_','m_bop','cmdset_sets','cmd_sets_html' ); this.append_html_menu( document.getElementById('uploads_html_menu'), 'stm_','m_bop','cmdset_uploads','cmd_uploads_html' ); return; }, append_html_menu: function(m,imgt,lnkt,csid,cpfx) { var mp = m.appendChild(document.createElement('menupopup')); var t; t=mp.appendChild(document.createElement('menuitem')); t.setAttribute('label',this.loc_strings.getString('menutitle_Images')); t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); mp.appendChild(document.createElement('menuseparator')); var cs = document.getElementById(csid); for(var iti=0;iti<imgt.length;++iti) { t = mp.appendChild(document.createElement('menu')); t.setAttribute('label',this.loc_strings.getString('urltype_'+imgt.charAt(iti))); var smp = t.appendChild(document.createElement('menupopup')); t=smp.appendChild(document.createElement('menuitem')); t.setAttribute('label',this.loc_strings.getString('menutitle_Links')); t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); smp.appendChild(document.createElement('menuseparator')); for(var lti=0;lti<lnkt.length;++lti) { var csfx = imgt.charAt(iti)+lnkt.charAt(lti); t=smp.appendChild(document.createElement('menuitem')); t.setAttribute('label',this.loc_strings.getString('urltype_'+lnkt.charAt(lti))); t.setAttribute('command',cpfx+'_'+csfx); t=cs.appendChild(document.createElement('command')); t.setAttribute('id',cpfx+'_'+csfx); t.setAttribute('oncommand','fireflix.on_'+cpfx+"('"+csfx+"',event)"); } } return mp; }, flickr_failure: function(x,s,c,m) { if(c==98) { // Invalid auth token this.flickr.reset_token(); this.set_auth_state(false,false); return; } // TODO: is that beauty? alert('flickr api call failed\n'+c+' '+m); } }; |