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.

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-10-30 04:07:08 +09:00
parent 785666ccf7
commit 7938d32944

View File

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