チェンジセット 44

差分発生行の前後
無視リスト:
更新日時:
2009/02/02 22:05:29 (3 年 前)
更新者:
h
ログメッセージ:

fixes #19 #23 #24
まとめてコミット。
グローバル変数になってたのは、代表オブジェクトのメンバ変数に。
ツールからのリンクはかなり強引。fx2では非常に不安定。
自動更新はまあこんなもんで。

パス:
branches/candidate/chrome/content
ファイル:
6 変更

凡例:

変更なし
追加
削除
  • branches/candidate/chrome/content/tool/piapro_audio.html

    r33 r44  
    55<link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 
    66</head> 
    7 <body> 
     7<body onload="setTimeout('location.reload();', 60 * 60 * 1000);"> 
    88<embed name="piapro_player" src="http://piapro.jp/modpub/swf/bp_audio.swf" 
    99 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  
    55<link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 
    66</head> 
    7 <body> 
     7<body onload="setTimeout('location.reload();', 15 * 60 * 1000);"> 
    88<embed name="piapro_player" src="http://piapro.jp/modpub/swf/bp_image.swf" 
    99 FlashVars="pid=&fid=&view=image&c=0" quality="high" width="160" height="245" align="middle" 
  • branches/candidate/chrome/content/tool/tool.js

    r7 r44  
    88        tool = window.arguments[0]; 
    99        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"; 
    1414} 
    1515 
  • branches/candidate/chrome/content/tool/vocaran.html

    r33 r44  
    55<link rel="stylesheet" href="chrome://vocalofx/content/tool/toolhtml.css"> 
    66</head> 
    7 <body> 
     7<body onload="setTimeout('location.reload();', 60 * 60 * 1000);"> 
    88<embed src="http://bokasachi.natsu.gs/blog_part/vocaran.swf" 
    99 quality="high" bgcolor="#ffffff" width="180" height="300" name="vocaran" align="middle" 
  • branches/candidate/chrome/content/update.js

    r19 r44  
    1 var update = { 
     1var vocalofx_update = { 
    22        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, 
    173 
    184/* 0.4 
     
    4430        initVocalofxPref: function(){ 
    4531                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); 
    4935 
    5036                var pallet = vocalofx.DEFAULT_PALLET; 
    5137                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); 
    5541 
    5642                var ls = Components.interfaces.nsIPrefLocalizedString; 
    5743                var srchEngine = Components.classes["@mozilla.org/pref-localizedstring;1"].createInstance(ls); 
    5844                srchEngine.data = "ピアプロ音楽検索"; 
    59                 pref.setComplexValue("browser.search.selectedEngine", ls, srchEngine); 
    60         }, 
    61  
     45                this.pref.setComplexValue("browser.search.selectedEngine", ls, srchEngine); 
     46        } 
     47        , 
    6248/* 0.1pre2 
    6349user_pref("extensions.vocalofx.skin_category", "miku"); 
     
    8066        update_0_1pre: function(){ 
    8167                try{ 
    82                         var image = pref.getCharPref(vocalofx.SKIN_PROPERTY_IMAGE); 
     68                        var image = this.pref.getCharPref(vocalofx.SKIN_PROPERTY_IMAGE); 
    8369                        var token = image.split("/"); 
    8470                        var imagefile = token[token.length - 1]; 
    8571                        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); 
    8874 
    89                         var category = pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 
     75                        var category = this.pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 
    9076                        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); 
    9379                } 
    9480                catch(e){ 
    9581                        // nop 
    9682                } 
    97         }, 
    98  
     83        } 
     84        , 
    9985        showAlerts: function(){ 
    100                 if(macAlert){ 
     86                if(this.macAlert){ 
    10187                        this.alertMac(); 
    10288                } 
    103                 if(skinAlert){ 
     89                if(this.skinAlert){ 
    10490                        this.alertSkin(); 
    10591                } 
    106                 if(piaprogmAlert){ 
     92                if(this.piaprogmAlert){ 
    10793                        this.alertPiaprogm(); 
    10894                } 
    109                 window.clearTimeout(showAlerts_timeoutID); 
    110         }, 
    111  
     95                window.clearTimeout(this.showAlerts_timeoutID); 
     96        } 
     97        , 
    11298        alertMac: function(){ 
    113                 alert(vocalofx_properties.getString("vocalofx.macAlert")); 
    114         }, 
    115  
     99                alert(this.vocalofx_properties.getString("vocalofx.macAlert")); 
     100        } 
     101        , 
    116102        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); 
    119105                } 
    120106        }, 
    121107 
    122108        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        , 
    126112        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; 
    140128 
    141129                var version = "0.1pre"; 
    142130                try{ 
    143                         version = pref.getCharPref(this.VOCALOFX_PROPERTY_VERSION); 
     131                        version = this.pref.getCharPref(this.VOCALOFX_PROPERTY_VERSION); 
    144132                } 
    145133                catch(e){ 
    146134                        try{ 
    147                                 pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 
     135                                this.pref.getCharPref(vocalofx.SKIN_PROPERTY_CATEGORY); 
    148136                        } 
    149137                        catch(e){ 
     
    152140                } 
    153141 
    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; 
    157145                } 
    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; 
    161149                } 
    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; 
    165153                } 
    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); 
    167166 
    168                 if(version == addon.version){ 
     167                if(version == this.addon.version){ 
    169168                        return; 
    170169                } 
    171170 
    172                 pref.setCharPref(this.VOCALOFX_PROPERTY_VERSION, addon.version); 
     171                this.pref.setCharPref(this.VOCALOFX_PROPERTY_VERSION, this.addon.version); 
    173172                if(version == "init"){ 
    174173                        this.initVocalofxPref(); 
  • branches/candidate/chrome/content/vocalofx.js

    r41 r44  
    1717        BROWSER_UNONLOAD: "unload", 
    1818        BROWSER_PREF_CHANGED: "nsPref:changed", 
     19        DOMWINDOWOPENED: "domwindowopened", 
    1920        DEFAULT_CATEGORY: "luka", 
    2021        DEFAULT_SKIN: "kei_luka", 
    2122        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, 
    3123 
    3224        openVocalofxTool: function(tool){ 
    33                 var option = "chrome,dependent=yes,close=yes"; 
    34                 var toolsize = tool_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(","); 
    3527                option += ",width=" + toolsize[0]; 
    3628                option += ",height=" + toolsize[1]; 
    3729                try{ 
    38                         var toolprop = pref.getCharPref(this.TOOL_PROPERTY_POSITION + "." + tool).split(","); 
     30                        var toolprop = this.pref.getCharPref(this.TOOL_PROPERTY_POSITION + "." + tool).split(","); 
    3931                        option += ",left=" + parseInt(toolprop[0]) + ",top=" + parseInt(toolprop[1]); 
    4032                } 
     
    4234                        option += ",centerscreen"; 
    4335                } 
    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"); 
    4839                } 
    4940                catch(e){ 
     
    5243                var dialog = window.openDialog(this.TOOLDIALOG_URL, tool, option, tool, toolname); 
    5344                dialog.focus(); 
    54         }, 
    55  
     45        } 
     46        , 
    5647        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        , 
    6556        selectVocalofxSkinPallet: function(pallet){ 
    6657                var category; 
    6758                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        , 
    8475        setVocalofxSkinImage: function(){ 
    8576                var image; 
    8677                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        , 
    9889        setVocalofxSkinCategory: function(){ 
    9990                var category; 
    10091                var pallet; 
    10192                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); 
    111102                this.setVocalofxPalletMenu(); 
    112         }, 
    113  
     103        } 
     104        , 
    114105        setVocalofxImagePosition: function(){ 
    115106                var position; 
     
    117108                var position_ratio; 
    118109                try{ 
    119                         position = pref.getCharPref(this.SKIN_PROPERTY_POSITION).split(","); 
     110                        position = this.pref.getCharPref(this.SKIN_PROPERTY_POSITION).split(","); 
    120111                        position_height = Number(position[0]); 
    121112                        position_ratio = Number(position[1]); 
     
    132123                                image_top = 0; 
    133124                        } 
    134                         main_window.style.backgroundPosition = "100% " + image_top + "px"; 
     125                        this.main_window.style.backgroundPosition = "100% " + image_top + "px"; 
    135126                } 
    136127                catch(e){ 
    137128                        // nop 
    138129                } 
    139         }, 
    140  
     130        } 
     131        , 
    141132        setVocalofxSkinPallet: function(){ 
    142133                var pallet; 
    143134                try{ 
    144                         pallet = pref.getCharPref(this.SKIN_PROPERTY_PALLET); 
     135                        pallet = this.pref.getCharPref(this.SKIN_PROPERTY_PALLET); 
    145136                } 
    146137                catch(e){ 
     
    149140                } 
    150141 
    151                 main_window.setAttribute(this.SKIN_ATTRIBUTE, pallet); 
     142                this.main_window.setAttribute(this.SKIN_ATTRIBUTE, pallet); 
    152143                this.setSidebarVocalofxSkin(); 
    153         }, 
    154  
     144        } 
     145        , 
    155146        setSidebarVocalofxSkin: function(){ 
    156147                var pallet; 
    157148                try{ 
    158                         pallet = pref.getCharPref(this.SKIN_PROPERTY_PALLET); 
     149                        pallet = this.pref.getCharPref(this.SKIN_PROPERTY_PALLET); 
    159150                } 
    160151                catch(e){ 
     
    164155 
    165156                try{ 
    166                         var bookmarksPanel = sidebar.contentDocument.getElementById("bookmarksPanel"); 
     157                        var bookmarksPanel = this.sidebar.contentDocument.getElementById("bookmarksPanel"); 
    167158                        if(bookmarksPanel){ 
    168159                                bookmarksPanel.setAttribute(this.SKIN_ATTRIBUTE, pallet); 
    169160                        } 
    170                         var history_panel = sidebar.contentDocument.getElementById("history-panel"); 
     161                        var history_panel = this.sidebar.contentDocument.getElementById("history-panel"); 
    171162                        if(history_panel){ 
    172163                                history_panel.setAttribute(this.SKIN_ATTRIBUTE, pallet); 
     
    176167                        // nop 
    177168                } 
    178         }, 
    179  
     169        } 
     170        , 
    180171        setVocalofxMenu: function(){ 
    181                 var skins = skin_properties.getString("skinmenu").split(","); 
     172                var skins = this.skin_properties.getString("skinmenu").split(","); 
    182173                for(var i = 0; i < skins.length; i++){ 
    183174                        var menuitem = document.createElement("menuitem"); 
    184175                        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])); 
    186177                        menuitem.setAttribute("oncommand", "vocalofx.selectVocalofxSkin('" + skins[i] + "')"); 
    187178 
    188                         var category = skin_properties.getString(skins[i] + ".category_sub"); 
     179                        var category = this.skin_properties.getString(skins[i] + ".category_sub"); 
    189180                        var skin_popup = document.getElementById("vocalofx-skin-popup-" + category); 
    190181                        skin_popup.appendChild(menuitem); 
     
    192183 
    193184                var tool_popup = document.getElementById("vocalofx-tool-popup"); 
    194                 var tools = tool_properties.getString("toolmenu").split(","); 
     185                var tools = this.tool_properties.getString("toolmenu").split(","); 
    195186                for(var i = 0; i < tools.length; i++){ 
    196187                        var menuitem = document.createElement("menuitem"); 
    197188                        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])); 
    199190                        menuitem.setAttribute("oncommand", "vocalofx.openVocalofxTool('" + tools[i] + "')"); 
    200191                        tool_popup.appendChild(menuitem); 
    201192                        try{ 
    202                                 if(pref.getBoolPref(this.TOOL_PROPERTY_STARTUP + "." + tools[i])){ 
     193                                if(this.pref.getBoolPref(this.TOOL_PROPERTY_STARTUP + "." + tools[i])){ 
    203194                                        this.openVocalofxTool(tools[i]); 
    204195                                } 
     
    208199                        } 
    209200                } 
    210         }, 
    211  
     201        } 
     202        , 
    212203        setVocalofxPalletMenu: function(){ 
    213204                var category; 
    214205                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"; 
    223214 
    224215                var skin_popup = document.getElementById("vocalofx-skin-popup-pallet"); 
     
    228219                } 
    229220 
    230                 var pallets = skin_properties.getString("palletmenu." + category).split(","); 
     221                var pallets = this.skin_properties.getString("palletmenu." + category).split(","); 
    231222                for(var i = 0; i < pallets.length; i++){ 
    232223                        var menuitem = document.createElement("menuitem"); 
    233224                        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])); 
    235226                        menuitem.setAttribute("oncommand", "vocalofx.selectVocalofxSkinPallet('" + pallets[i] + "')"); 
    236227                        skin_popup.appendChild(menuitem); 
    237228                } 
    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        , 
    240254        init: function(){ 
    241255                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); 
    258275 
    259276                this.setVocalofxSkinImage(); 
     
    261278                this.setVocalofxPalletMenu(); 
    262279                this.setVocalofxMenu(); 
    263         }, 
    264  
     280        } 
     281        , 
    265282        destroy: function(){ 
    266283                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); 
    268286                vocalofx_sidebar.destroy(); 
    269287                vocalofx_navigator_toolbox.destroy(); 
    270         }, 
    271  
     288        } 
     289        , 
    272290        observe: function(aSubject, aTopic, aData){ 
    273291                switch(aTopic){ 
     
    288306                        } 
    289307                break; 
    290                 } 
    291         }, 
    292  
     308                case this.DOMWINDOWOPENED: 
     309                        this.openFromToolDialog(aSubject); 
     310                break; 
     311                } 
     312        } 
     313        , 
    293314        handleEvent: function(aEvent){ 
    294315                switch(aEvent.type){ 
     
    305326var vocalofx_sidebar = { 
    306327        SIDEBAR_ONLOAD: "load", 
    307         sidebar: null, 
    308328 
    309329        init: function(sidebar){ 
    310330                this.sidebar = sidebar; 
    311331                this.sidebar.addEventListener(this.SIDEBAR_ONLOAD, this, true); 
    312         }, 
    313  
     332        } 
     333        , 
    314334        destroy: function(){ 
    315                 sidebar.removeEventListener(this.SIDEBAR_ONLOAD, this, true); 
    316         }, 
    317  
     335                this.sidebar.removeEventListener(this.SIDEBAR_ONLOAD, this, true); 
     336        } 
     337        , 
    318338        handleEvent: function(aEvent){ 
    319339                switch(aEvent.type){ 
     
    327347var vocalofx_navigator_toolbox = { 
    328348        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         }, 
    340349 
    341350        init: function(navigator_toolbox){ 
    342                 height = "0px"; 
     351                this.height = "0px"; 
    343352                this.navigator_toolbox = navigator_toolbox; 
    344353                this.navigator_toolbox.addEventListener(this.NAVIGATOR_TOOLBAR_MODIFIED, this, true); 
    345         }, 
    346  
     354                this.style = document.defaultView.getComputedStyle(this.navigator_toolbox, ""); 
     355        } 
     356        , 
    347357        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        , 
    351361        isNavigatorToolboxHeightChanged: function(){ 
    352                 if(height != style.height){ 
    353                         height = style.height; 
     362                if(this.height != this.style.height){ 
     363                        this.height = this.style.height; 
    354364                        return true; 
    355365                } 
     
    357367                        return false; 
    358368                } 
    359         }, 
    360  
     369        } 
     370        , 
    361371        handleEvent: function(aEvent){ 
    362                 style = document.defaultView.getComputedStyle(navigator_toolbox, "");; 
    363372                switch(aEvent.type){ 
    364373                case this.NAVIGATOR_TOOLBAR_MODIFIED: