Enhance pinned tab management with reset functionality and location change handling

This commit is contained in:
mr. M
2025-02-20 22:30:49 +01:00
parent 9712ced2bf
commit fbe81666bf
8 changed files with 211 additions and 36 deletions

View File

@@ -1,16 +1,27 @@
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0c5ea2de6 100644
index d41c486c02a6f09dcff5741a59ad8b617294c481..5d3d4556ccb1fd28ada75df22f2c1ec8f56b05b1 100644
--- a/browser/components/tabbrowser/content/tab.js
+++ b/browser/components/tabbrowser/content/tab.js
@@ -37,6 +37,7 @@
@@ -16,6 +16,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"/>
@@ -35,8 +36,10 @@
<label class="tab-icon-sound-label tab-icon-sound-pip-label" data-l10n-id="browser-tab-audio-pip" role="presentation"/>
<label class="tab-icon-sound-label tab-icon-sound-tooltip-label" 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>
`;
@@ -168,7 +169,7 @@
@@ -168,7 +171,7 @@
}
set _visuallySelected(val) {
@@ -19,7 +30,7 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0
return;
}
@@ -204,7 +205,7 @@
@@ -204,7 +207,7 @@
}
get visible() {
@@ -28,7 +39,7 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0
}
get hidden() {
@@ -266,7 +267,7 @@
@@ -266,7 +269,7 @@
return false;
}
@@ -37,15 +48,16 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0
}
get lastAccessed() {
@@ -451,6 +452,7 @@
@@ -451,6 +454,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")
) {
eventMaySelectTab = false;
@@ -544,6 +546,7 @@
@@ -544,6 +549,7 @@
if (this.multiselected) {
gBrowser.removeMultiSelectedTabs();
} else {
@@ -53,12 +65,15 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0
gBrowser.removeTab(this, {
animate: true,
triggeringEvent: event,
@@ -553,6 +556,11 @@
@@ -553,6 +559,14 @@
// (see tabbrowser-tabs 'click' handler).
gBrowser.tabContainer._blockDblClick = true;
}
+
+ if (event.target.classList.contains("tab-reset-button")) {
+ if (event.target.classList.contains("tab-reset-pin-button")) {
+ gZenPinnedTabManager._onTabResetPinButton(event, this);
+ gBrowser.tabContainer._blockDblClick = true;
+ } else if (event.target.classList.contains("tab-reset-button")) {
+ gZenPinnedTabManager._onCloseTabShortcut(event, this, 'unload-switch');
+ gBrowser.tabContainer._blockDblClick = true;
+ }