Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 8129dde

Browse files
committed
Add an option to show hidden tab
Showing all tabs including the hidden ones can be very handy when mixing with Conex. Top tabs only show your current container. Side tabs shows everything. Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]>
1 parent 699694f commit 8129dde

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

src/_locales/en/messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,9 @@
142142

143143
"optionsSaveCustomCSS": {
144144
"message": "Save CSS"
145+
},
146+
147+
"optionsShowHidden": {
148+
"message": "Show hidden tabs"
145149
}
146150
}

src/_locales/fr/messages.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,8 @@
109109
},
110110
"optionsSaveCustomCSS": {
111111
"message": "Enregistrer la CSS"
112+
},
113+
"optionsShowHidden": {
114+
"message": "Afficher les onglets cachés"
112115
}
113-
}
116+
}

src/options/options.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ <h1 id="optionsTitle"></h1>
2121
</div>
2222
<div><label for="compactPins" id="optionsCompactPins"></label></div>
2323
<div><input id="compactPins" type="checkbox" /></div>
24+
<div><label for="showHidden" id="optionsShowHidden"></label></div>
25+
<div><input id="showHidden" type="checkbox" /></div>
2426
</div>
2527
<h1 id="optionsAdvancedTitle"></h1>
2628
<div class="options">

src/options/options.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TabCenterOptions.prototype = {
99
"optionsCompactModeStrict", "optionsCompactModeDynamic",
1010
"optionsCompactModeOff", "optionsCompactPins", "optionsDarkTheme",
1111
"optionsThemeIntegration", "optionsAdvancedTitle", "optionsCustomCSS",
12-
"optionsCustomCSSWikiLink", "optionsSaveCustomCSS"];
12+
"optionsCustomCSSWikiLink", "optionsSaveCustomCSS", "optionsShowHidden"];
1313
for (let opt of options) {
1414
this._setupTextContentLabel(opt);
1515
}
@@ -26,6 +26,7 @@ TabCenterOptions.prototype = {
2626
this._setupCheckboxOption("themeIntegration", "themeIntegration");
2727
this._setupDropdownOption("compactMode", "compactModeMode");
2828
this._setupCheckboxOption("compactPins", "compactPins", true);
29+
this._setupCheckboxOption("showHidden", "showHidden");
2930

3031
// Custom CSS
3132
browser.storage.local.get({

src/sidebar/tabcenter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ TabCenter.prototype = {
9595
compactModeMode: 1/* COMPACT_MODE_DYNAMIC */,
9696
compactPins: true,
9797
themeIntegration: false,
98+
showHidden: false,
9899
});
99100
},
100101
_applyPrefs(prefs) {

src/sidebar/tablist.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function TabList(props) {
2727

2828
this._compactModeMode = parseInt(this._props.prefs.compactModeMode);
2929
this._compactPins = this._props.prefs.compactPins;
30+
this._showHidden = this._props.prefs.showHidden;
3031
this._setupListeners();
3132

3233
if (browser.browserSettings.closeTabsByDoubleClick) { // Introduced in Firefox 61.
@@ -87,6 +88,9 @@ TabList.prototype = {
8788
if (changes.compactPins) {
8889
this._compactPins = changes.compactPins.newValue;
8990
}
91+
if (changes.showHidden) {
92+
this._showHidden = changes.showHidden.newValue;
93+
}
9094
this._maybeShrinkTabs();
9195
},
9296
_onBrowserTabCreated(tab) {
@@ -135,7 +139,7 @@ TabList.prototype = {
135139
this._shiftTabsIndexes(direction, start, end);
136140
tab.index = toIndex;
137141

138-
if (tab.hidden) {
142+
if (tab.hidden && !this._showHidden) {
139143
return;
140144
}
141145

@@ -151,7 +155,7 @@ TabList.prototype = {
151155
return;
152156
}
153157
if (changeInfo.hasOwnProperty("hidden")) {
154-
if (changeInfo.hidden) {
158+
if (changeInfo.hidden && !this._showHidden) {
155159
this._removeTabView(sidetab);
156160
} else {
157161
this._appendTabView(sidetab);
@@ -237,19 +241,19 @@ TabList.prototype = {
237241
},
238242
_closeTabsAfter(tabIndex) {
239243
const toClose = [...this._tabs.values()]
240-
.filter(tab => tab.index > tabIndex && !tab.hidden)
244+
.filter(tab => tab.index > tabIndex && !(tab.hidden && !this._showHidden))
241245
.map(tab => tab.id);
242246
browser.tabs.remove(toClose);
243247
},
244248
_closeAllTabsExcept(tabId) {
245249
const toClose = [...this._tabs.values()]
246-
.filter(tab => tab.id !== tabId && !tab.pinned && !tab.hidden)
250+
.filter(tab => tab.id !== tabId && !tab.pinned && !(tab.hidden && !this._showHidden))
247251
.map(tab => tab.id);
248252
browser.tabs.remove(toClose);
249253
},
250254
_reloadAllTabs() {
251255
for (let tab of this._tabs.values()) {
252-
if (!tab.hidden) {
256+
if (!(tab.hidden && !this._showHidden)) {
253257
browser.tabs.reload(tab.id);
254258
}
255259
}
@@ -500,7 +504,7 @@ TabList.prototype = {
500504
activeTab = sidetab;
501505
}
502506
let fragment = tab.pinned ? pinnedFragment : unpinnedFragment;
503-
if (!tab.hidden) {
507+
if (!(tab.hidden && !this._showHidden)) {
504508
fragment.appendChild(sidetab.view);
505509
}
506510
}
@@ -599,7 +603,7 @@ TabList.prototype = {
599603
const sidetab = this.__create(tabInfo);
600604
// Bail early and don't insert the tab in the DOM: we'll do it later
601605
// if the tab becomes visible.
602-
if (tabInfo.hidden) {
606+
if (tabInfo.hidden && !this._showHidden) {
603607
return;
604608
}
605609
this._clearSearch();
@@ -634,7 +638,7 @@ TabList.prototype = {
634638
return;
635639
}
636640
const allTabs = [...this._tabs.values()]
637-
.filter(tab => tab.pinned === sidetab.pinned && !tab.hidden)
641+
.filter(tab => tab.pinned === sidetab.pinned && !(tab.hidden && !this._showHidden))
638642
.sort((a, b) => a.index - b.index);
639643
const tabAfter = allTabs.find(tab => tab.index > sidetab.index);
640644
if (!tabAfter) {

0 commit comments

Comments
 (0)