チェンジセット 44
- 更新日時:
- 2009/02/02 22:05:29 (3 年 前)
- パス:
- branches/candidate/chrome/content
- ファイル:
-
- 6 変更
-
tool/piapro_audio.html (変更) (1 diff)
-
tool/piapro_image.html (変更) (1 diff)
-
tool/tool.js (変更) (1 diff)
-
tool/vocaran.html (変更) (1 diff)
-
update.js (変更) (4 diff)
-
vocalofx.js (変更) (16 diff)
凡例:
- 変更なし
- 追加
- 削除
-
branches/candidate/chrome/content/tool/piapro_audio.html
r33 r44 5 5 <link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 6 6 </head> 7 <body >7 <body onload="setTimeout('location.reload();', 60 * 60 * 1000);"> 8 8 <embed name="piapro_player" src="http://piapro.jp/modpub/swf/bp_audio.swf" 9 9 FlashVars="pid=&fid=&view=audio&c=0" quality="high" width="160" height="245" align="middle" -
branches/candidate/chrome/content/tool/piapro_image.html
r33 r44 5 5 <link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 6 6 </head> 7 <body >7 <body onload="setTimeout('location.reload();', 15 * 60 * 1000);"> 8 8 <embed name="piapro_player" src="http://piapro.jp/modpub/swf/bp_image.swf" 9 9 FlashVars="pid=&fid=&view=image&c=0" quality="high" width="160" height="245" align="middle" -
branches/candidate/chrome/content/tool/tool.js
r7 r44 8 8 tool = window.arguments[0]; 9 9 document.title = window.arguments[1]; 10 var vocalofx_toolhtml = document.getElementById("vocalofx-toolhtml");11 vocalofx_toolhtml.setAttribute("src", TOOL_URL + tool + ".html");12 vocalofx_toolhtml.style.width = window.innerWidth + "px";13 vocalofx_toolhtml.style.height = window.innerHeight + "px";10 var toolhtml = document.getElementById("vocalofx-toolhtml"); 11 toolhtml.setAttribute("src", TOOL_URL + tool + ".html"); 12 toolhtml.style.width = window.innerWidth + "px"; 13 toolhtml.style.height = window.innerHeight + "px"; 14 14 } 15 15 -
branches/candidate/chrome/content/tool/vocaran.html
r33 r44 5 5 <link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 6 6 </head> 7 <body >7 <body onload="setTimeout('location.reload();', 60 * 60 * 1000);"> 8 8 <embed src="http://bokasachi.natsu.gs/blog_part/vocaran.swf" 9 9 quality="high" bgcolor="#ffffff" width="180" height="300" name="vocaran" align="middle" -
branches/candidate/chrome/content/update.js
r19 r44 1 varupdate = {1 var vocalofx_update = { 2 2 VOCALOFX_PROPERTY_VERSION: "extensions.vocalofx.version", 3 pref: null,4 em: null,5 addon: null,6 appinfo: null,7 macskin: null,8 greasemonkey: null,9 brand: null,10 vocalofx_properties: null,11 skin_properties: null,12 tool_properties: null,13 showAlerts_timeoutID: null,14 macAlert: null,15 skinAlert: null,16 piaprogmAlert: null,17 3 18 4 /* 0.4 … … 44 30 initVocalofxPref: function(){ 45 31 var image_id = vocalofx.DEFAULT_SKIN; 46 var position = skin_properties.getString(image_id + ".position");47 pref.setCharPref(vocalofx.SKIN_PROPERTY_IMAGE, vocalofx.CHROME_SKIN + image_id + ".png");48 pref.setCharPref(vocalofx.SKIN_PROPERTY_POSITION, position);32 var position = this.skin_properties.getString(image_id + ".position"); 33 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_IMAGE, vocalofx.CHROME_SKIN + image_id + ".png"); 34 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_POSITION, position); 49 35 50 36 var pallet = vocalofx.DEFAULT_PALLET; 51 37 var category = vocalofx.DEFAULT_CATEGORY; 52 pref.setCharPref(vocalofx.SKIN_PROPERTY_CATEGORY, category);53 pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET + "." + category, pallet);54 pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET, pallet);38 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_CATEGORY, category); 39 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET + "." + category, pallet); 40 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET, pallet); 55 41 56 42 var ls = Components.interfaces.nsIPrefLocalizedString; 57 43 var srchEngine = Components.classes["@mozilla.org/pref-localizedstring;1"].createInstance(ls); 58 44 srchEngine.data = "ピアプロ音楽検索"; 59 pref.setComplexValue("browser.search.selectedEngine", ls, srchEngine);60 } ,61 45 this.pref.setComplexValue("browser.search.selectedEngine", ls, srchEngine); 46 } 47 , 62 48 /* 0.1pre2 63 49 user_pref("extensions.vocalofx.skin_category", "miku"); … … 80 66 update_0_1pre: function(){ 81 67 try{ 82 var image = pref.getCharPref(vocalofx.SKIN_PROPERTY_IMAGE);68 var image = this.pref.getCharPref(vocalofx.SKIN_PROPERTY_IMAGE); 83 69 var token = image.split("/"); 84 70 var imagefile = token[token.length - 1]; 85 71 var image_id = imagefile.substr(0, imagefile.lastIndexOf(".png")); 86 var position = skin_properties.getString(image_id + ".position");87 pref.setCharPref(vocalofx.SKIN_PROPERTY_POSITION, position);72 var position = this.skin_properties.getString(image_id + ".position"); 73 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_POSITION, position); 88 74 89 var category = pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY);75 var category = this.pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 90 76 var pallet = category; 91 pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET + "." + category, pallet);92 pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET, pallet);77 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET + "." + category, pallet); 78 this.pref.setCharPref(vocalofx.SKIN_PROPERTY_PALLET, pallet); 93 79 } 94 80 catch(e){ 95 81 // nop 96 82 } 97 } ,98 83 } 84 , 99 85 showAlerts: function(){ 100 if( macAlert){86 if(this.macAlert){ 101 87 this.alertMac(); 102 88 } 103 if( skinAlert){89 if(this.skinAlert){ 104 90 this.alertSkin(); 105 91 } 106 if( piaprogmAlert){92 if(this.piaprogmAlert){ 107 93 this.alertPiaprogm(); 108 94 } 109 window.clearTimeout( showAlerts_timeoutID);110 } ,111 95 window.clearTimeout(this.showAlerts_timeoutID); 96 } 97 , 112 98 alertMac: function(){ 113 alert( vocalofx_properties.getString("vocalofx.macAlert"));114 } ,115 99 alert(this.vocalofx_properties.getString("vocalofx.macAlert")); 100 } 101 , 116 102 alertSkin: function(){ 117 if(window.confirm( vocalofx_properties.getFormattedString("vocalofx.skinAlert", [brand.getString("brandShortName"),addon.name]))){118 pref.setBoolPref(vocalofx.SKIN_PROPERTY_THEME_ALERT, false);103 if(window.confirm(this.vocalofx_properties.getFormattedString("vocalofx.skinAlert", [this.brand.getString("brandShortName"), this.addon.name]))){ 104 this.pref.setBoolPref(vocalofx.SKIN_PROPERTY_THEME_ALERT, false); 119 105 } 120 106 }, 121 107 122 108 alertPiaprogm: function(){ 123 window.openDialog("chrome://vocalofx/content/tool/piapro_gm.xul", "piapro_gm", "chrome,dependent=yes,close=yes,centerscreen", pref);124 } ,125 109 window.openDialog("chrome://vocalofx/content/tool/piapro_gm.xul", "piapro_gm", "chrome,dependent=yes,close=yes,centerscreen", this.pref); 110 } 111 , 126 112 check: function(){ 127 pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); 128 em = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager); 129 appinfo = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo); 130 addon = em.getItemForID("vocalofx@rayflood.org"); 131 macskin = em.getItemForID("vocalofx-macskin@rayflood.org"); 132 greasemonkey = em.getItemForID("{e4a8a97b-f2ed-450b-b12d-ee082ba24781}"); 133 brand = document.getElementById("bundle_brand"); 134 vocalofx_properties = document.getElementById("vocalofx-properties"); 135 skin_properties = document.getElementById("vocalofx-skin-properties"); 136 tool_properties = document.getElementById("vocalofx-tool-properties"); 137 macAlert = false; 138 skinAlert = false; 139 piaprogmAlert = false; 113 var Cc = Components.classes; 114 var Ci = Components.interfaces; 115 this.pref = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); 116 this.em = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager); 117 this.appinfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo); 118 this.addon = this.em.getItemForID("vocalofx@rayflood.org"); 119 this.macskin = this.em.getItemForID("vocalofx-macskin@rayflood.org"); 120 this.greasemonkey = this.em.getItemForID("{e4a8a97b-f2ed-450b-b12d-ee082ba24781}"); 121 this.brand = document.getElementById("bundle_brand"); 122 this.vocalofx_properties = document.getElementById("vocalofx-properties"); 123 this.skin_properties = document.getElementById("vocalofx-skin-properties"); 124 this.tool_properties = document.getElementById("vocalofx-tool-properties"); 125 this.macAlert = false; 126 this.skinAlert = false; 127 this.piaprogmAlert = false; 140 128 141 129 var version = "0.1pre"; 142 130 try{ 143 version = pref.getCharPref(this.VOCALOFX_PROPERTY_VERSION);131 version = this.pref.getCharPref(this.VOCALOFX_PROPERTY_VERSION); 144 132 } 145 133 catch(e){ 146 134 try{ 147 pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY);135 this.pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 148 136 } 149 137 catch(e){ … … 152 140 } 153 141 154 if(navigator.platform.match(/^Mac/) && appinfo.platformVersion.match(/^1.8.1/)155 && ( macskin != null &&macskin.version)){156 macAlert = true;142 if(navigator.platform.match(/^Mac/) && this.appinfo.platformVersion.match(/^1.8.1/) 143 && (this.macskin != null && this.macskin.version)){ 144 this.macAlert = true; 157 145 } 158 var selectedSkin = pref.getCharPref("general.skins.selectedSkin");159 if(selectedSkin != "classic/1.0" && pref.getBoolPref(vocalofx.SKIN_PROPERTY_THEME_ALERT)){160 skinAlert = true;146 var selectedSkin = this.pref.getCharPref("general.skins.selectedSkin"); 147 if(selectedSkin != "classic/1.0" && this.pref.getBoolPref(vocalofx.SKIN_PROPERTY_THEME_ALERT)){ 148 this.skinAlert = true; 161 149 } 162 var selectedSkin = pref.getCharPref("general.skins.selectedSkin");163 if(( greasemonkey != null && greasemonkey.version) &&pref.getBoolPref(vocalofx.TOOL_PROPERTY_PIAPROGM_ALERT)){164 piaprogmAlert = true;150 var selectedSkin = this.pref.getCharPref("general.skins.selectedSkin"); 151 if((this.greasemonkey != null && this.greasemonkey.version) && this.pref.getBoolPref(vocalofx.TOOL_PROPERTY_PIAPROGM_ALERT)){ 152 this.piaprogmAlert = true; 165 153 } 166 showAlerts_timeoutID = window.setTimeout("update.showAlerts();", 1000); 154 var showAlerts_timeoutID = window.setTimeout(function(){ 155 if(this.macAlert){ 156 this.alertMac(); 157 } 158 if(this.skinAlert){ 159 this.alertSkin(); 160 } 161 if(this.piaprogmAlert){ 162 this.alertPiaprogm(); 163 } 164 window.clearTimeout(showAlerts_timeoutID); 165 }, 1000); 167 166 168 if(version == addon.version){167 if(version == this.addon.version){ 169 168 return; 170 169 } 171 170 172 pref.setCharPref(this.VOCALOFX_PROPERTY_VERSION,addon.version);171 this.pref.setCharPref(this.VOCALOFX_PROPERTY_VERSION, this.addon.version); 173 172 if(version == "init"){ 174 173 this.initVocalofxPref(); -
branches/candidate/chrome/content/vocalofx.js
r41 r44 17 17 BROWSER_UNONLOAD: "unload", 18 18 BROWSER_PREF_CHANGED: "nsPref:changed", 19 DOMWINDOWOPENED: "domwindowopened", 19 20 DEFAULT_CATEGORY: "luka", 20 21 DEFAULT_SKIN: "kei_luka", 21 22 DEFAULT_PALLET: "luka1", 22 pref: null,23 brand: null,24 main_window: null,25 sidebar: null,26 navigator_toolbox: null,27 menuroot: null,28 vocalofx_properties: null,29 skin_properties: null,30 tool_properties: null,31 23 32 24 openVocalofxTool: function(tool){ 33 var option = "chrome,dependent=yes,close=yes ";34 var toolsize = t ool_properties.getString(tool + ".size").split(",");25 var option = "chrome,dependent=yes,close=yes,minimizable=yes"; 26 var toolsize = this.tool_properties.getString(tool + ".size").split(","); 35 27 option += ",width=" + toolsize[0]; 36 28 option += ",height=" + toolsize[1]; 37 29 try{ 38 var toolprop = pref.getCharPref(this.TOOL_PROPERTY_POSITION + "." + tool).split(",");30 var toolprop = this.pref.getCharPref(this.TOOL_PROPERTY_POSITION + "." + tool).split(","); 39 31 option += ",left=" + parseInt(toolprop[0]) + ",top=" + parseInt(toolprop[1]); 40 32 } … … 42 34 option += ",centerscreen"; 43 35 } 44 var toolname = vocalofx_properties.getString("vocalofx.tool." + tool); 45 try{ 46 var tooltitle = vocalofx_properties.getString("vocalofx.tool." + tool + ".title"); 47 toolname += tooltitle; 36 var toolname = this.vocalofx_properties.getString("vocalofx.tool." + tool); 37 try{ 38 toolname += this.vocalofx_properties.getString("vocalofx.tool." + tool + ".title"); 48 39 } 49 40 catch(e){ … … 52 43 var dialog = window.openDialog(this.TOOLDIALOG_URL, tool, option, tool, toolname); 53 44 dialog.focus(); 54 } ,55 45 } 46 , 56 47 selectVocalofxSkin: function(skin){ 57 var position = skin_properties.getString(skin + ".position");58 var category = skin_properties.getString(skin + ".category");59 60 pref.setCharPref(this.SKIN_PROPERTY_IMAGE, this.CHROME_SKIN + skin + ".png");61 pref.setCharPref(this.SKIN_PROPERTY_POSITION, position);62 pref.setCharPref(this.SKIN_PROPERTY_CATEGORY, category);63 } ,64 48 var position = this.skin_properties.getString(skin + ".position"); 49 var category = this.skin_properties.getString(skin + ".category"); 50 51 this.pref.setCharPref(this.SKIN_PROPERTY_IMAGE, this.CHROME_SKIN + skin + ".png"); 52 this.pref.setCharPref(this.SKIN_PROPERTY_POSITION, position); 53 this.pref.setCharPref(this.SKIN_PROPERTY_CATEGORY, category); 54 } 55 , 65 56 selectVocalofxSkinPallet: function(pallet){ 66 57 var category; 67 58 try{ 68 category = pref.getCharPref(this.SKIN_PROPERTY_CATEGORY);69 } 70 catch(e){ 71 this.selectVocalofxSkin(this.DEFAULT_SKIN); 72 return; 73 } 74 pref.setCharPref(this.SKIN_PROPERTY_PALLET + "." + category, pallet);75 pref.setCharPref(this.SKIN_PROPERTY_PALLET, pallet);76 77 if( pref.getBoolPref(this.SKIN_PROPERTY_PALLET_ALERT)){78 if(window.confirm( vocalofx_properties.getFormattedString("vocalofx.palletAlert", [brand.getString("brandShortName")]))){79 pref.setBoolPref(this.SKIN_PROPERTY_PALLET_ALERT, false);80 } 81 } 82 } ,83 59 category = this.pref.getCharPref(this.SKIN_PROPERTY_CATEGORY); 60 } 61 catch(e){ 62 this.selectVocalofxSkin(this.DEFAULT_SKIN); 63 return; 64 } 65 this.pref.setCharPref(this.SKIN_PROPERTY_PALLET + "." + category, pallet); 66 this.pref.setCharPref(this.SKIN_PROPERTY_PALLET, pallet); 67 68 if(this.pref.getBoolPref(this.SKIN_PROPERTY_PALLET_ALERT)){ 69 if(window.confirm(this.vocalofx_properties.getFormattedString("vocalofx.palletAlert", [this.brand.getString("brandShortName")]))){ 70 this.pref.setBoolPref(this.SKIN_PROPERTY_PALLET_ALERT, false); 71 } 72 } 73 } 74 , 84 75 setVocalofxSkinImage: function(){ 85 76 var image; 86 77 try{ 87 image = pref.getCharPref(this.SKIN_PROPERTY_IMAGE);88 } 89 catch(e){ 90 this.selectVocalofxSkin(this.DEFAULT_SKIN); 91 return; 92 } 93 94 main_window.style.backgroundRepeat = "no-repeat";95 main_window.style.backgroundImage = "url('" + image + "')";96 } ,97 78 image = this.pref.getCharPref(this.SKIN_PROPERTY_IMAGE); 79 } 80 catch(e){ 81 this.selectVocalofxSkin(this.DEFAULT_SKIN); 82 return; 83 } 84 85 this.main_window.style.backgroundRepeat = "no-repeat"; 86 this.main_window.style.backgroundImage = "url('" + image + "')"; 87 } 88 , 98 89 setVocalofxSkinCategory: function(){ 99 90 var category; 100 91 var pallet; 101 92 try{ 102 category = pref.getCharPref(this.SKIN_PROPERTY_CATEGORY);103 pallet = pref.getCharPref(this.SKIN_PROPERTY_PALLET + "." + category);104 } 105 catch(e){ 106 this.selectVocalofxSkin(this.DEFAULT_SKIN); 107 return; 108 } 109 110 pref.setCharPref(this.SKIN_PROPERTY_PALLET, pallet);93 category = this.pref.getCharPref(this.SKIN_PROPERTY_CATEGORY); 94 pallet = this.pref.getCharPref(this.SKIN_PROPERTY_PALLET + "." + category); 95 } 96 catch(e){ 97 this.selectVocalofxSkin(this.DEFAULT_SKIN); 98 return; 99 } 100 101 this.pref.setCharPref(this.SKIN_PROPERTY_PALLET, pallet); 111 102 this.setVocalofxPalletMenu(); 112 } ,113 103 } 104 , 114 105 setVocalofxImagePosition: function(){ 115 106 var position; … … 117 108 var position_ratio; 118 109 try{ 119 position = pref.getCharPref(this.SKIN_PROPERTY_POSITION).split(",");110 position = this.pref.getCharPref(this.SKIN_PROPERTY_POSITION).split(","); 120 111 position_height = Number(position[0]); 121 112 position_ratio = Number(position[1]); … … 132 123 image_top = 0; 133 124 } 134 main_window.style.backgroundPosition = "100% " + image_top + "px";125 this.main_window.style.backgroundPosition = "100% " + image_top + "px"; 135 126 } 136 127 catch(e){ 137 128 // nop 138 129 } 139 } ,140 130 } 131 , 141 132 setVocalofxSkinPallet: function(){ 142 133 var pallet; 143 134 try{ 144 pallet = pref.getCharPref(this.SKIN_PROPERTY_PALLET);135 pallet = this.pref.getCharPref(this.SKIN_PROPERTY_PALLET); 145 136 } 146 137 catch(e){ … … 149 140 } 150 141 151 main_window.setAttribute(this.SKIN_ATTRIBUTE, pallet);142 this.main_window.setAttribute(this.SKIN_ATTRIBUTE, pallet); 152 143 this.setSidebarVocalofxSkin(); 153 } ,154 144 } 145 , 155 146 setSidebarVocalofxSkin: function(){ 156 147 var pallet; 157 148 try{ 158 pallet = pref.getCharPref(this.SKIN_PROPERTY_PALLET);149 pallet = this.pref.getCharPref(this.SKIN_PROPERTY_PALLET); 159 150 } 160 151 catch(e){ … … 164 155 165 156 try{ 166 var bookmarksPanel = sidebar.contentDocument.getElementById("bookmarksPanel");157 var bookmarksPanel = this.sidebar.contentDocument.getElementById("bookmarksPanel"); 167 158 if(bookmarksPanel){ 168 159 bookmarksPanel.setAttribute(this.SKIN_ATTRIBUTE, pallet); 169 160 } 170 var history_panel = sidebar.contentDocument.getElementById("history-panel");161 var history_panel = this.sidebar.contentDocument.getElementById("history-panel"); 171 162 if(history_panel){ 172 163 history_panel.setAttribute(this.SKIN_ATTRIBUTE, pallet); … … 176 167 // nop 177 168 } 178 } ,179 169 } 170 , 180 171 setVocalofxMenu: function(){ 181 var skins = skin_properties.getString("skinmenu").split(",");172 var skins = this.skin_properties.getString("skinmenu").split(","); 182 173 for(var i = 0; i < skins.length; i++){ 183 174 var menuitem = document.createElement("menuitem"); 184 175 menuitem.setAttribute("id", "vocalofx-skin-" + skins[i]); 185 menuitem.setAttribute("label", vocalofx_properties.getString("vocalofx.skin." + skins[i]));176 menuitem.setAttribute("label", this.vocalofx_properties.getString("vocalofx.skin." + skins[i])); 186 177 menuitem.setAttribute("oncommand", "vocalofx.selectVocalofxSkin('" + skins[i] + "')"); 187 178 188 var category = skin_properties.getString(skins[i] + ".category_sub");179 var category = this.skin_properties.getString(skins[i] + ".category_sub"); 189 180 var skin_popup = document.getElementById("vocalofx-skin-popup-" + category); 190 181 skin_popup.appendChild(menuitem); … … 192 183 193 184 var tool_popup = document.getElementById("vocalofx-tool-popup"); 194 var tools = t ool_properties.getString("toolmenu").split(",");185 var tools = this.tool_properties.getString("toolmenu").split(","); 195 186 for(var i = 0; i < tools.length; i++){ 196 187 var menuitem = document.createElement("menuitem"); 197 188 menuitem.setAttribute("id", "vocalofx-tool-" + tools[i]); 198 menuitem.setAttribute("label", vocalofx_properties.getString("vocalofx.tool." + tools[i]));189 menuitem.setAttribute("label", this.vocalofx_properties.getString("vocalofx.tool." + tools[i])); 199 190 menuitem.setAttribute("oncommand", "vocalofx.openVocalofxTool('" + tools[i] + "')"); 200 191 tool_popup.appendChild(menuitem); 201 192 try{ 202 if( pref.getBoolPref(this.TOOL_PROPERTY_STARTUP + "." + tools[i])){193 if(this.pref.getBoolPref(this.TOOL_PROPERTY_STARTUP + "." + tools[i])){ 203 194 this.openVocalofxTool(tools[i]); 204 195 } … … 208 199 } 209 200 } 210 } ,211 201 } 202 , 212 203 setVocalofxPalletMenu: function(){ 213 204 var category; 214 205 try{ 215 category = pref.getCharPref(this.SKIN_PROPERTY_CATEGORY);216 } 217 catch(e){ 218 this.selectVocalofxSkin(this.DEFAULT_SKIN); 219 return; 220 } 221 222 menuroot.src = this.CHROME_SKIN + category + "_logo.png";206 category = this.pref.getCharPref(this.SKIN_PROPERTY_CATEGORY); 207 } 208 catch(e){ 209 this.selectVocalofxSkin(this.DEFAULT_SKIN); 210 return; 211 } 212 213 this.menuroot.src = this.CHROME_SKIN + category + "_logo.png"; 223 214 224 215 var skin_popup = document.getElementById("vocalofx-skin-popup-pallet"); … … 228 219 } 229 220 230 var pallets = skin_properties.getString("palletmenu." + category).split(",");221 var pallets = this.skin_properties.getString("palletmenu." + category).split(","); 231 222 for(var i = 0; i < pallets.length; i++){ 232 223 var menuitem = document.createElement("menuitem"); 233 224 menuitem.setAttribute("id", "vocalofx-skin-" + pallets[i]); 234 menuitem.setAttribute("label", vocalofx_properties.getString("vocalofx.skin.pallet." + pallets[i]));225 menuitem.setAttribute("label", this.vocalofx_properties.getString("vocalofx.skin.pallet." + pallets[i])); 235 226 menuitem.setAttribute("oncommand", "vocalofx.selectVocalofxSkinPallet('" + pallets[i] + "')"); 236 227 skin_popup.appendChild(menuitem); 237 228 } 238 }, 239 229 } 230 , 231 openFromToolDialog: function(aSubject){ 232 if(this.watcher.activeWindow.location == this.TOOLDIALOG_URL){ 233 var intervalID = setInterval(function(){ 234 try{ 235 var xul = aSubject.location; 236 if(xul != undefined && xul != "" && xul != "chrome://browser/content/browser.xul"){ 237 throw xul; 238 } 239 var url = aSubject.gLastValidURLStr; 240 if(url != undefined && url != "" && url != "about:blank"){ 241 clearInterval(intervalID); 242 window.openNewTabWith(url); 243 aSubject.close(); 244 window.focus(); 245 } 246 } 247 catch(e){ 248 clearInterval(intervalID); 249 } 250 }, 1); 251 } 252 } 253 , 240 254 init: function(){ 241 255 window.removeEventListener(this.BROWSER_ONLOAD, this, false); 242 update.check(); 243 244 pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); 245 brand = document.getElementById("bundle_brand"); 246 main_window = document.getElementById("main-window"); 247 sidebar = document.getElementById("sidebar"); 248 navigator_toolbox = document.getElementById("navigator-toolbox"); 249 menuroot = document.getElementById("vocalofx-menuroot"); 250 vocalofx_properties = document.getElementById("vocalofx-properties"); 251 skin_properties = document.getElementById("vocalofx-skin-properties"); 252 tool_properties = document.getElementById("vocalofx-tool-properties"); 253 254 pref.QueryInterface(Components.interfaces.nsIPrefBranch2); 255 pref.addObserver(this.SKINPREF_OBSERVER, this, false); 256 vocalofx_sidebar.init(sidebar); 257 vocalofx_navigator_toolbox.init(navigator_toolbox); 256 vocalofx_update.check(); 257 258 var Cc = Components.classes; 259 var Ci = Components.interfaces; 260 this.pref = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2); 261 this.watcher = Cc['@mozilla.org/embedcomp/window-watcher;1'].getService(Ci.nsIWindowWatcher); 262 this.brand = document.getElementById("bundle_brand"); 263 this.main_window = document.getElementById("main-window"); 264 this.sidebar = document.getElementById("sidebar"); 265 this.navigator_toolbox = document.getElementById("navigator-toolbox"); 266 this.menuroot = document.getElementById("vocalofx-menuroot"); 267 this.vocalofx_properties = document.getElementById("vocalofx-properties"); 268 this.skin_properties = document.getElementById("vocalofx-skin-properties"); 269 this.tool_properties = document.getElementById("vocalofx-tool-properties"); 270 271 this.pref.addObserver(this.SKINPREF_OBSERVER, this, false); 272 this.watcher.registerNotification(this); 273 vocalofx_sidebar.init(this.sidebar); 274 vocalofx_navigator_toolbox.init(this.navigator_toolbox); 258 275 259 276 this.setVocalofxSkinImage(); … … 261 278 this.setVocalofxPalletMenu(); 262 279 this.setVocalofxMenu(); 263 } ,264 280 } 281 , 265 282 destroy: function(){ 266 283 window.removeEventListener(this.BROWSER_ONLOAD, this, false); 267 pref.removeObserver(this.SKINPREF_OBSERVER, this, false); 284 this.pref.removeObserver(this.SKINPREF_OBSERVER, this, false); 285 this.watcher.unregisterNotification(this); 268 286 vocalofx_sidebar.destroy(); 269 287 vocalofx_navigator_toolbox.destroy(); 270 } ,271 288 } 289 , 272 290 observe: function(aSubject, aTopic, aData){ 273 291 switch(aTopic){ … … 288 306 } 289 307 break; 290 } 291 }, 292 308 case this.DOMWINDOWOPENED: 309 this.openFromToolDialog(aSubject); 310 break; 311 } 312 } 313 , 293 314 handleEvent: function(aEvent){ 294 315 switch(aEvent.type){ … … 305 326 var vocalofx_sidebar = { 306 327 SIDEBAR_ONLOAD: "load", 307 sidebar: null,308 328 309 329 init: function(sidebar){ 310 330 this.sidebar = sidebar; 311 331 this.sidebar.addEventListener(this.SIDEBAR_ONLOAD, this, true); 312 } ,313 332 } 333 , 314 334 destroy: function(){ 315 sidebar.removeEventListener(this.SIDEBAR_ONLOAD, this, true);316 } ,317 335 this.sidebar.removeEventListener(this.SIDEBAR_ONLOAD, this, true); 336 } 337 , 318 338 handleEvent: function(aEvent){ 319 339 switch(aEvent.type){ … … 327 347 var vocalofx_navigator_toolbox = { 328 348 NAVIGATOR_TOOLBAR_MODIFIED: "DOMAttrModified", 329 navigator_toolbox: null,330 style: null,331 height: null,332 333 get height(){334 return height;335 },336 337 set height(height){338 this.height = height;339 },340 349 341 350 init: function(navigator_toolbox){ 342 height = "0px";351 this.height = "0px"; 343 352 this.navigator_toolbox = navigator_toolbox; 344 353 this.navigator_toolbox.addEventListener(this.NAVIGATOR_TOOLBAR_MODIFIED, this, true); 345 }, 346 354 this.style = document.defaultView.getComputedStyle(this.navigator_toolbox, ""); 355 } 356 , 347 357 destroy: function(){ 348 navigator_toolbox.removeEventListener(this.NAVIGATOR_TOOLBAR_MODIFIED, this, true);349 } ,350 358 this.navigator_toolbox.removeEventListener(this.NAVIGATOR_TOOLBAR_MODIFIED, this, true); 359 } 360 , 351 361 isNavigatorToolboxHeightChanged: function(){ 352 if( height !=style.height){353 height =style.height;362 if(this.height != this.style.height){ 363 this.height = this.style.height; 354 364 return true; 355 365 } … … 357 367 return false; 358 368 } 359 } ,360 369 } 370 , 361 371 handleEvent: function(aEvent){ 362 style = document.defaultView.getComputedStyle(navigator_toolbox, "");;363 372 switch(aEvent.type){ 364 373 case this.NAVIGATOR_TOOLBAR_MODIFIED:
