diff --git a/content/treestyletab/config.js b/content/treestyletab/config.js index 68547002..c8a52ff4 100644 --- a/content/treestyletab/config.js +++ b/content/treestyletab/config.js @@ -55,12 +55,17 @@ function onChangeGroupBookmarkRadio() function onChangeTabbarPosition(aOnChange) { + const XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1'] + .getService(Components.interfaces.nsIXULAppInfo); + const comparator = Components.classes['@mozilla.org/xpcom/version-comparator;1'] + .getService(Components.interfaces.nsIVersionComparator); + var pos = document.getElementById('extensions.treestyletab.tabbar.position-radiogroup').value; var invertScrollbar = document.getElementById('extensions.treestyletab.tabbar.invertScrollbar-check'); invertScrollbar.disabled = pos != 'left'; document.getElementById('extensions.treestyletab.tabbar.invertUI-check').disabled = pos != 'right'; - if (isGecko18()) { + if (comparator.compare(XULAppInfo.version, '3.0') < 0) { invertScrollbar.removeAttribute('collapsed'); } else { @@ -74,7 +79,6 @@ function onChangeTabbarPosition(aOnChange) var collapseCheck = document.getElementById('extensions.treestyletab.allowSubtreeCollapseExpand-check'); // var autoHideCheck = document.getElementById('extensions.treestyletab.tabbar.autoHide.enabled-check'); var hideNewTabCheck = document.getElementById('extensions.treestyletab.tabbar.hideNewTabButton-check'); - var hideAllTabsCheck = document.getElementById('extensions.treestyletab.tabbar.hideAlltabsButton-check'); if (aOnChange && gLastStateIsVertical != (pos == 'left' || pos == 'right')) { @@ -85,26 +89,20 @@ function onChangeTabbarPosition(aOnChange) if (pos == 'left' || pos == 'right') { indentCheck.setAttribute('collapsed', true); // autoHideCheck.removeAttribute('collapsed'); - hideNewTabCheck.removeAttribute('collapsed'); - hideAllTabsCheck.removeAttribute('collapsed'); + if (comparator.compare(XULAppInfo.version, '3.1b3') >= 0) + hideNewTabCheck.removeAttribute('collapsed'); + else + hideNewTabCheck.setAttribute('collapsed', true); } else { indentCheck.removeAttribute('collapsed'); // autoHideCheck.setAttribute('collapsed', true); hideNewTabCheck.setAttribute('collapsed', true); - hideAllTabsCheck.setAttribute('collapsed', true); } gTabbarPlacePositionInitialized = true; } -function isGecko18() -{ - const XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULAppInfo); - var version = XULAppInfo.platformVersion.split('.'); - return parseInt(version[0]) <= 1 && parseInt(version[1]) <= 8; -} - var gAutoHideModeRadio; var gAutoHideModeToggle; diff --git a/content/treestyletab/config.xul b/content/treestyletab/config.xul index a61d756a..f9c31696 100644 --- a/content/treestyletab/config.xul +++ b/content/treestyletab/config.xul @@ -103,15 +103,15 @@ label="&config.allowSubtreeCollapseExpand;"/> + - diff --git a/content/treestyletab/treestyletab.css b/content/treestyletab/treestyletab.css index 92c945a1..43044bff 100644 --- a/content/treestyletab/treestyletab.css +++ b/content/treestyletab/treestyletab.css @@ -27,18 +27,18 @@ tabbrowser[treestyletab-tabbar-fixed="true"] .tabbrowser-strip+splitter { } -tabbrowser:not([treestyletab-mode="horizontal"]) .tabbrowser-arrowscrollbox > .scrollbutton-up, -tabbrowser:not([treestyletab-mode="horizontal"]) .tabbrowser-arrowscrollbox > .scrollbutton-down-stack, -tabbrowser:not([treestyletab-mode="horizontal"]) .tabbrowser-arrowscrollbox > .scrollbutton-down, /* Firefox 3 */ +tabbrowser[treestyletab-mode="vertical"] .tabbrowser-arrowscrollbox > .scrollbutton-up, +tabbrowser[treestyletab-mode="vertical"] .tabbrowser-arrowscrollbox > .scrollbutton-down-stack, +tabbrowser[treestyletab-mode="vertical"] .tabbrowser-arrowscrollbox > .scrollbutton-down, /* Firefox 3 */ tabbrowser[treestyletab-hide-alltabs-button="true"] .tabs-alltabs-stack, tabbrowser[treestyletab-hide-alltabs-button="true"] .tabbrowser-arrowscrollbox ~ stack, /* "all tabs" button in Firefox 3 and 3.1 */ tabbrowser[treestyletab-mode="vertical"] .tabs-closebutton-box, -tabbrowser:not([treestyletab-mode="horizontal"]) .tab-drop-indicator-bar, -tabbrowser:not([treestyletab-mode="horizontal"]) #vide-bar, /* Tab Mix Plus */ -tabbrowser:not([treestyletab-mode="horizontal"]) #tabs-scroll-up-down-box, /* Tab Mix Plus */ -tabbrowser:not([treestyletab-mode="horizontal"]) #alltabs-place-holder, /* Tab Mix Plus */ -tabbrowser:not([treestyletab-mode="horizontal"]) .tabs-scroll /* Tab Mix Plus */ { - display: none !important; +tabbrowser[treestyletab-mode="vertical"] .tab-drop-indicator-bar, +tabbrowser[treestyletab-mode="vertical"] #vide-bar, /* Tab Mix Plus */ +tabbrowser[treestyletab-mode="vertical"] #tabs-scroll-up-down-box, /* Tab Mix Plus */ +tabbrowser[treestyletab-mode="vertical"] #alltabs-place-holder, /* Tab Mix Plus */ +tabbrowser[treestyletab-mode="vertical"] .tabs-scroll /* Tab Mix Plus */ { + visibility: collapse !important; } #appcontent { diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 5c95ac7d..5ad18915 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -166,21 +166,35 @@ var TreeStyleTabService = { _WindowMediator : null, get isGecko18() { - var version = this.XULAppInfo.platformVersion.split('.'); - return parseInt(version[0]) <= 1 && parseInt(version[1]) <= 8; + if (this._isGecko18 === null) + this._isGecko18 = this.Comparator.compare(this.XULAppInfo.version, '3.0') < 0; + return this._isGecko18; }, + _isGecko18 : null, get isGecko19() { - var version = this.XULAppInfo.platformVersion.split('.'); - return parseInt(version[0]) >= 2 || parseInt(version[1]) >= 9; + if (this._isGecko19 === null) + this._isGecko19 = this.Comparator.compare(this.XULAppInfo.version, '3.0') >= 0; + return this._isGecko19; }, - + _isGecko19 : null, get XULAppInfo() { if (!this._XULAppInfo) { - this._XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULAppInfo); + this._XULAppInfo = Components + .classes['@mozilla.org/xre/app-info;1'] + .getService(Components.interfaces.nsIXULAppInfo); } return this._XULAppInfo; }, _XULAppInfo : null, + get Comparator() { + if (!this._Comparator) { + this._Comparator = Components + .classes['@mozilla.org/xpcom/version-comparator;1'] + .getService(Components.interfaces.nsIVersionComparator); + } + return this._Comparator; + }, + _Comparator : null, get stringbundle() { if (!this._stringbundle) { diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 2357300d..09436689 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1056,8 +1056,7 @@ TreeStyleTabBrowser.prototype = { break; case 'extensions.treestyletab.tabbar.hideAlltabsButton': - var pos = b.getAttribute(this.kTABBAR_POSITION); - if (value && (pos == 'left' || pos == 'right')) + if (value) b.setAttribute(this.kHIDE_ALLTABS, true); else b.removeAttribute(this.kHIDE_ALLTABS);