-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 | |||
@@ -815,129 +815,129 @@ var fireflix = { | |||
815 | } | 815 | } |
816 | }, | 816 | }, |
817 | on_select: function() { | 817 | on_select: function() { |
818 | if(this.selection.currentIndex<0) { | 818 | if(this.selection.currentIndex<0) { |
819 | this.searchresult_props.hidden = true; | 819 | this.searchresult_props.hidden = true; |
820 | }else{ | 820 | }else{ |
821 | var p = this.photos[this.selection.currentIndex]; | 821 | var p = this.photos[this.selection.currentIndex]; |
822 | if(!p) { | 822 | if(!p) { |
823 | this.searchresult_props.hidden = true; | 823 | this.searchresult_props.hidden = true; |
824 | }else{ | 824 | }else{ |
825 | this.search_photo.src = this.fireflix.flickr.make_photo_url(p,'t'); | 825 | this.search_photo.src = this.fireflix.flickr.make_photo_url(p,'t'); |
826 | this.searchresult_title.value = p.title; | 826 | this.searchresult_title.value = p.title; |
827 | this.searchresult_title.tooltipText = p.title; | 827 | this.searchresult_title.tooltipText = p.title; |
828 | this.render_description_frame(null); | 828 | this.render_description_frame(null); |
829 | if(p.description==null && p.description==undefined) { | 829 | if(p.description==null && p.description==undefined) { |
830 | var pid = p.id; | 830 | var pid = p.id; |
831 | var ci = this.selection.currentIndex; | 831 | var ci = this.selection.currentIndex; |
832 | var _this = this; | 832 | var _this = this; |
833 | this.fireflix.flickr.api_call( | 833 | this.fireflix.flickr.api_call( |
834 | { | 834 | { |
835 | method: 'flickr.photos.getInfo', | 835 | method: 'flickr.photos.getInfo', |
836 | auth_token: 'default', | 836 | auth_token: 'default', |
837 | photo_id: p.id, | 837 | photo_id: p.id, |
838 | secret: p.secret | 838 | secret: p.secret |
839 | }, function(xr) { | 839 | }, function(xr) { |
840 | var pp = _this.photos[ci]; | 840 | var pp = _this.photos[ci]; |
841 | if(ci==_this.selection.currentIndex && pp.id==pid) { | 841 | if(ci==_this.selection.currentIndex && pp.id==pid) { |
842 | var n = xp_node('/rsp/photo',xr.responseXML); | 842 | var n = xp_node('/rsp/photo',xr.responseXML); |
843 | pp.fromNode_(n); | 843 | pp.fromNode_(n); |
844 | _this.render_description_frame(pp.description); | 844 | _this.render_description_frame(pp.description); |
845 | } | 845 | } |
846 | }, function(x,s,c,m) { | 846 | }, function(x,s,c,m) { |
847 | _this.fireflix.flickr_failure(x,s,c,m); | 847 | _this.fireflix.flickr_failure(x,s,c,m); |
848 | } | 848 | } |
849 | ); | 849 | ); |
850 | this.searchresult_props.hidden = false; | 850 | this.searchresult_props.hidden = false; |
851 | }else{ | 851 | }else{ |
852 | this.render_description_frame(p.description); | 852 | this.render_description_frame(p.description); |
853 | } | 853 | } |
854 | } | 854 | } |
855 | } | 855 | } |
856 | }, | 856 | }, |
857 | on_cmd_open: function(ev) { | 857 | on_cmd_open: function(ev) { |
858 | if(this.selection.currentIndex<0) | 858 | if(this.selection.currentIndex<0) |
859 | return; | 859 | return; |
860 | var p = this.photos[this.selection.currentIndex]; | 860 | var p = this.photos[this.selection.currentIndex]; |
861 | if(!p.id) | 861 | if(!p.id) |
862 | return; | 862 | return; |
863 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); | 863 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); |
864 | } | 864 | } |
865 | }, | 865 | }, |
866 | 866 | ||
867 | photo_html: function(p,i,l) { | 867 | photo_html: function(p,i,l) { |
868 | // TODO: add alt/title when possible | 868 | // TODO: add alt/title when possible |
869 | var rv = | 869 | var rv = |
870 | '<a href="'+this.flickr.make_photo_url(p,l)+'">' + | 870 | '<a href="'+this.flickr.make_photo_url(p,l)+'">' + |
871 | '<img src="'+this.flickr.make_photo_url(p,i)+'" />'+ | 871 | '<img src="'+this.flickr.make_photo_url(p,i)+'" />'+ |
872 | '</a>'; | 872 | '</a>'; |
873 | return rv; | 873 | return rv; |
874 | }, | 874 | }, |
875 | build_html: function(photos,uti,utl) { | 875 | build_html: function(photos,uti,utl) { |
876 | var rv = ''; | 876 | var rv = ''; |
877 | for(var i in photos) { | 877 | for(var i in photos) { |
878 | var p = photos[i]; | 878 | var p = photos[i]; |
879 | rv += this.photo_html(p,utl,uti)+'\n'; | 879 | rv += this.photo_html(p,uti,utl)+'\n'; |
880 | } | 880 | } |
881 | return rv; | 881 | return rv; |
882 | }, | 882 | }, |
883 | 883 | ||
884 | popup_content: function(s) { | 884 | popup_content: function(s) { |
885 | window.openDialog( | 885 | window.openDialog( |
886 | "chrome://fireflix/content/generated-content.xul", | 886 | "chrome://fireflix/content/generated-content.xul", |
887 | null, "dialog,chrome", this, s ); | 887 | null, "dialog,chrome", this, s ); |
888 | }, | 888 | }, |
889 | copy_to_clipboard: function(s) { | 889 | copy_to_clipboard: function(s) { |
890 | var ch = Components.classes["@mozilla.org/widget/clipboardhelper;1"] | 890 | var ch = Components.classes["@mozilla.org/widget/clipboardhelper;1"] |
891 | .getService(Components.interfaces.nsIClipboardHelper); | 891 | .getService(Components.interfaces.nsIClipboardHelper); |
892 | ch.copyString(s); | 892 | ch.copyString(s); |
893 | }, | 893 | }, |
894 | openTab: function(l) { | 894 | openTab: function(l) { |
895 | var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService( | 895 | var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService( |
896 | Components.interfaces.nsIWindowMediator ); | 896 | Components.interfaces.nsIWindowMediator ); |
897 | var bw = wm.getMostRecentWindow('navigator:browser'); | 897 | var bw = wm.getMostRecentWindow('navigator:browser'); |
898 | var b = bw.getBrowser(); | 898 | var b = bw.getBrowser(); |
899 | var t = b.addTab(l); | 899 | var t = b.addTab(l); |
900 | b.selectedTab = t; | 900 | b.selectedTab = t; |
901 | }, | 901 | }, |
902 | 902 | ||
903 | build_menus: function() { | 903 | build_menus: function() { |
904 | this.append_html_menu( | 904 | this.append_html_menu( |
905 | document.getElementById('sets_html_menu'), | 905 | document.getElementById('sets_html_menu'), |
906 | 'stm_','m_bop','cmdset_sets','cmd_sets_html' | 906 | 'stm_','m_bop','cmdset_sets','cmd_sets_html' |
907 | ); | 907 | ); |
908 | this.append_html_menu( | 908 | this.append_html_menu( |
909 | document.getElementById('uploads_html_menu'), | 909 | document.getElementById('uploads_html_menu'), |
910 | 'stm_','m_bop','cmdset_uploads','cmd_uploads_html' | 910 | 'stm_','m_bop','cmdset_uploads','cmd_uploads_html' |
911 | ); | 911 | ); |
912 | return; | 912 | return; |
913 | }, | 913 | }, |
914 | append_html_menu: function(m,imgt,lnkt,csid,cpfx) { | 914 | append_html_menu: function(m,imgt,lnkt,csid,cpfx) { |
915 | var mp = m.appendChild(document.createElement('menupopup')); | 915 | var mp = m.appendChild(document.createElement('menupopup')); |
916 | var t; | 916 | var t; |
917 | t=mp.appendChild(document.createElement('menuitem')); | 917 | t=mp.appendChild(document.createElement('menuitem')); |
918 | t.setAttribute('label',this.loc_strings.getString('menutitle_Images')); | 918 | t.setAttribute('label',this.loc_strings.getString('menutitle_Images')); |
919 | t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); | 919 | t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); |
920 | mp.appendChild(document.createElement('menuseparator')); | 920 | mp.appendChild(document.createElement('menuseparator')); |
921 | var cs = document.getElementById(csid); | 921 | var cs = document.getElementById(csid); |
922 | for(var iti=0;iti<imgt.length;++iti) { | 922 | for(var iti=0;iti<imgt.length;++iti) { |
923 | t = mp.appendChild(document.createElement('menu')); | 923 | t = mp.appendChild(document.createElement('menu')); |
924 | t.setAttribute('label',this.loc_strings.getString('urltype_'+imgt.charAt(iti))); | 924 | t.setAttribute('label',this.loc_strings.getString('urltype_'+imgt.charAt(iti))); |
925 | var smp = t.appendChild(document.createElement('menupopup')); | 925 | var smp = t.appendChild(document.createElement('menupopup')); |
926 | t=smp.appendChild(document.createElement('menuitem')); | 926 | t=smp.appendChild(document.createElement('menuitem')); |
927 | t.setAttribute('label',this.loc_strings.getString('menutitle_Links')); | 927 | t.setAttribute('label',this.loc_strings.getString('menutitle_Links')); |
928 | t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); | 928 | t.setAttribute('class','menuhead');t.setAttribute('disabled','true'); |
929 | smp.appendChild(document.createElement('menuseparator')); | 929 | smp.appendChild(document.createElement('menuseparator')); |
930 | for(var lti=0;lti<lnkt.length;++lti) { | 930 | for(var lti=0;lti<lnkt.length;++lti) { |
931 | var csfx = imgt.charAt(iti)+lnkt.charAt(lti); | 931 | var csfx = imgt.charAt(iti)+lnkt.charAt(lti); |
932 | t=smp.appendChild(document.createElement('menuitem')); | 932 | t=smp.appendChild(document.createElement('menuitem')); |
933 | t.setAttribute('label',this.loc_strings.getString('urltype_'+lnkt.charAt(lti))); | 933 | t.setAttribute('label',this.loc_strings.getString('urltype_'+lnkt.charAt(lti))); |
934 | t.setAttribute('command',cpfx+'_'+csfx); | 934 | t.setAttribute('command',cpfx+'_'+csfx); |
935 | t=cs.appendChild(document.createElement('command')); | 935 | t=cs.appendChild(document.createElement('command')); |
936 | t.setAttribute('id',cpfx+'_'+csfx); | 936 | t.setAttribute('id',cpfx+'_'+csfx); |
937 | t.setAttribute('oncommand','fireflix.on_'+cpfx+"('"+csfx+"',event)"); | 937 | t.setAttribute('oncommand','fireflix.on_'+cpfx+"('"+csfx+"',event)"); |
938 | } | 938 | } |
939 | } | 939 | } |
940 | return mp; | 940 | return mp; |
941 | }, | 941 | }, |
942 | 942 | ||
943 | flickr_failure: function(x,s,c,m) { | 943 | flickr_failure: function(x,s,c,m) { |