URL bar now opens instead of a newtab (optional, on by default)

This commit is contained in:
mr. M
2025-02-02 23:40:40 +01:00
parent 5fa7d9cc6e
commit 20b04937c9
4 changed files with 66 additions and 7 deletions

View File

@@ -142,6 +142,24 @@ var gZenUIManager = {
this.__currentPopup = null;
this.__currentPopupTrackElement = null;
},
handleNewTab(werePassedURL, searchClipboard, where) {
const shouldOpenURLBar = Services.prefs.getBoolPref('zen.urlbar.replace-newtab')
&& !werePassedURL && !searchClipboard && where === 'tab';
if (shouldOpenURLBar) {
gURLBar._untrimmedValue = "";
gURLBar._zenHandleUrlbarClose = this.handleUrlbarClose.bind(this);
gURLBar.setAttribute('zen-newtab', true);
document.getElementById('Browser:OpenLocation').doCommand();
return true;
}
return false;
},
handleUrlbarClose() {
gURLBar.removeAttribute('zen-newtab');
gURLBar._zenHandleUrlbarClose = null;
},
};
var gZenVerticalTabsManager = {