Shorten "TSTUtils" to "utils" (because they are already in the context)
This commit is contained in:
parent
22f8f1f6d2
commit
c0e9280444
@ -40,7 +40,7 @@ const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -91,12 +91,12 @@ AutoHideBrowser.prototype = {
|
||||
getModeForNormal : function AHB_getModeForNormal(aTabBrowser)
|
||||
{
|
||||
var b = aTabBrowser || this.browser;
|
||||
return parseInt(b.getAttribute(this.kMODE+'-normal') || TSTUtils.getTreePref('tabbar.autoHide.mode'));
|
||||
return parseInt(b.getAttribute(this.kMODE+'-normal') || utils.getTreePref('tabbar.autoHide.mode'));
|
||||
},
|
||||
getModeForFullScreen : function AHB_getModeForFullScreen(aTabBrowser)
|
||||
{
|
||||
var b = aTabBrowser || this.browser;
|
||||
return parseInt(b.getAttribute(this.kMODE+'-fullscreen') || TSTUtils.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
||||
return parseInt(b.getAttribute(this.kMODE+'-fullscreen') || utils.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
||||
},
|
||||
|
||||
get state()
|
||||
@ -165,8 +165,8 @@ AutoHideBrowser.prototype = {
|
||||
|
||||
default:
|
||||
case this.kMODE_SHRINK:
|
||||
return TSTUtils.getTreePref('tabbar.width')
|
||||
- TSTUtils.getTreePref('tabbar.shrunkenWidth');
|
||||
return utils.getTreePref('tabbar.width')
|
||||
- utils.getTreePref('tabbar.shrunkenWidth');
|
||||
}
|
||||
},
|
||||
get YOffset()
|
||||
@ -290,7 +290,7 @@ AutoHideBrowser.prototype = {
|
||||
{
|
||||
this.mode = this.getModeForFullScreen();
|
||||
this.end();
|
||||
this.mode = TSTUtils.getTreePref('tabbar.autoHide.mode');
|
||||
this.mode = utils.getTreePref('tabbar.autoHide.mode');
|
||||
this.treeStyleTab.checkTabsIndentOverflow();
|
||||
if (this.mode != this.kMODE_DISABLED)
|
||||
this.start();
|
||||
@ -322,13 +322,13 @@ AutoHideBrowser.prototype = {
|
||||
|
||||
get shouldListenMouseMove()
|
||||
{
|
||||
return TSTUtils.getTreePref('tabbar.autoShow.mousemove');
|
||||
return utils.getTreePref('tabbar.autoShow.mousemove');
|
||||
},
|
||||
|
||||
get shouldListenKeyEventsForAutoHide()
|
||||
{
|
||||
return TSTUtils.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
||||
TSTUtils.getTreePref('tabbar.autoShow.tabSwitch');
|
||||
return utils.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
||||
utils.getTreePref('tabbar.autoShow.tabSwitch');
|
||||
},
|
||||
|
||||
showHideOnMouseMove : function AHB_showHideOnMouseMove(aEvent)
|
||||
@ -349,7 +349,7 @@ AutoHideBrowser.prototype = {
|
||||
if (
|
||||
shouldShow &&
|
||||
this.showHideReason & this.kKEEP_SHOWN_ON_MOUSEOVER &&
|
||||
TSTUtils.getTreePref('tabbar.autoShow.keepShownOnMouseover')
|
||||
utils.getTreePref('tabbar.autoShow.keepShownOnMouseover')
|
||||
) {
|
||||
this.showHideReason = this.kSHOWN_BY_MOUSEMOVE;
|
||||
this.cancelDelayedShowForShortcut();
|
||||
@ -357,7 +357,7 @@ AutoHideBrowser.prototype = {
|
||||
}
|
||||
else if (
|
||||
!shouldShow &&
|
||||
TSTUtils.getTreePref('tabbar.autoShow.mousemove')
|
||||
utils.getTreePref('tabbar.autoShow.mousemove')
|
||||
) {
|
||||
this.showHideOnMouseMoveTimer = w.setTimeout(
|
||||
function(aSelf) {
|
||||
@ -365,7 +365,7 @@ AutoHideBrowser.prototype = {
|
||||
if (aSelf.showHideReason == aSelf.kSHOWN_BY_MOUSEMOVE)
|
||||
aSelf.hide(aSelf.kSHOWN_BY_MOUSEMOVE);
|
||||
},
|
||||
TSTUtils.getTreePref('tabbar.autoHide.delay'),
|
||||
utils.getTreePref('tabbar.autoHide.delay'),
|
||||
this
|
||||
);
|
||||
}
|
||||
@ -377,7 +377,7 @@ AutoHideBrowser.prototype = {
|
||||
aSelf.cancelHideForFeedback();
|
||||
aSelf.show(aSelf.kSHOWN_BY_MOUSEMOVE);
|
||||
},
|
||||
TSTUtils.getTreePref('tabbar.autoHide.delay'),
|
||||
utils.getTreePref('tabbar.autoHide.delay'),
|
||||
this
|
||||
);
|
||||
}
|
||||
@ -525,7 +525,7 @@ AutoHideBrowser.prototype = {
|
||||
showForFeedback : function AHB_showForFeedback()
|
||||
{
|
||||
if (!this.enabled ||
|
||||
!TSTUtils.getTreePref('tabbar.autoShow.feedback'))
|
||||
!utils.getTreePref('tabbar.autoShow.feedback'))
|
||||
return;
|
||||
|
||||
var w = this.window;
|
||||
@ -554,7 +554,7 @@ AutoHideBrowser.prototype = {
|
||||
if (aSelf.showHideReason == aSelf.kSHOWN_BY_FEEDBACK)
|
||||
aSelf.hide();
|
||||
},
|
||||
TSTUtils.getTreePref('tabbar.autoShow.feedback.delay'),
|
||||
utils.getTreePref('tabbar.autoShow.feedback.delay'),
|
||||
this
|
||||
);
|
||||
},
|
||||
@ -572,9 +572,9 @@ AutoHideBrowser.prototype = {
|
||||
if (aForceExpanded ||
|
||||
this.expanded ||
|
||||
this.mode != this.kMODE_SHRINK)
|
||||
TSTUtils.setTreePref('tabbar.width', this.treeStyleTab.maxTabbarWidth(aWidth));
|
||||
utils.setTreePref('tabbar.width', this.treeStyleTab.maxTabbarWidth(aWidth));
|
||||
else
|
||||
TSTUtils.setTreePref('tabbar.shrunkenWidth', this.treeStyleTab.maxTabbarWidth(aWidth));
|
||||
utils.setTreePref('tabbar.shrunkenWidth', this.treeStyleTab.maxTabbarWidth(aWidth));
|
||||
},
|
||||
|
||||
updateMenuItem : function AHB_updateMenuItem(aNode)
|
||||
@ -606,14 +606,14 @@ AutoHideBrowser.prototype = {
|
||||
get widthFromMode()
|
||||
{
|
||||
return (this.shrunken) ?
|
||||
TSTUtils.getTreePref('tabbar.shrunkenWidth') :
|
||||
TSTUtils.getTreePref('tabbar.width') ;
|
||||
utils.getTreePref('tabbar.shrunkenWidth') :
|
||||
utils.getTreePref('tabbar.width') ;
|
||||
},
|
||||
get placeHolderWidthFromMode()
|
||||
{
|
||||
return (this.mode == this.kMODE_SHRINK) ?
|
||||
TSTUtils.getTreePref('tabbar.shrunkenWidth') :
|
||||
TSTUtils.getTreePref('tabbar.width') ;
|
||||
utils.getTreePref('tabbar.shrunkenWidth') :
|
||||
utils.getTreePref('tabbar.width') ;
|
||||
},
|
||||
|
||||
get height()
|
||||
@ -737,7 +737,7 @@ AutoHideBrowser.prototype = {
|
||||
default:
|
||||
case this.kMODE_SHRINK:
|
||||
if (pos == 'left' || pos == 'right') {
|
||||
let width = sv.maxTabbarWidth(TSTUtils.getTreePref('tabbar.width'));
|
||||
let width = sv.maxTabbarWidth(utils.getTreePref('tabbar.width'));
|
||||
sv.updateFloatingTabbar(sv.kTABBAR_UPDATE_BY_AUTOHIDE);
|
||||
}
|
||||
break;
|
||||
@ -775,7 +775,7 @@ AutoHideBrowser.prototype = {
|
||||
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show');
|
||||
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN);
|
||||
if (pos == 'left' || pos == 'right')
|
||||
sv.setTabStripAttribute('width', TSTUtils.getTreePref('tabbar.shrunkenWidth'));
|
||||
sv.setTabStripAttribute('width', utils.getTreePref('tabbar.shrunkenWidth'));
|
||||
sv.updateFloatingTabbar(sv.kTABBAR_UPDATE_BY_AUTOHIDE);
|
||||
break;
|
||||
}
|
||||
@ -956,7 +956,7 @@ AutoHideBrowser.prototype = {
|
||||
case this.treeStyleTab.kEVENT_TYPE_TAB_FOCUS_SWITCHING_START:
|
||||
this.cancelDelayedShowForShortcut();
|
||||
if (this.enabled &&
|
||||
TSTUtils.getTreePref('tabbar.autoShow.tabSwitch') &&
|
||||
utils.getTreePref('tabbar.autoShow.tabSwitch') &&
|
||||
(
|
||||
aEvent.getData('scrollDown') ||
|
||||
aEvent.getData('scrollUp') ||
|
||||
@ -1108,7 +1108,7 @@ AutoHideBrowser.prototype = {
|
||||
w.TreeStyleTabService.accelKeyPressed
|
||||
) {
|
||||
if (this.enabled &&
|
||||
TSTUtils.getTreePref('tabbar.autoShow.accelKeyDown') &&
|
||||
utils.getTreePref('tabbar.autoShow.accelKeyDown') &&
|
||||
!this.expanded &&
|
||||
!this.delayedAutoShowTimer &&
|
||||
!this.delayedShowForShortcutTimer) {
|
||||
@ -1119,7 +1119,7 @@ AutoHideBrowser.prototype = {
|
||||
sv = null;
|
||||
b = null;
|
||||
},
|
||||
TSTUtils.getTreePref('tabbar.autoShow.accelKeyDown.delay'),
|
||||
utils.getTreePref('tabbar.autoShow.accelKeyDown.delay'),
|
||||
this
|
||||
);
|
||||
this.delayedShowForShortcutDone = false;
|
||||
@ -1162,8 +1162,8 @@ AutoHideBrowser.prototype = {
|
||||
this.showHideOnMouseMoveTimer = null;
|
||||
this.delayedShowForFeedbackTimer = null;
|
||||
|
||||
b.setAttribute(this.kMODE+'-normal', TSTUtils.getTreePref('tabbar.autoHide.mode'));
|
||||
b.setAttribute(this.kMODE+'-fullscreen', TSTUtils.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
||||
b.setAttribute(this.kMODE+'-normal', utils.getTreePref('tabbar.autoHide.mode'));
|
||||
b.setAttribute(this.kMODE+'-fullscreen', utils.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
||||
sv.addPrefListener(this);
|
||||
this.onPrefChange('browser.tabs.closeButtons');
|
||||
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.area');
|
||||
@ -1216,8 +1216,8 @@ AutoHideBrowser.prototype = {
|
||||
};
|
||||
for (var i in prefs)
|
||||
{
|
||||
if (TSTUtils.getTreePref(i) != prefs[i])
|
||||
TSTUtils.setTreePref(i, prefs[i]);
|
||||
if (utils.getTreePref(i) != prefs[i])
|
||||
utils.setTreePref(i, prefs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1272,10 +1272,10 @@ AutoHideWindow.prototype = {
|
||||
}
|
||||
|
||||
var mode = this.getMode(b) == AutoHideBrowser.prototype.kMODE_DISABLED ?
|
||||
TSTUtils.getTreePref(toggleKey) :
|
||||
utils.getTreePref(toggleKey) :
|
||||
AutoHideBrowser.prototype.kMODE_DISABLED ;
|
||||
|
||||
TSTUtils.setTreePref(key, mode);
|
||||
utils.setTreePref(key, mode);
|
||||
b.setAttribute(AutoHideBrowser.prototype.kMODE+'-'+(w.fullScreen ? 'fullscreen' : 'normal' ), mode);
|
||||
b.treeStyleTab.autoHide.updateMode();
|
||||
},
|
||||
@ -1319,9 +1319,9 @@ AutoHideWindow.prototype = {
|
||||
{
|
||||
return !this.treeStyleTab.ctrlTabPreviewsEnabled &&
|
||||
(
|
||||
TSTUtils.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
||||
TSTUtils.getTreePref('tabbar.autoShow.tabSwitch') ||
|
||||
TSTUtils.getTreePref('tabbar.autoShow.feedback')
|
||||
utils.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
||||
utils.getTreePref('tabbar.autoShow.tabSwitch') ||
|
||||
utils.getTreePref('tabbar.autoShow.feedback')
|
||||
);
|
||||
},
|
||||
|
||||
|
366
modules/base.js
366
modules/base.js
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@ Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -129,7 +129,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
get scrollBox()
|
||||
{
|
||||
return ( // Tab Mix Plus
|
||||
TSTUtils.getTreePref('compatibility.TMP') &&
|
||||
utils.getTreePref('compatibility.TMP') &&
|
||||
this.document.getAnonymousElementByAttribute(this.mTabBrowser.mTabContainer, 'class', 'tabs-frame')
|
||||
) ||
|
||||
this.mTabBrowser.mTabContainer.mTabstrip;
|
||||
@ -205,7 +205,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
{
|
||||
var orient = this.isVertical ? 'vertical' : 'horizontal' ;
|
||||
if (!this.windowService.preInitialized)
|
||||
return TSTUtils.getTreePref('tabbar.fixed.'+orient);
|
||||
return utils.getTreePref('tabbar.fixed.'+orient);
|
||||
|
||||
var b = this.mTabBrowser;
|
||||
if (!b) return false;
|
||||
@ -314,7 +314,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
return (
|
||||
!this.isVertical &&
|
||||
this.canCollapseSubtree() &&
|
||||
TSTUtils.getTreePref('stackCollapsedTabs')
|
||||
utils.getTreePref('stackCollapsedTabs')
|
||||
);
|
||||
},
|
||||
|
||||
@ -337,7 +337,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var d = this.document;
|
||||
var label = d.getAnonymousElementByAttribute(aTab, 'class', 'tab-text-stack') || // Mac OS X
|
||||
( // Tab Mix Plus
|
||||
TSTUtils.getTreePref('compatibility.TMP') &&
|
||||
utils.getTreePref('compatibility.TMP') &&
|
||||
d.getAnonymousElementByAttribute(aTab, 'class', 'tab-text-container')
|
||||
) ||
|
||||
d.getAnonymousElementByAttribute(aTab, 'class', 'tab-text tab-label');
|
||||
@ -348,7 +348,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
{
|
||||
var d = this.document;
|
||||
var close = ( // Tab Mix Plus
|
||||
TSTUtils.getTreePref('compatibility.TMP') &&
|
||||
utils.getTreePref('compatibility.TMP') &&
|
||||
d.getAnonymousElementByAttribute(aTab, 'class', 'tab-close-button always-right')
|
||||
) ||
|
||||
d.getAnonymousElementByAttribute(aTab, 'class', 'tab-close-button');
|
||||
@ -417,9 +417,9 @@ TreeStyleTabBrowser.prototype = {
|
||||
isMultiRow : function TSTBrowser_isMultiRow()
|
||||
{
|
||||
var w = this.window;
|
||||
return ('tabberwocky' in w && TSTUtils.getTreePref('compatibility.Tabberwocky')) ?
|
||||
return ('tabberwocky' in w && utils.getTreePref('compatibility.Tabberwocky')) ?
|
||||
(this.getPref('tabberwocky.multirow') && !this.isVertical) :
|
||||
('TabmixTabbar' in w && TSTUtils.getTreePref('compatibility.TMP')) ?
|
||||
('TabmixTabbar' in w && utils.getTreePref('compatibility.TMP')) ?
|
||||
w.TabmixTabbar.isMultiRow :
|
||||
false ;
|
||||
},
|
||||
@ -447,7 +447,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
var maxWidth = tabbarPlaceHolderWidth || tabbarWidth;
|
||||
|
||||
var faviconized = TSTUtils.getTreePref('pinnedTab.faviconized');
|
||||
var faviconized = utils.getTreePref('pinnedTab.faviconized');
|
||||
var faviconizedSize = tabbar.childNodes[0].boxObject.height;
|
||||
|
||||
var width = faviconized ? faviconizedSize : maxWidth ;
|
||||
@ -587,21 +587,21 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (this.isVertical) {
|
||||
let key = this.autoHide.expanded ?
|
||||
'tabbar.width' : 'tabbar.shrunkenWidth' ;
|
||||
let width = TSTUtils.getTreePref(key);
|
||||
let width = utils.getTreePref(key);
|
||||
let minWidth = this.scrollBox.boxObject.width
|
||||
if (minWidth > width) {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
TSTUtils.setTreePref(key, minWidth);
|
||||
utils.setTreePref(key, minWidth);
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
let height = TSTUtils.getTreePref('tabbar.height');
|
||||
let height = utils.getTreePref('tabbar.height');
|
||||
let minHeight = this.scrollBox.boxObject.height
|
||||
if (minHeight > height) {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
TSTUtils.setTreePref('tabbar.height', minHeight);
|
||||
utils.setTreePref('tabbar.height', minHeight);
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
|
||||
});
|
||||
}
|
||||
@ -636,8 +636,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
var position = this.position;
|
||||
this.fireTabbarPositionEvent(this.kEVENT_TYPE_TABBAR_POSITION_CHANGING, 'top', position); /* PUBLIC API */
|
||||
|
||||
this.setTabbrowserAttribute(this.kFIXED+'-horizontal', TSTUtils.getTreePref('tabbar.fixed.horizontal') ? 'true' : null, b);
|
||||
this.setTabbrowserAttribute(this.kFIXED+'-vertical', TSTUtils.getTreePref('tabbar.fixed.vertical') ? 'true' : null, b);
|
||||
this.setTabbrowserAttribute(this.kFIXED+'-horizontal', utils.getTreePref('tabbar.fixed.horizontal') ? 'true' : null, b);
|
||||
this.setTabbrowserAttribute(this.kFIXED+'-vertical', utils.getTreePref('tabbar.fixed.vertical') ? 'true' : null, b);
|
||||
|
||||
/**
|
||||
* <tabbrowser> has its custom background color for itself, but it
|
||||
@ -962,14 +962,14 @@ TreeStyleTabBrowser.prototype = {
|
||||
aTab.removeAttribute('flex');
|
||||
aTab.maxWidth = 65000;
|
||||
aTab.minWidth = 0;
|
||||
if (TSTUtils.getTreePref('compatibility.TMP'))
|
||||
if (utils.getTreePref('compatibility.TMP'))
|
||||
aTab.setAttribute('dir', 'ltr'); // Tab Mix Plus
|
||||
}
|
||||
else {
|
||||
aTab.removeAttribute('align');
|
||||
aTab.removeAttribute('maxwidth');
|
||||
aTab.removeAttribute('minwidth');
|
||||
if (TSTUtils.getTreePref('compatibility.TMP'))
|
||||
if (utils.getTreePref('compatibility.TMP'))
|
||||
aTab.removeAttribute('dir'); // Tab Mix Plus
|
||||
}
|
||||
},
|
||||
@ -1192,7 +1192,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
var pos = aNewPosition || this.getPositionFlag(this.position);
|
||||
if (b.getAttribute('id') != 'content' &&
|
||||
!TSTUtils.getTreePref('tabbar.position.subbrowser.enabled')) {
|
||||
!utils.getTreePref('tabbar.position.subbrowser.enabled')) {
|
||||
pos = this.kTABBAR_TOP;
|
||||
}
|
||||
|
||||
@ -1219,7 +1219,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
// Tab Mix Plus
|
||||
var scrollFrame, newTabBox, tabBarMode;
|
||||
if (TSTUtils.getTreePref('compatibility.TMP')) {
|
||||
if (utils.getTreePref('compatibility.TMP')) {
|
||||
scrollFrame = d.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-frame') ||
|
||||
d.getAnonymousElementByAttribute(b.mTabContainer, 'anonid', 'scroll-tabs-frame');
|
||||
newTabBox = d.getAnonymousElementByAttribute(b.mTabContainer, 'id', 'tabs-newbutton-box');
|
||||
@ -1266,7 +1266,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (scrollInnerBox)
|
||||
scrollInnerBox.removeAttribute('flex');
|
||||
|
||||
if (TSTUtils.getTreePref('compatibility.TMP') && scrollFrame) { // Tab Mix Plus
|
||||
if (utils.getTreePref('compatibility.TMP') && scrollFrame) { // Tab Mix Plus
|
||||
d.getAnonymousNodes(scrollFrame)[0].removeAttribute('flex');
|
||||
scrollFrame.parentNode.orient =
|
||||
scrollFrame.orient = 'vertical';
|
||||
@ -1281,7 +1281,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
this.setTabbrowserAttribute(this.kMODE, 'vertical');
|
||||
|
||||
let width = this.maxTabbarWidth(TSTUtils.getTreePref('tabbar.width'), b);
|
||||
let width = this.maxTabbarWidth(utils.getTreePref('tabbar.width'), b);
|
||||
this.setTabStripAttribute('width', width);
|
||||
this.removeTabStripAttribute('height');
|
||||
b.mPanelContainer.removeAttribute('height');
|
||||
@ -1301,7 +1301,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
if (pos == this.kTABBAR_RIGHT) {
|
||||
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'right');
|
||||
if (TSTUtils.getTreePref('tabbar.invertTab')) {
|
||||
if (utils.getTreePref('tabbar.invertTab')) {
|
||||
this.setTabbrowserAttribute(this.kTAB_INVERTED, 'true');
|
||||
this.indentTarget = 'right';
|
||||
}
|
||||
@ -1356,7 +1356,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (scrollInnerBox)
|
||||
scrollInnerBox.setAttribute('flex', 1);
|
||||
|
||||
if (TSTUtils.getTreePref('compatibility.TMP') && scrollFrame) { // Tab Mix Plus
|
||||
if (utils.getTreePref('compatibility.TMP') && scrollFrame) { // Tab Mix Plus
|
||||
d.getAnonymousNodes(scrollFrame)[0].setAttribute('flex', 1);
|
||||
scrollFrame.parentNode.orient =
|
||||
scrollFrame.orient = 'horizontal';
|
||||
@ -1367,7 +1367,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (toolboxContainer)
|
||||
toolboxContainer.orient = 'horizontal';
|
||||
|
||||
this.setTabbrowserAttribute(this.kMODE, TSTUtils.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal');
|
||||
this.setTabbrowserAttribute(this.kMODE, utils.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal');
|
||||
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
|
||||
|
||||
if (strip.localName == 'toolbar') {
|
||||
@ -1415,7 +1415,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
tab.style.removeProperty(this.collapseCSSProp);
|
||||
}
|
||||
|
||||
this.indentProp = TSTUtils.getTreePref('indent.property');
|
||||
this.indentProp = utils.getTreePref('indent.property');
|
||||
this.indentCSSProp = this.indentProp+'-'+this.indentTarget;
|
||||
this.collapseCSSProp = 'margin-'+this.collapseTarget;
|
||||
|
||||
@ -1588,12 +1588,12 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (TabsOnTop && !this.windowService.isPopupWindow &&
|
||||
this.windowService.initialized) {
|
||||
let currentState = TabsOnTop.enabled;
|
||||
let originalState = TSTUtils.getTreePref('tabsOnTop.originalState');
|
||||
let originalState = utils.getTreePref('tabsOnTop.originalState');
|
||||
if (originalState !== null &&
|
||||
currentState != originalState &&
|
||||
this.windowService.tabsOnTopChangingByUI &&
|
||||
!this.windowService.changingTabsOnTop)
|
||||
TSTUtils.setTreePref('tabsOnTop.originalState', currentState);
|
||||
utils.setTreePref('tabsOnTop.originalState', currentState);
|
||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=555987
|
||||
// This should be done when the value of the "ordinal" attribute
|
||||
// is modified dynamically. So, we don' have to do it before
|
||||
@ -1611,7 +1611,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
else {
|
||||
this.fixed = false; // ensure set to the current orient
|
||||
this.setTabStripAttribute('height', this.maxTabbarHeight(TSTUtils.getTreePref('tabbar.height'), b));
|
||||
this.setTabStripAttribute('height', this.maxTabbarHeight(utils.getTreePref('tabbar.height'), b));
|
||||
}
|
||||
if (toggleTabsOnTop) {
|
||||
if (this.position == 'top')
|
||||
@ -1644,12 +1644,12 @@ TreeStyleTabBrowser.prototype = {
|
||||
delete self.deferredTasks['updateTabbarState'];
|
||||
});
|
||||
|
||||
var allowToCollapse = TSTUtils.getTreePref('allowSubtreeCollapseExpand.'+orient);
|
||||
var allowToCollapse = utils.getTreePref('allowSubtreeCollapseExpand.'+orient);
|
||||
if (this.allowSubtreeCollapseExpand != allowToCollapse)
|
||||
this.collapseExpandAllSubtree(false, false);
|
||||
this.allowSubtreeCollapseExpand = allowToCollapse;
|
||||
|
||||
this.maxTreeLevel = TSTUtils.getTreePref('maxTreeLevel.'+orient);
|
||||
this.maxTreeLevel = utils.getTreePref('maxTreeLevel.'+orient);
|
||||
|
||||
this.setTabbrowserAttribute(this.kALLOW_STACK, this.canStackTabs ? 'true' : null);
|
||||
this.updateTabsZIndex(this.canStackTabs);
|
||||
@ -1671,10 +1671,10 @@ TreeStyleTabBrowser.prototype = {
|
||||
canCollapse : b.getAttribute(this.kALLOW_COLLAPSE) == 'true'
|
||||
};
|
||||
var newState = {
|
||||
fixed : TSTUtils.getTreePref('tabbar.fixed.'+orient),
|
||||
maxTreeLevel : TSTUtils.getTreePref('maxTreeLevel.'+orient),
|
||||
indented : TSTUtils.getTreePref('maxTreeLevel.'+orient) != 0,
|
||||
canCollapse : TSTUtils.getTreePref('allowSubtreeCollapseExpand.'+orient)
|
||||
fixed : utils.getTreePref('tabbar.fixed.'+orient),
|
||||
maxTreeLevel : utils.getTreePref('maxTreeLevel.'+orient),
|
||||
indented : utils.getTreePref('maxTreeLevel.'+orient) != 0,
|
||||
canCollapse : utils.getTreePref('allowSubtreeCollapseExpand.'+orient)
|
||||
};
|
||||
|
||||
if (oldState.fixed == newState.fixed &&
|
||||
@ -1781,11 +1781,11 @@ TreeStyleTabBrowser.prototype = {
|
||||
let realWidth = parseInt(this._tabStripPlaceHolder.getAttribute('width') || box.width);
|
||||
let realHeight = parseInt(this._tabStripPlaceHolder.getAttribute('height') || box.height);
|
||||
let width = (this.autoHide.expanded && this.isVertical && (aReason & this.kTABBAR_UPDATE_SYNC_TO_TABBAR) ?
|
||||
this.maxTabbarWidth(TSTUtils.getTreePref('tabbar.width')) :
|
||||
this.maxTabbarWidth(utils.getTreePref('tabbar.width')) :
|
||||
0
|
||||
) || realWidth;
|
||||
let height = (this.autoHide.expanded && !this.isVertical && (aReason & this.kTABBAR_UPDATE_SYNC_TO_TABBAR) ?
|
||||
this.maxTabbarHeight(TSTUtils.getTreePref('tabbar.height')) :
|
||||
this.maxTabbarHeight(utils.getTreePref('tabbar.height')) :
|
||||
0
|
||||
) || realHeight;
|
||||
let yOffset = pos == 'bottom' ? height - realHeight : 0 ;
|
||||
@ -1808,7 +1808,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
strip.collapsed = tabContainerBox.collapsed = collapsed;
|
||||
|
||||
if (statusPanel && TSTUtils.getTreePref('repositionStatusPanel')) {
|
||||
if (statusPanel && utils.getTreePref('repositionStatusPanel')) {
|
||||
let offsetParentBox = this.utils.findOffsetParent(statusPanel).boxObject;
|
||||
let contentBox = this.mTabBrowser.mPanelContainer.boxObject;
|
||||
let chromeMargins = (d.documentElement.getAttribute('chromemargin') || '0,0,0,0').split(',');
|
||||
@ -1833,7 +1833,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (
|
||||
statusPanel &&
|
||||
(
|
||||
TSTUtils.getTreePref('repositionStatusPanel') ||
|
||||
utils.getTreePref('repositionStatusPanel') ||
|
||||
statusPanel.__treestyletab__repositioned
|
||||
)
|
||||
) {
|
||||
@ -2099,8 +2099,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
};
|
||||
for (var i in prefs)
|
||||
{
|
||||
if (prefs[i] !== void(0) && TSTUtils.getTreePref(i) != prefs[i])
|
||||
TSTUtils.setTreePref(i, prefs[i]);
|
||||
if (prefs[i] !== void(0) && utils.getTreePref(i) != prefs[i])
|
||||
utils.setTreePref(i, prefs[i]);
|
||||
}
|
||||
this.position = this.position;
|
||||
},
|
||||
@ -2336,8 +2336,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
case 'extensions.treestyletab.tabbar.style':
|
||||
case 'extensions.treestyletab.tabbar.style.aero':
|
||||
this.setTabbarStyle(TSTUtils.getTreePref('tabbar.style'));
|
||||
value = TSTUtils.getTreePref('twisty.style');
|
||||
this.setTabbarStyle(utils.getTreePref('tabbar.style'));
|
||||
value = utils.getTreePref('twisty.style');
|
||||
if (value != 'auto')
|
||||
return;
|
||||
case 'extensions.treestyletab.twisty.style':
|
||||
@ -2466,7 +2466,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
aStyle = aStyle.toLowerCase();
|
||||
|
||||
if (aStyle.indexOf('default') == 0) { // old name (for compatibility)
|
||||
TSTUtils.setTreePref('tabbar.style', aStyle = aStyle.replace('default', 'plain'));
|
||||
utils.setTreePref('tabbar.style', aStyle = aStyle.replace('default', 'plain'));
|
||||
}
|
||||
|
||||
if (aStyle) {
|
||||
@ -2479,7 +2479,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
additionalValues.push('color');
|
||||
if (/^(plain|mixed)$/.test(aStyle))
|
||||
additionalValues.push('shadow');
|
||||
if (TSTUtils.getTreePref('tabbar.style.aero'))
|
||||
if (utils.getTreePref('tabbar.style.aero'))
|
||||
additionalValues.push('aero');
|
||||
if (additionalValues.length)
|
||||
aStyle = additionalValues.join(' ')+' '+aStyle;
|
||||
@ -2499,7 +2499,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
aStyle = 'modern-black';
|
||||
|
||||
if (TSTUtils.getTreePref('tabbar.style') == 'sidebar') {
|
||||
if (utils.getTreePref('tabbar.style') == 'sidebar') {
|
||||
aStyle = 'osx';
|
||||
}
|
||||
else if (
|
||||
@ -2768,7 +2768,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
else if (
|
||||
parent &&
|
||||
TSTUtils.getTreePref('insertNewChildAt') == this.kINSERT_FISRT &&
|
||||
utils.getTreePref('insertNewChildAt') == this.kINSERT_FISRT &&
|
||||
(this.multipleCount <= 0 || this._addedCountInThisLoop <= 0)
|
||||
) {
|
||||
/* 複数の子タブを一気に開く場合、最初に開いたタブだけを
|
||||
@ -3704,7 +3704,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
_restoreSubtreeCollapsedState : function TSTBrowser_restoreSubtreeCollapsedState(aTab, aCollapsed)
|
||||
{
|
||||
var shouldCollapse = TSTUtils.getTreePref('collapseExpandSubtree.sessionRestore');
|
||||
var shouldCollapse = utils.getTreePref('collapseExpandSubtree.sessionRestore');
|
||||
|
||||
if (aCollapsed === void(0))
|
||||
aCollapsed = this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true';
|
||||
@ -4087,13 +4087,13 @@ TreeStyleTabBrowser.prototype = {
|
||||
)
|
||||
return;
|
||||
|
||||
var shouldCollapseExpandNow = TSTUtils.getTreePref('autoCollapseExpandSubtreeOnSelect');
|
||||
var shouldCollapseExpandNow = utils.getTreePref('autoCollapseExpandSubtreeOnSelect');
|
||||
var newActiveTabOptions = {
|
||||
canCollapseTree : shouldCollapseExpandNow,
|
||||
canExpandTree : shouldCollapseExpandNow
|
||||
};
|
||||
if (this.isCollapsed(tab)) {
|
||||
if (TSTUtils.getTreePref('autoExpandSubtreeOnCollapsedChildFocused')) {
|
||||
if (utils.getTreePref('autoExpandSubtreeOnCollapsedChildFocused')) {
|
||||
this.getAncestorTabs(tab).forEach(function(aAncestor) {
|
||||
this.collapseExpandSubtree(aAncestor, false);
|
||||
}, this);
|
||||
@ -4118,7 +4118,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
* only when it is activated by user preference expressly.
|
||||
*/
|
||||
this._focusChangedByCurrentTabRemove &&
|
||||
!TSTUtils.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove')
|
||||
!utils.getTreePref('autoCollapseExpandSubtreeOnSelect.onCurrentTabRemove')
|
||||
)
|
||||
) {
|
||||
// do nothing!
|
||||
@ -4128,13 +4128,13 @@ TreeStyleTabBrowser.prototype = {
|
||||
this._focusChangedByShortcut &&
|
||||
this.windowService.accelKeyPressed
|
||||
) {
|
||||
if (TSTUtils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut')) {
|
||||
if (utils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut')) {
|
||||
newActiveTabOptions.canExpandTree = true;
|
||||
newActiveTabOptions.canCollapseTree = (
|
||||
newActiveTabOptions.canCollapseTree &&
|
||||
TSTUtils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers')
|
||||
utils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers')
|
||||
);
|
||||
let delay = TSTUtils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay');
|
||||
let delay = utils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay');
|
||||
if (delay > 0) {
|
||||
this._autoExpandOnTabSelectTimer = this.window.setTimeout(function(aSelf) {
|
||||
if (tab && tab.parentNode)
|
||||
@ -4203,7 +4203,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this._focusChangedByShortcut = this.windowService.accelKeyPressed;
|
||||
|
||||
if (!this.canCollapseSubtree(this.mTabBrowser.selectedTab) ||
|
||||
TSTUtils.getTreePref('focusMode') != this.kFOCUS_VISIBLE)
|
||||
utils.getTreePref('focusMode') != this.kFOCUS_VISIBLE)
|
||||
return false;
|
||||
|
||||
if (this.processArrowKeyOnFocusAdvanced())
|
||||
@ -4248,7 +4248,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
if (TSTUtils.getTreePref('tabbar.invertTab')) {
|
||||
if (utils.getTreePref('tabbar.invertTab')) {
|
||||
collapse = event.right;
|
||||
expand = event.left;
|
||||
}
|
||||
@ -4358,7 +4358,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
let tab = this.getTabFromEvent(aEvent);
|
||||
if (tab &&
|
||||
this.hasChildTabs(tab) &&
|
||||
TSTUtils.getTreePref('collapseExpandSubtree.dblclick')) {
|
||||
utils.getTreePref('collapseExpandSubtree.dblclick')) {
|
||||
this.manualCollapseExpandSubtree(tab, tab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true');
|
||||
aEvent.preventDefault();
|
||||
aEvent.stopPropagation();
|
||||
@ -4482,7 +4482,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
let item = aEvent.currentTarget.querySelector('*[id^="'+id+'"]');
|
||||
if (!item) continue;
|
||||
items[id] = item;
|
||||
if (TSTUtils.getTreePref('show.'+id))
|
||||
if (utils.getTreePref('show.'+id))
|
||||
item.removeAttribute('hidden');
|
||||
else
|
||||
item.setAttribute('hidden', true);
|
||||
@ -4688,11 +4688,11 @@ TreeStyleTabBrowser.prototype = {
|
||||
resetTabbarSize : function TSTBrowser_resetTabbarSize()
|
||||
{
|
||||
if (this.isVertical) {
|
||||
TSTUtils.setTreePref('tabbar.shrunkenWidth', TSTUtils.getTreePref('tabbar.shrunkenWidth.default'));
|
||||
TSTUtils.setTreePref('tabbar.width', TSTUtils.getTreePref('tabbar.width.default'));
|
||||
utils.setTreePref('tabbar.shrunkenWidth', utils.getTreePref('tabbar.shrunkenWidth.default'));
|
||||
utils.setTreePref('tabbar.width', utils.getTreePref('tabbar.width.default'));
|
||||
}
|
||||
else {
|
||||
TSTUtils.setTreePref('tabbar.height', TSTUtils.getTreePref('tabbar.height.default'));
|
||||
utils.setTreePref('tabbar.height', utils.getTreePref('tabbar.height.default'));
|
||||
let tabContainerBox = this.getTabContainerBox(this.mTabBrowser);
|
||||
tabContainerBox.removeAttribute('height');
|
||||
this._tabStripPlaceHolder.height = tabContainerBox.boxObject.height;
|
||||
@ -4864,7 +4864,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.collapseExpandSubtree(aParent, false, aInfo.dontAnimate);
|
||||
}
|
||||
else if (!aInfo.dontExpand) {
|
||||
if (TSTUtils.getTreePref('autoCollapseExpandSubtreeOnSelect')) {
|
||||
if (utils.getTreePref('autoCollapseExpandSubtreeOnSelect')) {
|
||||
if (this.shouldTabAutoExpanded(aParent))
|
||||
this.collapseExpandTreesIntelligentlyFor(aParent);
|
||||
newAncestors.forEach(function(aAncestor) {
|
||||
@ -4873,7 +4873,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}, this);
|
||||
}
|
||||
else if (this.shouldTabAutoExpanded(aParent)) {
|
||||
if (TSTUtils.getTreePref('autoExpandSubtreeOnAppendChild')) {
|
||||
if (utils.getTreePref('autoExpandSubtreeOnAppendChild')) {
|
||||
newAncestors.forEach(function(aAncestor) {
|
||||
if (this.shouldTabAutoExpanded(aAncestor))
|
||||
this.collapseExpandSubtree(aAncestor, false, aInfo.dontAnimate);
|
||||
@ -4997,7 +4997,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
var insertBefore = null;
|
||||
if (aInfo.behavior == this.kCLOSE_PARENT_BEHAVIOR_DETACH_ALL_CHILDREN &&
|
||||
!TSTUtils.getTreePref('closeParentBehavior.moveDetachedTabsToBottom')) {
|
||||
!utils.getTreePref('closeParentBehavior.moveDetachedTabsToBottom')) {
|
||||
insertBefore = this.getNextSiblingTab(this.getRootTab(aTab));
|
||||
}
|
||||
for (let i = 0, maxi = children.length; i < maxi; i++)
|
||||
@ -5067,8 +5067,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
getCloseParentBehaviorForTab : function TSTBrowser_getCloseParentBehaviorForTab(aTab, aDefaultBehavior)
|
||||
{
|
||||
var closeParentBehavior = TSTUtils.getTreePref('closeParentBehavior');
|
||||
var closeRootBehavior = TSTUtils.getTreePref('closeRootBehavior');
|
||||
var closeParentBehavior = utils.getTreePref('closeParentBehavior');
|
||||
var closeRootBehavior = utils.getTreePref('closeRootBehavior');
|
||||
|
||||
var parentTab = this.getParentTab(aTab);
|
||||
var behavior = aDefaultBehavior ?
|
||||
@ -5268,7 +5268,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
checkTabsIndentOverflowTimer : null,
|
||||
checkTabsIndentOverflowCallback : function TSTBrowser_checkTabsIndentOverflowCallback()
|
||||
{
|
||||
if (!TSTUtils.getTreePref('indent.autoShrink')) {
|
||||
if (!utils.getTreePref('indent.autoShrink')) {
|
||||
this.indent = -1;
|
||||
return;
|
||||
}
|
||||
@ -5305,7 +5305,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
var maxIndent = maxIndentBase * (isVertical ? 0.33 : 0.5 );
|
||||
|
||||
var indentMin = TSTUtils.getTreePref(isVertical ? 'indent.min.vertical' : 'indent.min.horizontal');
|
||||
var indentMin = utils.getTreePref(isVertical ? 'indent.min.vertical' : 'indent.min.horizontal');
|
||||
var indentUnit = Math.max(Math.floor(maxIndent / nest), indentMin);
|
||||
if (indent > maxIndent) {
|
||||
this.indent = indentUnit;
|
||||
@ -5646,8 +5646,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (aCollapse)
|
||||
this.deleteTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY);
|
||||
|
||||
if (TSTUtils.getTreePref('indent.autoShrink') &&
|
||||
TSTUtils.getTreePref('indent.autoShrink.onlyForVisible'))
|
||||
if (utils.getTreePref('indent.autoShrink') &&
|
||||
utils.getTreePref('indent.autoShrink.onlyForVisible'))
|
||||
this.checkTabsIndentOverflow();
|
||||
|
||||
this.doingCollapseExpand = false;
|
||||
@ -5658,8 +5658,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (!aCollapse)
|
||||
this.setTabValue(aTab, this.kSUBTREE_EXPANDED_MANUALLY, true);
|
||||
|
||||
if (TSTUtils.getTreePref('indent.autoShrink') &&
|
||||
TSTUtils.getTreePref('indent.autoShrink.onlyForVisible')) {
|
||||
if (utils.getTreePref('indent.autoShrink') &&
|
||||
utils.getTreePref('indent.autoShrink.onlyForVisible')) {
|
||||
this.cancelCheckTabsIndentOverflow();
|
||||
if (!aTab.__treestyletab__checkTabsIndentOverflowOnMouseLeave) {
|
||||
var self = this;
|
||||
@ -6204,7 +6204,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (this.useTMPSessionAPI && this.getPref('extensions.tabmix.sessions.manager'))
|
||||
return;
|
||||
|
||||
var level = TSTUtils.getTreePref('restoreTree.level');
|
||||
var level = utils.getTreePref('restoreTree.level');
|
||||
dump('TSTBrowser::restoreTree\n');
|
||||
dump(' level = '+level+'\n');
|
||||
dump(' tabsToRestore = '+this.window.__SS_tabsToRestore+'\n');
|
||||
|
@ -43,7 +43,7 @@ Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Components.utils.import('resource://treestyletab-modules/base.js');
|
||||
Components.utils.import('resource://treestyletab-modules/pseudoTreeBuilder.js');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -285,7 +285,7 @@ FullTooltipManager.prototype = {
|
||||
|
||||
var label;
|
||||
var collapsed = this.isSubtreeCollapsed(tab);
|
||||
var mode = TSTUtils.getTreePref('tooltip.mode');
|
||||
var mode = utils.getTreePref('tooltip.mode');
|
||||
|
||||
var base = parseInt(tab.getAttribute(this.kNEST) || 0);
|
||||
var descendant = this.getDescendantTabs(tab);
|
||||
@ -295,7 +295,7 @@ FullTooltipManager.prototype = {
|
||||
if (mode > this.kTOOLTIP_MODE_DEFAULT &&
|
||||
descendant.length) {
|
||||
let tabs = [tab].concat(descendant);
|
||||
let tabsToBeListed = tabs.slice(0, Math.max(1, TSTUtils.getTreePref('tooltip.maxCount')));
|
||||
let tabsToBeListed = tabs.slice(0, Math.max(1, utils.getTreePref('tooltip.maxCount')));
|
||||
tree = tabsToBeListed
|
||||
.map(function(aTab) {
|
||||
let label = aTab.getAttribute('label');
|
||||
@ -316,7 +316,7 @@ FullTooltipManager.prototype = {
|
||||
var shouldShowTree = mode != this.kTOOLTIP_MODE_DEFAULT && (collapsed || mode == this.kTOOLTIP_MODE_ALWAYS);
|
||||
if ('mOverCloseButton' in tab && tab.mOverCloseButton) {
|
||||
if (descendant.length &&
|
||||
(collapsed || TSTUtils.getTreePref('closeParentBehavior') == this.kCLOSE_PARENT_BEHAVIOR_CLOSE_ALL_CHILDREN)) {
|
||||
(collapsed || utils.getTreePref('closeParentBehavior') == this.kCLOSE_PARENT_BEHAVIOR_CLOSE_ALL_CHILDREN)) {
|
||||
label = tree || tab.getAttribute('label');
|
||||
label = label && shouldShowTree ?
|
||||
this.treeBundle.getFormattedString('tooltip.closeTree.labeled', [label]) :
|
||||
@ -353,7 +353,7 @@ FullTooltipManager.prototype = {
|
||||
{
|
||||
this.cancel();
|
||||
|
||||
var delay = TSTUtils.getTreePref('tooltip.fullTooltipDelay');
|
||||
var delay = utils.getTreePref('tooltip.fullTooltipDelay');
|
||||
if (delay < 0)
|
||||
return;
|
||||
|
||||
|
@ -43,7 +43,7 @@ const Ci = Components.interfaces;
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -102,7 +102,7 @@ TabbarDNDObserver.prototype = {
|
||||
);
|
||||
|
||||
if (canDrag && !aEvent.shiftKey) {
|
||||
let insensitiveArea = TSTUtils.getTreePref('tabbar.fixed.insensitiveArea');
|
||||
let insensitiveArea = utils.getTreePref('tabbar.fixed.insensitiveArea');
|
||||
let box = tabbar.boxObject;
|
||||
switch (sv.position)
|
||||
{
|
||||
@ -365,7 +365,7 @@ catch(e) {
|
||||
var visible = sv.getNextVisibleTab(tab);
|
||||
info.action = sv.kACTION_STAY | sv.kACTION_ATTACH;
|
||||
info.parent = tab;
|
||||
info.insertBefore = TSTUtils.getTreePref('insertNewChildAt') == sv.kINSERT_FISRT ?
|
||||
info.insertBefore = utils.getTreePref('insertNewChildAt') == sv.kINSERT_FISRT ?
|
||||
(sv.getFirstChildTab(tab) || visible) :
|
||||
(sv.getNextSiblingTab(tab) || sv.getNextTab(sv.getLastDescendantTab(tab) || tab));
|
||||
if (DEBUG && info.insertBefore) dump(' insertBefore = '+info.insertBefore._tPos+'\n');
|
||||
@ -733,7 +733,7 @@ catch(e) {
|
||||
|
||||
var tab = aEvent.target;
|
||||
if (tab.localName != 'tab' ||
|
||||
!TSTUtils.getTreePref('autoExpand.enabled'))
|
||||
!utils.getTreePref('autoExpand.enabled'))
|
||||
return;
|
||||
|
||||
w.clearTimeout(this.mAutoExpandTimer);
|
||||
@ -753,7 +753,7 @@ catch(e) {
|
||||
sv.shouldTabAutoExpanded(tab) &&
|
||||
tab.getAttribute(sv.kDROP_POSITION) == 'self') {
|
||||
let draggedTab = aDragged && sv.getTabById(aDragged);
|
||||
if (TSTUtils.getTreePref('autoExpand.intelligently')) {
|
||||
if (utils.getTreePref('autoExpand.intelligently')) {
|
||||
sv.collapseExpandTreesIntelligentlyFor(tab);
|
||||
if (draggedTab)
|
||||
aSelf.updateDragData(draggedTab);
|
||||
@ -767,7 +767,7 @@ catch(e) {
|
||||
}
|
||||
}
|
||||
},
|
||||
TSTUtils.getTreePref('autoExpand.delay')
|
||||
utils.getTreePref('autoExpand.delay')
|
||||
);
|
||||
}, 0, this, tab.getAttribute(sv.kID), draggedTab && draggedTab.getAttribute(sv.kID));
|
||||
|
||||
@ -985,7 +985,7 @@ catch(e) {
|
||||
{
|
||||
var sv = this.treeStyleTab;
|
||||
if (this.mAutoExpandedTabs.length) {
|
||||
if (TSTUtils.getTreePref('autoExpand.collapseFinally')) {
|
||||
if (utils.getTreePref('autoExpand.collapseFinally')) {
|
||||
for (let i = 0, maxi = this.mAutoExpandedTabs.length; i < maxi; i++)
|
||||
{
|
||||
sv.collapseExpandSubtree(sv.getTabById(this.mAutoExpandedTabs[i]), true, true);
|
||||
|
@ -40,7 +40,7 @@ const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -127,10 +127,10 @@ TabpanelDNDObserver.prototype = {
|
||||
var position = this.getDropPosition(aEvent);
|
||||
if (position != 'center' &&
|
||||
position != sv.position) {
|
||||
if (TSTUtils.getTreePref('tabbar.fixed.autoCancelOnDrop') &&
|
||||
if (utils.getTreePref('tabbar.fixed.autoCancelOnDrop') &&
|
||||
dt.getData(sv.kDRAG_TYPE_TABBAR) != sv.kTABBAR_MOVE_FORCE) {
|
||||
let orient = (position == 'left' || position == 'right') ? 'vertical' : 'horizontal' ;
|
||||
TSTUtils.setTreePref('tabbar.fixed.'+orient, false);
|
||||
utils.setTreePref('tabbar.fixed.'+orient, false);
|
||||
}
|
||||
sv.setPrefForActiveWindow(function() {
|
||||
sv.utils.position = position;
|
||||
|
@ -48,7 +48,7 @@ XPCOMUtils.defineLazyGetter(this, 'TreeStyleTabBrowser', function() {
|
||||
Components.utils.import('resource://treestyletab-modules/browser.js', ns);
|
||||
return ns.TreeStyleTabBrowser;
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, 'TSTUtils', function() {
|
||||
XPCOMUtils.defineLazyGetter(this, 'utils', function() {
|
||||
var ns = {};
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js', ns);
|
||||
return ns.TreeStyleTabUtils;
|
||||
@ -261,7 +261,7 @@ TreeStyleTabWindow.prototype = {
|
||||
{
|
||||
aTerm = aTerm.replace(/^\s+|\s+$/g, '');
|
||||
|
||||
var mode = TSTUtils.getTreePref('autoAttach.searchResult');
|
||||
var mode = utils.getTreePref('autoAttach.searchResult');
|
||||
if (mode == this.kSEARCH_RESULT_ATTACH_ALWAYS) {
|
||||
return true;
|
||||
}
|
||||
@ -291,9 +291,9 @@ TreeStyleTabWindow.prototype = {
|
||||
return this.window.fullScreen ?
|
||||
(
|
||||
this.getPref('browser.fullscreen.autohide') &&
|
||||
TSTUtils.getTreePref('tabbar.autoHide.mode.fullscreen')
|
||||
utils.getTreePref('tabbar.autoHide.mode.fullscreen')
|
||||
) :
|
||||
TSTUtils.getTreePref('tabbar.autoHide.mode');
|
||||
utils.getTreePref('tabbar.autoHide.mode');
|
||||
},
|
||||
|
||||
get autoHideWindow()
|
||||
@ -460,7 +460,7 @@ TreeStyleTabWindow.prototype = {
|
||||
aTabBrowser = aTabBrowser || this.browser;
|
||||
var allTabsButton = d.getElementById('alltabs-button') ||
|
||||
( // Tab Mix Plus
|
||||
TSTUtils.getTreePref('compatibility.TMP') &&
|
||||
utils.getTreePref('compatibility.TMP') &&
|
||||
d.getAnonymousElementByAttribute(aTabBrowser.mTabContainer, 'anonid', 'alltabs-button')
|
||||
);
|
||||
|
||||
@ -470,7 +470,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
updateAllTabsPopup : function TSTWindow_updateAllTabsPopup(aEvent)
|
||||
{
|
||||
if (!TSTUtils.getTreePref('enableSubtreeIndent.allTabsPopup')) return;
|
||||
if (!utils.getTreePref('enableSubtreeIndent.allTabsPopup')) return;
|
||||
|
||||
var items = Array.slice(aEvent.originalTarget.childNodes);
|
||||
var firstItemIndex = 0;
|
||||
@ -832,8 +832,8 @@ TreeStyleTabWindow.prototype = {
|
||||
{
|
||||
return !this.ctrlTabPreviewsEnabled &&
|
||||
(
|
||||
TSTUtils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut') ||
|
||||
TSTUtils.getTreePref('autoCollapseExpandSubtreeOnSelect')
|
||||
utils.getTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut') ||
|
||||
utils.getTreePref('autoCollapseExpandSubtreeOnSelect')
|
||||
);
|
||||
},
|
||||
|
||||
@ -906,15 +906,15 @@ TreeStyleTabWindow.prototype = {
|
||||
width = this.maxTabbarWidth(width, b);
|
||||
if (expanded || b.treeStyleTab.autoHide.expanded) {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
TSTUtils.setTreePref('tabbar.width', width);
|
||||
utils.setTreePref('tabbar.width', width);
|
||||
});
|
||||
if (b.treeStyleTab.autoHide.mode == b.treeStyleTab.autoHide.kMODE_SHRINK &&
|
||||
b.treeStyleTab.tabStripPlaceHolder)
|
||||
b.treeStyleTab.tabStripPlaceHolder.setAttribute('width', TSTUtils.getTreePref('tabbar.shrunkenWidth'));
|
||||
b.treeStyleTab.tabStripPlaceHolder.setAttribute('width', utils.getTreePref('tabbar.shrunkenWidth'));
|
||||
}
|
||||
else {
|
||||
this.setPrefForActiveWindow(function() {
|
||||
TSTUtils.setTreePref('tabbar.shrunkenWidth', width);
|
||||
utils.setTreePref('tabbar.shrunkenWidth', width);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -922,7 +922,7 @@ TreeStyleTabWindow.prototype = {
|
||||
let delta = aEvent.screenY - this.tabbarResizeStartY;
|
||||
height += (pos == 'top' ? delta : -delta );
|
||||
this.setPrefForActiveWindow(function() {
|
||||
TSTUtils.setTreePref('tabbar.height', this.maxTabbarHeight(height, b));
|
||||
utils.setTreePref('tabbar.height', this.maxTabbarHeight(height, b));
|
||||
});
|
||||
}
|
||||
b.treeStyleTab.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_TABBAR_RESIZE);
|
||||
@ -986,7 +986,7 @@ TreeStyleTabWindow.prototype = {
|
||||
if (
|
||||
this.updateAeroPeekPreviewsTimer ||
|
||||
!this.getPref('browser.taskbar.previews.enable') ||
|
||||
!TSTUtils.getTreePref('taskbarPreviews.hideCollapsedTabs') ||
|
||||
!utils.getTreePref('taskbarPreviews.hideCollapsedTabs') ||
|
||||
!('Win7Features' in w) ||
|
||||
!w.Win7Features ||
|
||||
!this.AeroPeek ||
|
||||
@ -1010,7 +1010,7 @@ TreeStyleTabWindow.prototype = {
|
||||
{
|
||||
if (
|
||||
!this.getPref('browser.taskbar.previews.enable') ||
|
||||
!TSTUtils.getTreePref('taskbarPreviews.hideCollapsedTabs')
|
||||
!utils.getTreePref('taskbarPreviews.hideCollapsedTabs')
|
||||
)
|
||||
return;
|
||||
|
||||
@ -1047,12 +1047,12 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
try {
|
||||
var TabsOnTop = w.TabsOnTop;
|
||||
var originalState = TSTUtils.getTreePref('tabsOnTop.originalState');
|
||||
var originalState = utils.getTreePref('tabsOnTop.originalState');
|
||||
if (originalState === null) {
|
||||
let current = this.getDefaultPref('browser.tabs.onTop') === null ?
|
||||
TabsOnTop.enabled :
|
||||
this.getPref('browser.tabs.onTop') ;
|
||||
TSTUtils.setTreePref('tabsOnTop.originalState', originalState = current);
|
||||
utils.setTreePref('tabsOnTop.originalState', originalState = current);
|
||||
}
|
||||
|
||||
if (this.browser.treeStyleTab.position != 'top' ||
|
||||
@ -1063,7 +1063,7 @@ TreeStyleTabWindow.prototype = {
|
||||
else {
|
||||
if (TabsOnTop.enabled != originalState)
|
||||
TabsOnTop.enabled = originalState;
|
||||
TSTUtils.clearTreePref('tabsOnTop.originalState');
|
||||
utils.clearTreePref('tabsOnTop.originalState');
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@ -1148,7 +1148,7 @@ TreeStyleTabWindow.prototype = {
|
||||
return;
|
||||
|
||||
var b = aTabBrowser || this.browser;
|
||||
this._handleNewTabCommand(b.selectedTab, TSTUtils.getTreePref('autoAttach.newTabCommand'));
|
||||
this._handleNewTabCommand(b.selectedTab, utils.getTreePref('autoAttach.newTabCommand'));
|
||||
},
|
||||
|
||||
handleNewTabActionOnButton : function TSTWindow_handleNewTabActionOnButton(aEvent)
|
||||
@ -1159,7 +1159,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
var newTabButton = this.getNewTabButtonFromEvent(aEvent);
|
||||
if (newTabButton) {
|
||||
this._handleNewTabCommand(this.browser.selectedTab, TSTUtils.getTreePref('autoAttach.newTabButton'));
|
||||
this._handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.newTabButton'));
|
||||
let self = this.windowService || this;
|
||||
self._clickEventOnNewTabButtonHandled = true;
|
||||
this.Deferred.next(function() {
|
||||
@ -1167,7 +1167,7 @@ TreeStyleTabWindow.prototype = {
|
||||
});
|
||||
}
|
||||
else if (aEvent.target.id == 'urlbar-go-button' || aEvent.target.id == 'go-button') {
|
||||
this._handleNewTabCommand(this.browser.selectedTab, TSTUtils.getTreePref('autoAttach.goButton'));
|
||||
this._handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.goButton'));
|
||||
}
|
||||
},
|
||||
_clickEventOnNewTabButtonHandled : false,
|
||||
@ -1181,7 +1181,7 @@ TreeStyleTabWindow.prototype = {
|
||||
var behaviorPref = !aDelta ? 'autoAttach.duplicateTabCommand' :
|
||||
aDelta < 0 ? 'autoAttach.duplicateTabCommand.back' :
|
||||
'autoAttach.duplicateTabCommand.forward'
|
||||
var behavior = TSTUtils.getTreePref(behaviorPref);
|
||||
var behavior = utils.getTreePref(behaviorPref);
|
||||
this._handleNewTabCommand(aTab || b.selectedTab, behavior);
|
||||
},
|
||||
|
||||
@ -1306,7 +1306,7 @@ TreeStyleTabWindow.prototype = {
|
||||
this.setTabbrowserAttribute(this.kFIXED+'-'+orient, newFixed || null, b);
|
||||
this.setPrefForActiveWindow(function() {
|
||||
b.treeStyleTab.fixed = newFixed;
|
||||
TSTUtils.setTreePref('tabbar.fixed.'+orient, newFixed);
|
||||
utils.setTreePref('tabbar.fixed.'+orient, newFixed);
|
||||
});
|
||||
|
||||
b.treeStyleTab.updateTabbarState();
|
||||
@ -1435,7 +1435,7 @@ TreeStyleTabWindow.prototype = {
|
||||
aTabs.indexOf(next) > -1
|
||||
);
|
||||
|
||||
var root = TSTUtils.getTreePref('createSubtree.underParent') ?
|
||||
var root = utils.getTreePref('createSubtree.underParent') ?
|
||||
b.addTab(this.getGroupTabURI()) :
|
||||
aTabs.shift() ;
|
||||
var self = this;
|
||||
@ -1544,7 +1544,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
expandTreeAfterKeyReleased : function TSTWindow_expandTreeAfterKeyReleased(aTab)
|
||||
{
|
||||
if (TSTUtils.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut')) return;
|
||||
if (utils.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut')) return;
|
||||
this._tabShouldBeExpandedAfterKeyReleased = aTab || null;
|
||||
},
|
||||
_tabShouldBeExpandedAfterKeyReleased : null,
|
||||
@ -1695,7 +1695,7 @@ TreeStyleTabWindow.prototype = {
|
||||
{
|
||||
case 'extensions.treestyletab.tabbar.autoHide.mode':
|
||||
// don't set on this time, because appearance of all tabbrowsers are not updated yet.
|
||||
// this.autoHide.mode = TSTUtils.getTreePref('tabbar.autoHide.mode');
|
||||
// this.autoHide.mode = utils.getTreePref('tabbar.autoHide.mode');
|
||||
case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown':
|
||||
case 'extensions.treestyletab.tabbar.autoShow.tabSwitch':
|
||||
case 'extensions.treestyletab.tabbar.autoShow.feedback':
|
||||
|
Loading…
x
Reference in New Issue
Block a user