zen-realigned/src/browser/components/tabbrowser/content/tab-js.patch

91 lines
3.7 KiB
C++

diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
index dc92771ebc65095dfebbddc238ee6d4fffd897bf..ae9120f7cc8989cf625ac101d053d82582e32009 100644
--- a/browser/components/tabbrowser/content/tab.js
+++ b/browser/components/tabbrowser/content/tab.js
@@ -21,6 +21,7 @@
<hbox class="tab-group-line"/>
</vbox>
<hbox class="tab-content" align="center">
+ <box class="tab-reset-pin-button" role="button" data-l10n-id="tabbrowser-reset-pin-button" data-l10n-args='{"tabCount": 1}' keyNav="false"><image/></box>
<stack class="tab-icon-stack">
<hbox class="tab-throbber"/>
<hbox class="tab-icon-pending"/>
@@ -37,8 +38,10 @@
<hbox class="tab-secondary-label">
<label class="tab-icon-sound-label tab-icon-sound-pip-label" data-l10n-id="browser-tab-audio-pip" role="presentation"/>
</hbox>
+ <label class="tab-reset-pin-label" data-l10n-id="tab-reset-pin-label" role="presentation"/>
</vbox>
<image class="tab-close-button close-icon" role="button" data-l10n-id="tabbrowser-close-tabs-button" data-l10n-args='{"tabCount": 1}' keyNav="false"/>
+ <image class="tab-reset-button reset-icon" role="button" data-l10n-id="tabbrowser-unload-tab-button" data-l10n-args='{"tabCount": 1}' keyNav="false"/>
</hbox>
</stack>
`;
@@ -175,7 +178,7 @@
}
set _visuallySelected(val) {
- if (val == this.hasAttribute("visuallyselected")) {
+ if (val == this.hasAttribute("visuallyselected") || (!val && this.linkedBrowser?.closest('.browserSidebarContainer').classList.contains('zen-glance-background'))) {
return;
}
@@ -211,7 +214,7 @@
}
get visible() {
- return this.isOpen && !this.hidden && !this.group?.collapsed;
+ return this.isOpen && !this.hidden && !this.group?.collapsed && !this.hasAttribute("zen-empty-tab");
}
get hidden() {
@@ -282,7 +285,7 @@
return false;
}
- return true;
+ return !this.hasAttribute("zen-empty-tab");
}
get lastAccessed() {
@@ -454,6 +457,8 @@
this.style.MozUserFocus = "ignore";
} else if (
event.target.classList.contains("tab-close-button") ||
+ event.target.classList.contains("tab-reset-button") ||
+ event.target.classList.contains("tab-reset-pin-button") ||
event.target.classList.contains("tab-icon-overlay") ||
event.target.classList.contains("tab-audio-button")
) {
@@ -554,6 +559,7 @@
telemetrySource: lazy.TabMetrics.METRIC_SOURCE.TAB_STRIP,
});
} else {
+ gZenPinnedTabManager._removePinnedAttributes(this, true);
gBrowser.removeTab(this, {
animate: true,
triggeringEvent: event,
@@ -564,6 +570,14 @@
// (see tabbrowser-tabs 'click' handler).
gBrowser.tabContainer._blockDblClick = true;
}
+
+ if (event.target.classList.contains("tab-reset-pin-button")) {
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
+ gBrowser.tabContainer._blockDblClick = true;
+ } else if (event.target.classList.contains("tab-reset-button")) {
+ gZenPinnedTabManager._onCloseTabShortcut(event, this);
+ gBrowser.tabContainer._blockDblClick = true;
+ }
}
on_dblclick(event) {
@@ -587,6 +601,8 @@
animate: true,
triggeringEvent: event,
});
+ } else if (this.hasAttribute('zen-essential') && !event.target.classList.contains("tab-icon-overlay")) {
+ gZenPinnedTabManager._onTabResetPinButton(event, this, 'reset');
}
}