一部のライブラリをJavaScriptコードモジュールとして読み込むようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6689 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-06-22 18:00:16 +00:00
parent dd75958b3c
commit 8a733db96c
12 changed files with 192 additions and 41 deletions

View File

@ -1,6 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="res/animationManager.js" type="application/javascript"/>
<script src="treestyletab.js" type="application/javascript"/> <script src="treestyletab.js" type="application/javascript"/>
<script src="bookmarksOverlay.js" type="application/javascript"/> <script src="bookmarksOverlay.js" type="application/javascript"/>
</overlay> </overlay>

View File

@ -6,6 +6,10 @@ var Prefs = Components
.classes['@mozilla.org/preferences;1'] .classes['@mozilla.org/preferences;1']
.getService(Components.interfaces.nsIPrefBranch); .getService(Components.interfaces.nsIPrefBranch);
Components.utils.import('resource://treestyletab-modules/animationManager.js', {});
Components.utils.import('resource://treestyletab-modules/namespace.jsm');
var animationManager = getNamespaceFor('piro.sakura.ne.jp')['piro.sakura.ne.jp'].animationManager;
var gGroupBookmarkRadio, var gGroupBookmarkRadio,
gGroupBookmarkUnderParent, gGroupBookmarkUnderParent,
gGroupBookmarkType, gGroupBookmarkType,
@ -103,7 +107,7 @@ function initAppearancePane()
} }
return finished; return finished;
}; };
window['piro.sakura.ne.jp'].animationManager.addTask(task, 0, 0, 500); animationManager.addTask(task, 0, 0, 500);
}); });
} }

View File

@ -783,7 +783,6 @@
</prefpane> </prefpane>
<script src="res/animationManager.js" type="application/javascript"/>
<script src="config.js" type="application/javascript"/> <script src="config.js" type="application/javascript"/>
</prefwindow> </prefwindow>

View File

@ -693,7 +693,7 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function TSTService_override
// Focus Last Selected Tab 0.9.5.x // Focus Last Selected Tab 0.9.5.x
// http://www.gozer.org/mozilla/extensions/ // http://www.gozer.org/mozilla/extensions/
if (window['piro.sakura.ne.jp'].extensions.isAvailable('focuslastselectedtab@gozer.org')) { if (this.extensions.isAvailable('focuslastselectedtab@gozer.org')) {
TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) { TreeStyleTabService.registerTabFocusAllowance(function(aTabBrowser) {
return !aTabBrowser.selectedTab.hasAttribute('lastselected'); return !aTabBrowser.selectedTab.hasAttribute('lastselected');
}); });
@ -1099,7 +1099,7 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function TSTService_override
// Remove New Tab Button // Remove New Tab Button
// https://addons.mozilla.org/firefox/addon/10535 // https://addons.mozilla.org/firefox/addon/10535
if (window['piro.sakura.ne.jp'].extensions.isAvailable('remove-new-tab-button@forerunnerdesigns.com')) { if (this.extensions.isAvailable('remove-new-tab-button@forerunnerdesigns.com')) {
document.documentElement.setAttribute(TreeStyleTabService.kHIDE_NEWTAB, true); document.documentElement.setAttribute(TreeStyleTabService.kHIDE_NEWTAB, true);
} }

View File

