diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index a6f853696b..e566d987b2 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -65,6 +65,7 @@ var Zotero_Tabs = new function () { }))); var { tab } = this._getTab(this._selectedID); document.title = (tab.title.length ? tab.title + ' - ' : '') + 'Zotero'; + this._updateTabBar(); }; this.init = function () { @@ -93,8 +94,6 @@ var Zotero_Tabs = new function () { * @return {{ id: string, container: XULElement}} id - tab id, container - a new tab container created in the deck */ this.add = function ({ type, title, index, select, onClose, notifierData }) { - //this.showTabBar(); - if (typeof type != 'string') { throw new Error(`'type' should be a string (was ${typeof type})`); } @@ -163,10 +162,6 @@ var Zotero_Tabs = new function () { } Zotero.Notifier.trigger('close', 'tab', [tab.id], true); this._update(); - - /*if (this._tabs.length == 1) { - this.hideTabBar(); - }*/ }; /** @@ -232,25 +227,46 @@ var Zotero_Tabs = new function () { var { tabIndex } = this._getTab(this._selectedID); this.select((this._tabs[tabIndex + 1] || this._tabs[0]).id); }; + + /** + * Update state of the tab bar. + * Only used on Windows and Linux. On macOS, the tab bar is always shown. + */ + this._updateTabBar = function () { + if (Zotero.isMac) { + return; + } + if (this._tabs.length == 1) { + this._hideTabBar(); + } + else { + this._showTabBar(); + } + }; - // Unused - this.showTabBar = function () { - document.documentElement.setAttribute('drawintitlebar', true); - document.documentElement.setAttribute('tabsintitlebar', true); - document.documentElement.setAttribute('chromemargin', '0,-1,-1,-1'); + /** + * Show the tab bar. + * Only used on Windows and Linux. On macOS, the tab bar is always shown. + */ + this._showTabBar = function () { + if (Zotero.isMac) { + return; + } document.getElementById('titlebar').hidden = false; document.getElementById('tab-bar-container').hidden = false; - document.getElementById('main-window').removeAttribute('legacytoolbar') + document.getElementById('main-window').removeAttribute('legacytoolbar'); }; - // Unused - this.hideTabBar = function () { - document.documentElement.removeAttribute('drawintitlebar'); - document.documentElement.removeAttribute('tabsintitlebar'); - document.documentElement.removeAttribute('chromemargin'); - document.getElementById('titlebar').hidden = true + /** + * Hide the tab bar. + * Only used on Windows and Linux. On macOS, the tab bar is always shown. + */ + this._hideTabBar = function () { + if (Zotero.isMac) { + return; + } + document.getElementById('titlebar').hidden = true; document.getElementById('tab-bar-container').hidden = true; - document.getElementById('main-window').setAttribute('legacytoolbar', 'true') + document.getElementById('main-window').setAttribute('legacytoolbar', 'true'); }; - };