TooManyTabs ( https://addons.mozilla.org/firefox/addon/9429 ) が有効な環境では、厳密にtwistyの上でクリックした時以外はツリーの開閉を行わないようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4371 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-05-08 06:04:22 +00:00
parent 8c89521a7e
commit 8152a51093
3 changed files with 36 additions and 4 deletions

View File

@ -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;
});
}
};

View File

@ -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;
}

View File

@ -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);