@ -1291,7 +1291,6 @@ catch(e) {
try { try {
window.removeEventListener('unload', this, false); window.removeEventListener('unload', this, false);
window['piro.sakura.ne.jp'].animationManager.stop();
gBrowser.treeStyleTab.saveCurrentState(); gBrowser.treeStyleTab.saveCurrentState();
this.destroyTabBrowser(gBrowser); this.destroyTabBrowser(gBrowser);

View File

@ -7,10 +7,7 @@
<overlay id="treestyletab-overlay" <overlay id="treestyletab-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="res/autoScroll.js" type="application/javascript"/>
<script src="res/animationManager.js" type="application/javascript"/>
<script src="res/stopRendering.js" type="application/javascript"/> <script src="res/stopRendering.js" type="application/javascript"/>
<script src="res/extensions.js" type="application/javascript"/>
<script src="res/UninstallationListener.js" type="application/javascript"/> <script src="res/UninstallationListener.js" type="application/javascript"/>
<script src="treestyletab.js" type="application/javascript"/> <script src="treestyletab.js" type="application/javascript"/>

View File

@ -1349,6 +1349,8 @@ TreeStyleTabBrowser.prototype = {
destroy : function TSTBrowser_destroy() destroy : function TSTBrowser_destroy()
{ {
this.animationManager.removeTask(this.smoothScrollTask);
this.autoHide.destroy(); this.autoHide.destroy();
delete this._autoHide; delete this._autoHide;
@ -1356,6 +1358,8 @@ TreeStyleTabBrowser.prototype = {
delete b.tabContainer.treeStyleTab; delete b.tabContainer.treeStyleTab;
this.getTabsArray(b).forEach(function(aTab) { this.getTabsArray(b).forEach(function(aTab) {
this.stopTabIndentAnimation(aTab);
this.stopTabCollapseAnimation(aTab);
this.destroyTab(aTab); this.destroyTab(aTab);
}, this); }, this);
@ -1640,7 +1644,7 @@ TreeStyleTabBrowser.prototype = {
aStyle = 'osx'; aStyle = 'osx';
} }
else if ( else if (
window['piro.sakura.ne.jp'].extensions.isAvailable('informationaltab@piro.sakura.ne.jp') && this.extensions.isAvailable('informationaltab@piro.sakura.ne.jp') &&
this.getPref('extensions.informationaltab.thumbnail.enabled') && this.getPref('extensions.informationaltab.thumbnail.enabled') &&
this.getPref('extensions.informationaltab.thumbnail.position') < 100 this.getPref('extensions.informationaltab.thumbnail.position') < 100
) { ) {
@ -3809,14 +3813,14 @@ TreeStyleTabBrowser.prototype = {
} }
return finished; return finished;
}; };
window['piro.sakura.ne.jp'].animationManager.addTask( this.animationManager.addTask(
aTab.__treestyletab__updateTabIndentTask, aTab.__treestyletab__updateTabIndentTask,
0, 0, this.indentDuration 0, 0, this.indentDuration
); );
}, },
stopTabIndentAnimation : function TSTBrowser_stopTabIndentAnimation(aTab) stopTabIndentAnimation : function TSTBrowser_stopTabIndentAnimation(aTab)
{ {
window['piro.sakura.ne.jp'].animationManager.removeTask( this.animationManager.removeTask(
aTab.__treestyletab__updateTabIndentTask aTab.__treestyletab__updateTabIndentTask
); );
}, },
@ -4183,7 +4187,7 @@ TreeStyleTabBrowser.prototype = {
return false; return false;
} }
}; };
window['piro.sakura.ne.jp'].animationManager.addTask( this.animationManager.addTask(
aTab.__treestyletab__updateTabCollapsedTask, aTab.__treestyletab__updateTabCollapsedTask,
0, 0, this.collapseDuration 0, 0, this.collapseDuration
); );
@ -4191,7 +4195,7 @@ TreeStyleTabBrowser.prototype = {
kOPACITY_RULE_REGEXP : /opacity\s*:[^;]+;?/, kOPACITY_RULE_REGEXP : /opacity\s*:[^;]+;?/,
stopTabCollapseAnimation : function TSTBrowser_stopTabCollapseAnimation(aTab) stopTabCollapseAnimation : function TSTBrowser_stopTabCollapseAnimation(aTab)
{ {
window['piro.sakura.ne.jp'].animationManager.removeTask( this.animationManager.removeTask(
aTab.__treestyletab__updateTabCollapsedTask aTab.__treestyletab__updateTabCollapsedTask
); );
}, },
@ -4296,7 +4300,7 @@ TreeStyleTabBrowser.prototype = {
smoothScrollTo : function TSTBrowser_smoothScrollTo(aEndX, aEndY) smoothScrollTo : function TSTBrowser_smoothScrollTo(aEndX, aEndY)
{ {
var b = this.mTabBrowser; var b = this.mTabBrowser;
window['piro.sakura.ne.jp'].animationManager.removeTask(this.smoothScrollTask); this.animationManager.removeTask(this.smoothScrollTask);
var scrollBoxObject = this.scrollBoxObject; var scrollBoxObject = this.scrollBoxObject;
var x = {}, y = {}; var x = {}, y = {};
@ -4339,7 +4343,7 @@ TreeStyleTabBrowser.prototype = {
scrollBoxObject.scrollTo(newX, newY); scrollBoxObject.scrollTo(newX, newY);
return false; return false;
}; };
window['piro.sakura.ne.jp'].animationManager.addTask( this.animationManager.addTask(
this.smoothScrollTask, this.smoothScrollTask,
0, 0, this.smoothScrollDuration 0, 0, this.smoothScrollDuration
); );

View File

@ -1,3 +1,10 @@
var EXPORTED_SYMBOLS = ['window'];
Components.utils.import('resource://treestyletab-modules/namespace.jsm');
var window = getNamespaceFor('piro.sakura.ne.jp');
if (!('setInterval' in window))
Components.utils.import('resource://treestyletab-modules/jstimer.jsm', window);
/* /*
Animation Task Manager Animation Task Manager

View File

@ -1,3 +1,7 @@
var EXPORTED_SYMBOLS = ['window'];
Components.utils.import('resource://treestyletab-modules/namespace.jsm');
var window = getNamespaceFor('piro.sakura.ne.jp');
/* /*
Tab Bar AutoScroll Library for Vertical and Horizontal Tab Bar Tab Bar AutoScroll Library for Vertical and Horizontal Tab Bar
@ -6,13 +10,13 @@
.autoScroll .autoScroll
.processAutoScroll(mouseMoveOrDragOverEvent); .processAutoScroll(mouseMoveOrDragOverEvent);
lisence: The MIT License, Copyright (c) 2009 SHIMODA "Piro" Hiroshi lisence: The MIT License, Copyright (c) 2009-2010 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt
original: original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/autoScroll.js http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/autoScroll.js
*/ */
(function() { (function() {
const currentRevision = 2; const currentRevision = 3;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -23,8 +27,8 @@
return; return;
} }
var Cc = Components.classes; const Cc = Components.classes;
var Ci = Components.interfaces; const Ci = Components.interfaces;
window['piro.sakura.ne.jp'].autoScroll = { window['piro.sakura.ne.jp'].autoScroll = {
revision : currentRevision, revision : currentRevision,
@ -36,7 +40,7 @@
'ancestor-or-self::*[local-name()="tabbrowser"]', 'ancestor-or-self::*[local-name()="tabbrowser"]',
target, target,
null, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE,
null null
).singleNodeValue; ).singleNodeValue;
if (!b) return false; if (!b) return false;
@ -45,6 +49,8 @@
if (tabs.getAttribute('overflow') != 'true') if (tabs.getAttribute('overflow') != 'true')
return false; return false;
var view = target.ownerDocument.defaultView;
var box = this.getScrollBox(b); var box = this.getScrollBox(b);
var boxObject = this.getScrollBoxObject(b); var boxObject = this.getScrollBoxObject(b);
var innerBoxObject = (box.localName == 'arrowscrollbox' ? box._scrollbox : box ).boxObject; var innerBoxObject = (box.localName == 'arrowscrollbox' ? box._scrollbox : box ).boxObject;
@ -53,7 +59,7 @@
var isMultirow = tabs.getAttribute('flowing') == 'multibar'; // Tab Mix Plus var isMultirow = tabs.getAttribute('flowing') == 'multibar'; // Tab Mix Plus
var isVertical = ( var isVertical = (
isMultirow || isMultirow ||
((orientBox.getAttribute('orient') || window.getComputedStyle(orientBox, '').getPropertyValue('-moz-box-orient')) == 'vertical') ((orientBox.getAttribute('orient') || view.getComputedStyle(orientBox, '').getPropertyValue('-moz-box-orient')) == 'vertical')
); );
var maxX = {}, maxY = {}, curX = {}, curY = {}; var maxX = {}, maxY = {}, curX = {}, curY = {};
@ -77,7 +83,7 @@
} }
else { else {
pixels = box.scrollIncrement; pixels = box.scrollIncrement;
var ltr = window.getComputedStyle(tabs, null).direction == 'ltr'; var ltr = view.getComputedStyle(tabs, null).direction == 'ltr';
if (aEvent.screenX < boxObject.screenX + this.getUpButtonWidth(b)) { if (aEvent.screenX < boxObject.screenX + this.getUpButtonWidth(b)) {
if (curX.value == 0) return false; if (curX.value == 0) return false;
pixels *= -1; pixels *= -1;
@ -106,7 +112,7 @@
getScrollBox : function(aTabBrowser) getScrollBox : function(aTabBrowser)
{ {
return document.getAnonymousElementByAttribute(aTabBrowser.mTabContainer, 'class', 'tabs-frame') || // Tab Mix Plus return aTabBrowser.ownerDocument.getAnonymousElementByAttribute(aTabBrowser.mTabContainer, 'class', 'tabs-frame') || // Tab Mix Plus
aTabBrowser.mTabContainer.mTabstrip; aTabBrowser.mTabContainer.mTabstrip;
}, },
@ -121,15 +127,15 @@
{ {
var box = this.getScrollBox(aTabBrowser); var box = this.getScrollBox(aTabBrowser);
return box._scrollButtonUp || return box._scrollButtonUp ||
document.getAnonymousElementByAttribute(box, 'class', 'scrollbutton-up') || aTabBrowser.ownerDocument.getAnonymousElementByAttribute(box, 'class', 'scrollbutton-up') ||
document.getAnonymousElementByAttribute(box.previousSibling, 'class', 'scrollbutton-up'); // Tab Mix Plus aTabBrowser.ownerDocument.getAnonymousElementByAttribute(box.previousSibling, 'class', 'scrollbutton-up'); // Tab Mix Plus
}, },
getDownButton : function(aTabBrowser) getDownButton : function(aTabBrowser)
{ {
var box = this.getScrollBox(aTabBrowser); var box = this.getScrollBox(aTabBrowser);
return box._scrollButtonDown || return box._scrollButtonDown ||
document.getAnonymousElementByAttribute(box, 'class', 'scrollbutton-down') || aTabBrowser.ownerDocument.getAnonymousElementByAttribute(box, 'class', 'scrollbutton-down') ||
document.getAnonymousElementByAttribute(box.nextSibling, 'class', 'scrollbutton-up'); // Tab Mix Plus aTabBrowser.ownerDocument.getAnonymousElementByAttribute(box.nextSibling, 'class', 'scrollbutton-up'); // Tab Mix Plus
}, },
autoScrollArea : 20, autoScrollArea : 20,

View File

@ -1,3 +1,7 @@
var EXPORTED_SYMBOLS = ['window'];
Components.utils.import('resource://treestyletab-modules/namespace.jsm');
var window = getNamespaceFor('piro.sakura.ne.jp');
/* /*
Extensions Compatibility Library Extensions Compatibility Library
@ -16,7 +20,7 @@
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/extensions.js http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/extensions.js
*/ */
(function() { (function() {
const currentRevision = 5; const currentRevision = 6;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -32,7 +36,7 @@
// Firefox 3.7 or later // Firefox 3.7 or later
var AM = {}; var AM = {};
if ('@mozilla.org/addons/integration;1' in Components.classes) if ('@mozilla.org/addons/integration;1' in Cc)
Components.utils.import('resource://gre/modules/AddonManager.jsm', AM); Components.utils.import('resource://gre/modules/AddonManager.jsm', AM);
window['piro.sakura.ne.jp'].extensions = { window['piro.sakura.ne.jp'].extensions = {
@ -45,7 +49,7 @@
AM.AddonManager.getAddonByID(aId, function(aAddon) { AM.AddonManager.getAddonByID(aId, function(aAddon) {
addon = aAddon; addon = aAddon;
}); });
var thread = Components.classes['@mozilla.org/thread-manager;1'] var thread = Cc['@mozilla.org/thread-manager;1']
.getService() .getService()
.mainThread; .mainThread;
while (addon === void(0)) { while (addon === void(0)) {
@ -131,7 +135,7 @@
return false; return false;
}, },
goToOptions : function(aId) goToOptions : function(aId, aOwnerWindow)
{ {
var uri = this.ExtensionManager ? this.getOptionsURI_EM(aId) : this.getOptionsURI_AM(aId) ; var uri = this.ExtensionManager ? this.getOptionsURI_EM(aId) : this.getOptionsURI_AM(aId) ;
if (!uri) return; if (!uri) return;
@ -151,7 +155,7 @@
} }
catch(e) { catch(e) {
} }
window.openDialog( (aOwnerWindow || window).openDialog(
uri, uri,
'', '',
'chrome,titlebar,toolbar,centerscreen,' + (instantApply ? 'dialog=no' : 'modal' ) 'chrome,titlebar,toolbar,centerscreen,' + (instantApply ? 'dialog=no' : 'modal' )

129
modules/jstimer.jsm Normal file
View File

@ -0,0 +1,129 @@
/*
JavaScript Timer Library
Usage:
var namespace = {};
Components.utils.import('resource://foo-modules/jstimer.jsm', namespace);
var callback = function(aMessage) { alert(aMessage); };
var timeout = namespace.setTimeout(callback, 1000, 'OK');
namespace.clearTimeout(timeout);
var interval = namespace.setInterval(callback, 1000, 'OK');
namespace.clearInterval(interval);
lisence: The MIT License, Copyright (c) 2010 SHIMODA "Piro" Hiroshi
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/license.txt
original:
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/jstimer.jsm
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/jstimer.test.js
*/
var Cc = Components.classes;
var Ci = Components.interfaces;
var EXPORTED_SYMBOLS = [
'setTimeout',
'clearTimeout',
'setInterval',
'clearInterval'
];
function setTimeout()
{
var args = Array.slice(arguments);
var callback = args.shift();
var timeout = args.shift();
return (new Timer(
(typeof callback == 'string' ?
callback :
function() { callback.apply(getGlobal(), args); }
),
timeout,
Ci.nsITimer.TYPE_ONE_SHOT
)).id;
}
function clearTimeout(aId)
{
Timer.cancel(aId);
}
function setInterval()
{
var args = Array.slice(arguments);
var callback = args.shift();
var interval = args.shift();
return (new Timer(
(typeof callback == 'string' ?
callback :
function() { callback.apply(getGlobal(), args); }
),
interval,
Ci.nsITimer.TYPE_REPEATING_SLACK
)).id;
}
function clearInterval(aId)
{
Timer.cancel(aId);
}
function Timer(aCallback, aTime, aType) {
this.finished = false;
this.callback = aCallback;
this.type = aType;
this.init(aTime);
Timer.instances[this.id] = this;
}
Timer.prototype = {
init : function(aTime, aType)
{
this.id = parseInt(Math.random() * 65000)
this.timer = Cc['@mozilla.org/timer;1']
.createInstance(Ci.nsITimer);
this.timer.init(this, aTime, this.type);
},
cancel : function()
{
if (!this.timer) return;
delete this.timer;
delete this.callback;
this.finished = true;
delete Timer.instances[this.id];
},
observe : function(aSubject, aTopic, aData)
{
if (aTopic != 'timer-callback') return;
if (typeof this.callback == 'function')
this.callback();
else
evalInSandbox(this.callback);
if (this.type == Ci.nsITimer.TYPE_ONE_SHOT)
this.cancel();
}
};
Timer.instances = {};
Timer.cancel = function(aId) {
var timer = this.getInstanceById(aId);
if (timer)
timer.cancel();
};
Timer.getInstanceById = function(aId) {
return this.instances[aId] || null ;
};
function evalInSandbox(aCode, aSandboxOwner)
{
var sandbox = new Components.utils.Sandbox(aSandboxOwner || 'about:blank');
return Components.utils.evalInSandbox(aCode, sandbox);
}
function getGlobal()
{
return (function() { return this; })();
}

View File

@ -41,14 +41,13 @@ var Ci = Components.interfaces;
Components.utils.import('resource://treestyletab-modules/prefs.js'); Components.utils.import('resource://treestyletab-modules/prefs.js');
Components.utils.import('resource://treestyletab-modules/boxObject.js'); Components.utils.import('resource://treestyletab-modules/boxObject.js');
Components.utils.import('resource://treestyletab-modules/stringBundle.js'); Components.utils.import('resource://treestyletab-modules/stringBundle.js');
Components.utils.import('resource://treestyletab-modules/extensions.js');
Components.utils.import('resource://treestyletab-modules/animationManager.js');
Components.utils.import('resource://treestyletab-modules/autoScroll.js');
Components.utils.import('resource://treestyletab-modules/namespace.jsm'); Components.utils.import('resource://treestyletab-modules/namespace.jsm');
var window = getNamespaceFor('piro.sakura.ne.jp'); var window = getNamespaceFor('piro.sakura.ne.jp');
var prefs = window['piro.sakura.ne.jp'].prefs;
var boxObject = window['piro.sakura.ne.jp'].boxObject;
var stringBundle = window['piro.sakura.ne.jp'].stringBundle;
var TreeStyleTabUtils = { var TreeStyleTabUtils = {
tabsHash : null, tabsHash : null,
inWindowDestoructionProcess : false, inWindowDestoructionProcess : false,
@ -231,14 +230,18 @@ var TreeStyleTabUtils = {
_Comparator : null, _Comparator : null,
get treeBundle() { get treeBundle() {
return stringBundle return window['piro.sakura.ne.jp'].stringBundle
.get('chrome://treestyletab/locale/treestyletab.properties'); .get('chrome://treestyletab/locale/treestyletab.properties');
}, },
get tabbrowserBundle() { get tabbrowserBundle() {
return stringBundle return window['piro.sakura.ne.jp'].stringBundle
.get('chrome://browser/locale/tabbrowser.properties'); .get('chrome://browser/locale/tabbrowser.properties');
}, },
get extensions() { return window['piro.sakura.ne.jp'].extensions; },
get animationManager() { return window['piro.sakura.ne.jp'].animationManager; },
get autoScroll() { return window['piro.sakura.ne.jp'].autoScroll; },
init : function TSTUtils_init() init : function TSTUtils_init()
{ {
if (this._initialized) return; if (this._initialized) return;
@ -301,7 +304,7 @@ var TreeStyleTabUtils = {
getBoxObjectFor : function TSTUtils_getBoxObjectFor(aNode) getBoxObjectFor : function TSTUtils_getBoxObjectFor(aNode)
{ {
return boxObject.getBoxObjectFor(aNode); return window['piro.sakura.ne.jp'].boxObject.getBoxObjectFor(aNode);
}, },
evalInSandbox : function TSTUtils_evalInSandbox(aCode, aOwner) evalInSandbox : function TSTUtils_evalInSandbox(aCode, aOwner)
@ -1870,5 +1873,5 @@ var TreeStyleTabUtils = {
}; };
TreeStyleTabUtils.__proto__ = prefs; TreeStyleTabUtils.__proto__ = window['piro.sakura.ne.jp'].prefs;