From 6364652b4415aebdaf39ffaa08674de2cfeca6d0 Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 31 Mar 2010 11:15:18 +0000 Subject: [PATCH] =?UTF-8?q?Super=20Tab=20Mode=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=81=AE=E3=83=95=E3=82=A9=E3=83=BC=E3=82=AB?= =?UTF-8?q?=E3=82=B9=E5=88=B6=E5=BE=A1=E3=82=92=E5=84=AA=E5=85=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6534 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/hacks.js | 126 ++++++++++++++++++---------------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index e655dd32..0f65f774 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -301,67 +301,6 @@ TreeStyleTabService.overrideExtensionsOnInitBefore = function TSTService_overrid ); } } - - // Super Tab Mode - // https://addons.mozilla.org/firefox/addon/13288 - if ('stmM' in window) { - var observer = { - domain : 'extensions.stm.', - observe : function(aSubject, aTopic, aData) - { - switch (aData) - { - case 'extensions.stm.tabBarMultiRows': - case 'extensions.stm.tabBarPosition': - if ( - TreeStyleTabService.getPref('extensions.stm.tabBarMultiRows') && - TreeStyleTabService.getPref('extensions.stm.tabBarPosition') == 0 - ) { - TreeStyleTabService.setPref('extensions.stm.tabBarMultiRows.override', false); - } - return; - - case 'extensions.stm.newTabBtnPos': - if (TreeStyleTabService.getPref(aData) == 0) - document.documentElement.removeAttribute(TreeStyleTabService.kHIDE_NEWTAB); - else - document.documentElement.setAttribute(TreeStyleTabService.kHIDE_NEWTAB, true); - return; - } - } - }; - observer.observe(null, null, 'extensions.stm.tabBarMultiRows'); - observer.observe(null, null, 'extensions.stm.newTabBtnPos'); - TreeStyleTabService.addPrefListener(observer); - window.addEventListener('unload', function() { - window.removeEventListener('unload', arguments.callee, false); - TreeStyleTabService.removePrefListener(observer); - }, false); - - let warnPref = 'extensions.treestyletab.compatibility.STM.warnForNewTabPosition'; - if ( - this.getPref(warnPref) && - this.getPref('extensions.stm.newTabPosition') != 0 - ) { - let checked = { value : false }; - if (this.PromptService.confirmEx( - null, - this.treeBundle.getString('compatibility_STM_warning_title'), - this.treeBundle.getString('compatibility_STM_warning_text'), - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), - this.treeBundle.getString('compatibility_STM_warning_use_TST'), - this.treeBundle.getString('compatibility_STM_warning_use_STM'), - null, - this.treeBundle.getString('compatibility_STM_warning_never'), - checked - ) == 0) { - this.setPref('extensions.stm.newTabPosition', 0); - } - if (checked.value) - this.setPref(warnPref, false); - } - } }; TreeStyleTabService.overrideExtensionsOnInitAfter = function TSTService_overrideExtensionsOnInitAfter() { @@ -1080,6 +1019,71 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function TSTService_override ); } + // Super Tab Mode + // https://addons.mozilla.org/firefox/addon/13288 + if ('stmM' in window) { + var observer = { + domain : 'extensions.stm.', + observe : function(aSubject, aTopic, aData) + { + switch (aData) + { + case 'extensions.stm.tabBarMultiRows': + case 'extensions.stm.tabBarPosition': + if ( + TreeStyleTabService.getPref('extensions.stm.tabBarMultiRows') && + TreeStyleTabService.getPref('extensions.stm.tabBarPosition') == 0 + ) { + TreeStyleTabService.setPref('extensions.stm.tabBarMultiRows.override', false); + } + return; + + case 'extensions.stm.newTabBtnPos': + if (TreeStyleTabService.getPref(aData) == 0) + document.documentElement.removeAttribute(TreeStyleTabService.kHIDE_NEWTAB); + else + document.documentElement.setAttribute(TreeStyleTabService.kHIDE_NEWTAB, true); + return; + } + } + }; + observer.observe(null, null, 'extensions.stm.tabBarMultiRows'); + observer.observe(null, null, 'extensions.stm.newTabBtnPos'); + TreeStyleTabService.addPrefListener(observer); + window.addEventListener('unload', function() { + window.removeEventListener('unload', arguments.callee, false); + TreeStyleTabService.removePrefListener(observer); + }, false); + + let warnPref = 'extensions.treestyletab.compatibility.STM.warnForNewTabPosition'; + if ( + this.getPref(warnPref) && + this.getPref('extensions.stm.newTabPosition') != 0 + ) { + let checked = { value : false }; + if (this.PromptService.confirmEx( + null, + this.treeBundle.getString('compatibility_STM_warning_title'), + this.treeBundle.getString('compatibility_STM_warning_text'), + (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + + (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), + this.treeBundle.getString('compatibility_STM_warning_use_TST'), + this.treeBundle.getString('compatibility_STM_warning_use_STM'), + null, + this.treeBundle.getString('compatibility_STM_warning_never'), + checked + ) == 0) { + this.setPref('extensions.stm.newTabPosition', 0); + } + if (checked.value) + this.setPref(warnPref, false); + } + + TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) { + return aTabBrowser.treeStyleTab.getPref('extensions.stm.focusAfterCloseTab') == 0; + }); + } + window.setTimeout(function(aSelf) { aSelf.overrideExtensionsDelayed();