From 7938d32944e9336fddd171b8a8638bc7cc391c69 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Sun, 30 Oct 2011 04:07:08 +0900 Subject: [PATCH] hacks for Colorful Tabs https://addons.mozilla.org/firefox/addon/1368 didn't work correctly. Now member tabs of a tree are colored with the same color. --- content/treestyletab/windowHelperHacks.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index 15922cf4..117fea06 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -539,12 +539,18 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove { switch (aEvent.type) { + case 'TabOpen': case 'TreeStyleTabAttached': case 'TreeStyleTabParted': var child = aEvent.originalTarget; var parent = aEvent.parentTab; if (child && parent) { - colorfulTabs.setColor(child, TreeStyleTabService.SessionStore.getTabValue(parent, 'tabClr')); + let color = TreeStyleTabService.SessionStore.getTabValue(parent, 'tabClr'); + if (/^\d+,\d+,\d+$/.test(color)) + color = 'rgb('+color+')'; + window.setTimeout(function() { + colorfulTabs.setColor(child, color); + }, 0); } else if (child) { TreeStyleTabService.SessionStore.setTabValue(child, 'tabClr', ''); @@ -556,6 +562,7 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove break; case 'unload': + document.removeEventListener('TabOpen', this, false); document.removeEventListener('TreeStyleTabAttached', this, false); document.removeEventListener('TreeStyleTabParted', this, false); document.removeEventListener('unload', this, false); @@ -569,6 +576,7 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove '.display = ""' ) ); + document.addEventListener('TabOpen', listener, false); document.addEventListener('TreeStyleTabAttached', listener, false); document.addEventListener('TreeStyleTabParted', listener, false); document.addEventListener('unload', listener, false);