Trim more the urlbar on single toolbar, fixed pinned tabs issues and removed security indicator on the urlbar unless it's hovered

This commit is contained in:
mr. m
2025-02-16 13:17:36 +01:00
parent c322051ddd
commit 4bc5e41c35
4 changed files with 33 additions and 5 deletions

View File

@@ -10,6 +10,8 @@ var gZenUIManager = {
XPCOMUtils.defineLazyPreferenceGetter(this, 'contentElementSeparation', 'zen.theme.content-element-separation', 0); XPCOMUtils.defineLazyPreferenceGetter(this, 'contentElementSeparation', 'zen.theme.content-element-separation', 0);
XPCOMUtils.defineLazyPreferenceGetter(this, 'urlbarWaitToClear', 'zen.urlbar.wait-to-clear', 0); XPCOMUtils.defineLazyPreferenceGetter(this, 'urlbarWaitToClear', 'zen.urlbar.wait-to-clear', 0);
gURLBar._zenTrimURL = this.urlbarTrim.bind(this);
ChromeUtils.defineLazyGetter(this, 'motion', () => { ChromeUtils.defineLazyGetter(this, 'motion', () => {
return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: 'current' }); return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: 'current' });
}); });
@@ -151,6 +153,8 @@ var gZenUIManager = {
this.__currentPopupTrackElement = null; this.__currentPopupTrackElement = null;
}, },
// Section: URL bar
get newtabButtons() { get newtabButtons() {
return document.querySelectorAll('#tabs-newtab-button'); return document.querySelectorAll('#tabs-newtab-button');
}, },
@@ -214,6 +218,16 @@ var gZenUIManager = {
} }
}, },
urlbarTrim(aURL) {
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
let url = BrowserUIUtils.removeSingleTrailingSlashFromURL(aURL);
return (url.startsWith("http://") || url.startsWith("https://"))
? url.split('/')[2]
: url;
}
return BrowserUIUtils.trimURL(aURL);
},
// Section: Notification messages // Section: Notification messages
_createToastElement(messageId, options) { _createToastElement(messageId, options) {
const element = document.createXULElement('vbox'); const element = document.createXULElement('vbox');
@@ -234,7 +248,7 @@ var gZenUIManager = {
const toast = this._createToastElement(messageId, options); const toast = this._createToastElement(messageId, options);
this._toastContainer.removeAttribute('hidden'); this._toastContainer.removeAttribute('hidden');
this._toastContainer.appendChild(toast); this._toastContainer.appendChild(toast);
await this.motion.animate(toast, { opacity: [0, 1], scale: [0.8, 1] }, { type: 'spring', duration: 0.3 }); await this.motion.animate(toast, { opacity: [0, 1], scale: [0.8, 1] }, { type: 'spring', bounce: 0.4 });
await new Promise((resolve) => setTimeout(resolve, 3000)); await new Promise((resolve) => setTimeout(resolve, 3000));
await this.motion.animate(toast, { opacity: [1, 0], scale: [1, 0.9] }, { duration: 0.2, bounce: 0 }); await this.motion.animate(toast, { opacity: [1, 0], scale: [1, 0.9] }, { duration: 0.2, bounce: 0 });
const toastHeight = toast.getBoundingClientRect().height; const toastHeight = toast.getBoundingClientRect().height;

View File

@@ -132,8 +132,9 @@
:root[zen-single-toolbar='true'] { :root[zen-single-toolbar='true'] {
.urlbar-page-action:not([open]), .urlbar-page-action:not([open]),
.identity-box-button:not([open]),
#tracking-protection-icon-container { #tracking-protection-icon-container {
margin-inline-end: calc(-14px - 2 * var(--urlbar-icon-padding)) !important; margin-inline-end: calc(-8px - 2 * var(--urlbar-icon-padding)) !important;
opacity: 0; opacity: 0;
transition: all 0.1s ease; transition: all 0.1s ease;
} }
@@ -142,9 +143,10 @@
visibility: collapse; visibility: collapse;
} }
#urlbar[open] :is(#tracking-protection-icon-container, .urlbar-page-action), #urlbar[open] :is(#tracking-protection-icon-container, .urlbar-page-action, .identity-box-button),
#urlbar:hover :is(#tracking-protection-icon-container, .urlbar-page-action), #urlbar:hover :is(#tracking-protection-icon-container, .urlbar-page-action, .identity-box-button),
.urlbar-page-action[open], .urlbar-page-action[open],
.identity-box-button[open],
#tracking-protection-icon-container[open] { #tracking-protection-icon-container[open] {
opacity: 1; opacity: 1;
margin-inline-end: 0 !important; margin-inline-end: 0 !important;

View File

@@ -290,6 +290,9 @@
for (let otherTab of gBrowser.tabs) { for (let otherTab of gBrowser.tabs) {
if (otherTab.pinned && otherTab._tPos > tab.position) { if (otherTab.pinned && otherTab._tPos > tab.position) {
const actualPin = this._pinsCache.find((pin) => pin.uuid === otherTab.getAttribute('zen-pin-id')); const actualPin = this._pinsCache.find((pin) => pin.uuid === otherTab.getAttribute('zen-pin-id'));
if (!actualPin) {
continue;
}
actualPin.position = otherTab._tPos; actualPin.position = otherTab._tPos;
await ZenPinnedTabsStorage.savePin(actualPin, false); await ZenPinnedTabsStorage.savePin(actualPin, false);
} }

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 50968dc04b527438acf30151f0c2e92f8b45097c..f8587b68ac057bb0f829fc21f08ade6605b14c92 100644 index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2dbf0d43a51 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs --- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter( @@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@@ -89,6 +89,15 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..f8587b68ac057bb0f829fc21f08ade66
this.removeAttribute("breakout-extend"); this.removeAttribute("breakout-extend");
this.#updateTextboxPosition(); this.#updateTextboxPosition();
} }
@@ -2946,7 +2978,7 @@ export class UrlbarInput {
*/
_trimValue(val) {
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
- ? lazy.BrowserUIUtils.trimURL(val)
+ ? this._zenTrimURL(val)
: val;
// Only trim value if the directionality doesn't change to RTL and we're not
// showing a strikeout https protocol.
@@ -3305,7 +3337,7 @@ export class UrlbarInput { @@ -3305,7 +3337,7 @@ export class UrlbarInput {
} else { } else {
where = lazy.BrowserUtils.whereToOpenLink(event, false, false); where = lazy.BrowserUtils.whereToOpenLink(event, false, false);