From 8152a51093e4c5d47623659ff39bc6aa9b579cb4 Mon Sep 17 00:00:00 2001 From: piro Date: Fri, 8 May 2009 06:04:22 +0000 Subject: [PATCH] =?UTF-8?q?TooManyTabs=20(=20https://addons.mozilla.org/fi?= =?UTF-8?q?refox/addon/9429=20)=20=E3=81=8C=E6=9C=89=E5=8A=B9=E3=81=AA?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E3=81=A7=E3=81=AF=E3=80=81=E5=8E=B3=E5=AF=86?= =?UTF-8?q?=E3=81=ABtwisty=E3=81=AE=E4=B8=8A=E3=81=A7=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=97=E3=81=9F=E6=99=82=E4=BB=A5=E5=A4=96?= =?UTF-8?q?=E3=81=AF=E3=83=84=E3=83=AA=E3=83=BC=E3=81=AE=E9=96=8B=E9=96=89?= =?UTF-8?q?=E3=82=92=E8=A1=8C=E3=82=8F=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= 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@4371 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/hacks.js | 8 ++++++- content/treestyletab/treestyletab.js | 31 +++++++++++++++++++++++++--- defaults/preferences/treestyletab.js | 1 + 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index 6ca3913e..b7264dfc 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -679,7 +679,6 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() { ); } - // Autohide if ('autoHIDE' in window) { TreeStyleTabService.registerTabbarAutoShowPostProcess(function(aTabBrowser) { @@ -732,4 +731,11 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() { window.addEventListener('unload', autoHideEventListener, false); } + // TooManyTabs + if ('tooManyTabs' in window) { + this.registerExpandTwistyAreaAllowance(function(aTabBrowser) { + return false; + }); + } + }; diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 78463d67..7341ab08 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -497,14 +497,28 @@ var TreeStyleTabService = { isEventFiredOnTwisty : function(aEvent) { var tab = this.getTabFromEvent(aEvent); - if (!tab) return false; + if (!tab || !this.hasChildTabs(tab)) return false; - return this.hasChildTabs(tab) && this.evaluateXPath( - 'ancestor-or-self::*[@class="'+this.kTWISTY+'" or (ancestor::xul:tabbrowser[@'+this.kMODE+'="vertical"] and @class="tab-icon")]', + var expression = 'ancestor-or-self::*[@class="'+this.kTWISTY+'"]'; + if (this.canExpandTwistyArea(this.getTabBrowserFromChild(tab))) + expression += ' | ancestor-or-self::*[@class="tab-icon" and ancestor::xul:tabbrowser[@'+this.kMODE+'="vertical"]]'; + + return this.evaluateXPath( + expression, aEvent.originalTarget || aEvent.target, XPathResult.BOOLEAN_TYPE ).booleanValue; }, + canExpandTwistyArea : function(aTabBrowser) + { + return ( + this.expandTwistyArea && + this._expandTwistyAreaAllowance.every(function(aFunc) { + return aFunc(aTabBrowser); + }) + ); + }, + expandTwistyArea : true, isEventFiredOnClickable : function(aEvent) { @@ -1156,6 +1170,7 @@ var TreeStyleTabService = { this.observe(null, 'nsPref:changed', 'extensions.treestyletab.animation.enabled'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.animation.indent.duration'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.animation.collapse.duration'); + this.observe(null, 'nsPref:changed', 'extensions.treestyletab.twisty.expandSensitiveArea'); }, initialized : false, @@ -2174,6 +2189,12 @@ catch(e) { }, _tabFocusAllowance : [], + registerExpandTwistyAreaAllowance : function(aProcess) + { + this._expandTwistyAreaAllowance.push(aProcess); + }, + _expandTwistyAreaAllowance : [], + registerCollapseExpandPostProcess : function(aProcess) { this._collapseExpandPostProcess.push(aProcess); @@ -2311,6 +2332,10 @@ catch(e) { ].join('-')); break; + case 'extensions.treestyletab.twisty.expandSensitiveArea': + this.expandTwistyArea = value; + break; + default: break; } diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index a914e818..99604547 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -48,6 +48,7 @@ pref("extensions.treestyletab.indent", 12); // 0 = first child, 1 = last child pref("extensions.treestyletab.insertNewChildAt", 1); pref("extensions.treestyletab.twisty.style", "auto"); // none, retro, modern-black, modern-white, auto +pref("extensions.treestyletab.twisty.expandSensitiveArea", true); pref("extensions.treestyletab.clickOnIndentSpaces.enabled", true); pref("extensions.treestyletab.show.openSelectionLinks", true);