mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-25 07:51:34 +00:00
Merge branch 'dev' of https://github.com/zen-browser/desktop into dev
This commit is contained in:
@@ -33,8 +33,6 @@
|
||||
|
||||
this._initSidebarScrolling();
|
||||
|
||||
gZenUIMigration.init();
|
||||
|
||||
gZenCompactModeManager.init();
|
||||
ZenWorkspaces.init();
|
||||
gZenVerticalTabsManager.init();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js
|
||||
index 63100defacf66c6b3232b9e0a783a5fd14e3a46a..eb7ed966628a595847b850f981418d425b78f14b 100644
|
||||
index 63100defacf66c6b3232b9e0a783a5fd14e3a46a..22b79b021ff0baab4dac602447a124308208c828 100644
|
||||
--- a/browser/base/content/browser-init.js
|
||||
+++ b/browser/base/content/browser-init.js
|
||||
@@ -162,13 +162,15 @@ var gBrowserInit = {
|
||||
@@ -19,12 +19,11 @@ index 63100defacf66c6b3232b9e0a783a5fd14e3a46a..eb7ed966628a595847b850f981418d42
|
||||
if (isVerticalTabs) {
|
||||
// Show the vertical tabs toolbar
|
||||
setToolbarVisibility(
|
||||
@@ -287,6 +289,11 @@ var gBrowserInit = {
|
||||
@@ -287,6 +289,10 @@ var gBrowserInit = {
|
||||
gPrivateBrowsingUI.init();
|
||||
BrowserSearch.init();
|
||||
BrowserPageActions.init();
|
||||
+
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenUIMigration.mjs", window);
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/ZenStartup.mjs", window);
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/zenThemeModifier.js", window);
|
||||
+
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
#urlbar {
|
||||
--toolbarbutton-border-radius: 10px;
|
||||
--toolbarbutton-border-radius: 8px;
|
||||
--urlbarView-separator-color: var(--zen-colors-border);
|
||||
--urlbarView-hover-background: var(--toolbarbutton-hover-background);
|
||||
--urlbarView-highlight-background: var(--toolbarbutton-hover-background);
|
||||
|
||||
@@ -41,9 +41,15 @@ var gZenCompactModeManager = {
|
||||
|
||||
get preference() {
|
||||
if (!document.documentElement.hasAttribute('zen-compact-mode')) {
|
||||
document.documentElement.setAttribute(
|
||||
'zen-compact-mode',
|
||||
lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode')
|
||||
window.addEventListener(
|
||||
'MozAfterPaint',
|
||||
() => {
|
||||
document.documentElement.setAttribute(
|
||||
'zen-compact-mode',
|
||||
lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode')
|
||||
);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
}
|
||||
return lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') === 'true';
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
|
||||
getTabPosition(tab) {
|
||||
return Math.max(gBrowser._numVisiblePinTabs, tab._tPos) + 1;
|
||||
return Math.max(gBrowser.pinnedTabCount, tab._tPos) + 1;
|
||||
}
|
||||
|
||||
createBrowserElement(url, currentTab, existingTab = null) {
|
||||
|
||||
@@ -472,6 +472,9 @@
|
||||
this._resetTabToStoredState(selectedTab);
|
||||
}
|
||||
if (behavior.includes('unload')) {
|
||||
if (selectedTab.hasAttribute('glance-id')) {
|
||||
break;
|
||||
}
|
||||
gBrowser.explicitUnloadTabs([selectedTab]);
|
||||
selectedTab.removeAttribute('linkedpanel');
|
||||
}
|
||||
|
||||
@@ -1,59 +1,64 @@
|
||||
{
|
||||
const PREF_NAME = 'zen.migration.version';
|
||||
const MIGRATION_VERSION = 1;
|
||||
const lazy = {};
|
||||
|
||||
class ZenUIMigration {
|
||||
init() {
|
||||
if (Services.prefs.prefHasUserValue(PREF_NAME)) {
|
||||
this._migrate();
|
||||
}
|
||||
this.clearVariables();
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
BrowserWindowTracker: 'resource:///modules/BrowserWindowTracker.sys.mjs',
|
||||
});
|
||||
|
||||
class ZenUIMigration {
|
||||
PREF_NAME = 'zen.migration.version';
|
||||
MIGRATION_VERSION = 1;
|
||||
|
||||
init(isNewProfile, win) {
|
||||
console.log(isNewProfile, win);
|
||||
if (!isNewProfile) {
|
||||
this._migrate(win);
|
||||
}
|
||||
this.clearVariables();
|
||||
}
|
||||
|
||||
get _migrationVersion() {
|
||||
return Services.prefs.getIntPref(PREF_NAME, 0);
|
||||
}
|
||||
get _migrationVersion() {
|
||||
return Services.prefs.getIntPref(this.PREF_NAME, 0);
|
||||
}
|
||||
|
||||
set _migrationVersion(value) {
|
||||
Services.prefs.setIntPref(PREF_NAME, value);
|
||||
}
|
||||
set _migrationVersion(value) {
|
||||
Services.prefs.setIntPref(this.PREF_NAME, value);
|
||||
}
|
||||
|
||||
_migrate() {
|
||||
if (this._migrationVersion < 1) {
|
||||
this._migrateV1();
|
||||
}
|
||||
}
|
||||
|
||||
clearVariables() {
|
||||
this._migrationVersion = MIGRATION_VERSION;
|
||||
window.gZenUIMigration = null;
|
||||
}
|
||||
|
||||
async _migrateV1() {
|
||||
// Introduction of the new URL bar, show a message to the user
|
||||
const notification = gNotificationBox.appendNotification(
|
||||
'zen-new-urlbar-notification',
|
||||
{
|
||||
label: { 'l10n-id': 'zen-new-urlbar-notification' },
|
||||
image: 'chrome://browser/skin/notification-icons/persistent-storage-blocked.svg',
|
||||
priority: gNotificationBox.PRIORITY_WARNING_HIGH,
|
||||
},
|
||||
[
|
||||
{
|
||||
'l10n-id': 'zen-disable',
|
||||
accessKey: 'D',
|
||||
callback: () => {
|
||||
Services.prefs.setBoolPref('zen.urlbar.replace-newtab', false);
|
||||
},
|
||||
},
|
||||
{
|
||||
link: 'https://docs.zen-browser.app/user-manual/urlbar/',
|
||||
'l10n-id': 'zen-learn-more-text',
|
||||
},
|
||||
]
|
||||
);
|
||||
_migrate(win) {
|
||||
if (this._migrationVersion < 1) {
|
||||
this._migrateV1(win);
|
||||
}
|
||||
}
|
||||
|
||||
window.gZenUIMigration = new ZenUIMigration();
|
||||
clearVariables() {
|
||||
this._migrationVersion = this.MIGRATION_VERSION;
|
||||
}
|
||||
|
||||
async _migrateV1(win) {
|
||||
// Introduction of the new URL bar, show a message to the user
|
||||
const notification = win.gNotificationBox.appendNotification(
|
||||
'zen-new-urlbar-notification',
|
||||
{
|
||||
label: { 'l10n-id': 'zen-new-urlbar-notification' },
|
||||
image: 'chrome://browser/skin/notification-icons/persistent-storage-blocked.svg',
|
||||
priority: win.gNotificationBox.PRIORITY_WARNING_HIGH,
|
||||
},
|
||||
[
|
||||
{
|
||||
'l10n-id': 'zen-disable',
|
||||
accessKey: 'D',
|
||||
callback: () => {
|
||||
Services.prefs.setBoolPref('zen.urlbar.replace-newtab', false);
|
||||
},
|
||||
},
|
||||
{
|
||||
link: 'https://docs.zen-browser.app/user-manual/urlbar/',
|
||||
'l10n-id': 'zen-learn-more-text',
|
||||
},
|
||||
]
|
||||
);
|
||||
notification.persistence = -1;
|
||||
}
|
||||
}
|
||||
|
||||
export var gZenUIMigration = new ZenUIMigration();
|
||||
|
||||
Reference in New Issue
Block a user