mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-03 08:28:38 +00:00
Added a timeout before the newtab url bar can clear it's content
This commit is contained in:
@@ -118,6 +118,7 @@ pref('zen.view.compact.animate-sidebar', true);
|
||||
|
||||
pref('zen.urlbar.replace-newtab', true);
|
||||
pref('zen.urlbar.behavior', 'floating-on-type'); // default, floating-on-type, float
|
||||
pref('zen.urlbar.wait-to-clear', 45000); // in ms (default 45s)
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Disable for macos in the meantime until @HarryHeres finds a solution for hight DPI screens
|
||||
@@ -167,7 +168,7 @@ pref('zen.tab-unloader.excluded-urls', "example.com,example.org");
|
||||
|
||||
pref('zen.pinned-tab-manager.debug', false);
|
||||
pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false);
|
||||
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'switch');
|
||||
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'unload-switch');
|
||||
|
||||
// TODO: Check this out!
|
||||
pref("browser.profiles.enabled", false);
|
||||
|
@@ -8,6 +8,7 @@ var gZenUIManager = {
|
||||
document.addEventListener('popuphidden', this.onPopupHidden.bind(this));
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'sidebarHeightThrottle', 'zen.view.sidebar-height-throttle', 500);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'contentElementSeparation', 'zen.theme.content-element-separation', 0);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'urlbarWaitToClear', 'zen.urlbar.wait-to-clear', 0);
|
||||
|
||||
ChromeUtils.defineLazyGetter(this, 'motion', () => {
|
||||
return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: 'current' });
|
||||
@@ -149,11 +150,15 @@ var gZenUIManager = {
|
||||
|
||||
_prevUrlbarLabel: null,
|
||||
_lastSearch: '',
|
||||
_clearTimeout: null,
|
||||
|
||||
handleNewTab(werePassedURL, searchClipboard, where) {
|
||||
const shouldOpenURLBar =
|
||||
Services.prefs.getBoolPref('zen.urlbar.replace-newtab') && !werePassedURL && !searchClipboard && where === 'tab';
|
||||
if (shouldOpenURLBar) {
|
||||
if (this._clearTimeout) {
|
||||
clearTimeout(this._clearTimeout);
|
||||
}
|
||||
this._prevUrlbarLabel = gURLBar._untrimmedValue;
|
||||
gURLBar._zenHandleUrlbarClose = this.handleUrlbarClose.bind(this);
|
||||
gURLBar.setAttribute('zen-newtab', true);
|
||||
@@ -164,14 +169,21 @@ var gZenUIManager = {
|
||||
return false;
|
||||
},
|
||||
|
||||
clearUrlbarData() {
|
||||
this._prevUrlbarLabel = null;
|
||||
this._lastSearch = '';
|
||||
},
|
||||
|
||||
handleUrlbarClose(onSwitch) {
|
||||
gURLBar._zenHandleUrlbarClose = null;
|
||||
gURLBar.removeAttribute('zen-newtab');
|
||||
if (onSwitch) {
|
||||
this._prevUrlbarLabel = null;
|
||||
this._lastSearch = '';
|
||||
this.clearUrlbarData();
|
||||
} else {
|
||||
this._lastSearch = gURLBar._untrimmedValue;
|
||||
this._clearTimeout = setTimeout(() => {
|
||||
this.clearUrlbarData();
|
||||
}, this.urlbarWaitToClear);
|
||||
}
|
||||
gURLBar.setURI(this._prevUrlbarLabel, onSwitch, false, false, !onSwitch);
|
||||
gURLBar.handleRevert();
|
||||
|
Reference in New Issue
Block a user