From f88984a12ee553649b02ad6b623f9509b9c1db8e Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 28 Feb 2008 07:45:39 +0000 Subject: [PATCH] =?UTF-8?q?ColorfulTabs=E3=82=92=E5=B0=8E=E5=85=A5?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E5=A0=B4=E5=90=88=E3=80=81?= =?UTF-8?q?=E5=AD=90=E4=BE=9B=E3=81=AE=E3=82=BF=E3=83=96=E3=81=AF=E8=A6=AA?= =?UTF-8?q?=E3=81=AE=E3=82=BF=E3=83=96=E3=81=AE=E8=89=B2=E3=82=92=E7=B6=99?= =?UTF-8?q?=E6=89=BF=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=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@1951 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/hacks.js | 16 ++++++++++++++++ content/treestyletab/treestyletab.js | 12 +++++++++--- content/treestyletab/treestyletabbrowser.js | 15 ++++++++++++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index bd0c7de8..2007f07f 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -495,4 +495,20 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() { ); } + // ColorfulTab + if ('clrtabsInit' in window) { + this.registerAttachTabPostProcess(function(aChild, aParent, aService) { + if (aChild && aParent) { + setColor(aChild, aService.SessionStore.getTabValue(aParent, 'tabClr')); + } + else if (aChild) { + aService.SessionStore.setTabValue(aChild, 'tabClr', '') + calcTabClr({ + target : aChild, + originalTarget : aChild, + }); + } + }); + } + }; diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index ff81bbe9..6f9049e6 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -477,7 +477,7 @@ var TreeStyleTabService = { this.setTreePref('enableSubtreeIndent', vertical); this.setTreePref('allowSubtreeCollapseExpand', vertical); }, - + /* get tab(s) */ getTabById : function(aId, aTabBrowserChildren) @@ -1189,7 +1189,7 @@ catch(e) { }, /* Event Handling */ - + handleEvent : function(aEvent) { switch (aEvent.type) @@ -1438,7 +1438,13 @@ catch(e) { (aCollapse ? 'collapse' : 'open' ) ); }, - + + registerAttachTabPostProcess : function(aProcess) + { + this._attachTabPostProcesses.push(aProcess); + }, + _attachTabPostProcesses : [], + /* Pref Listener */ domain : 'extensions.treestyletab', diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index b7dc5e4e..195671ec 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1992,8 +1992,10 @@ TreeStyleTabBrowser.prototype = { !aParent || aChild == aParent || this.getParentTab(aChild) == aParent - ) + ) { + this.attachTabPostProcess(aChild, aParent); return; + } if (!aInfo) aInfo = {}; @@ -2072,6 +2074,15 @@ TreeStyleTabBrowser.prototype = { this.updateTabsIndent([aChild]); this.checkTabsIndentOverflow(); } + + this.attachTabPostProcess(aChild, aParent); + }, + attachTabPostProcess : function(aChild, aParent) + { + var self = this; + this._attachTabPostProcesses.forEach(function(aProcess) { + aProcess(aChild, aParent, self); + }); }, partTab : function(aChild, aDontUpdateIndent) @@ -2093,6 +2104,8 @@ TreeStyleTabBrowser.prototype = { this.updateTabsIndent([aChild]); this.checkTabsIndentOverflow(); } + + this.attachTabPostProcess(aChild, null); }, updateTabsIndent : function(aTabs, aLevel, aProp)