mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-25 16:01:34 +00:00
chore: Run lint and fund dependencies, p=#12718
This commit is contained in:
@@ -8,7 +8,11 @@ export const ZenCustomizableUI = new (class {
|
||||
constructor() {}
|
||||
|
||||
TYPE_TOOLBAR = "toolbar";
|
||||
defaultSidebarIcons = ["downloads-button", "zen-workspaces-button", "zen-create-new-button"];
|
||||
defaultSidebarIcons = [
|
||||
"downloads-button",
|
||||
"zen-workspaces-button",
|
||||
"zen-create-new-button",
|
||||
];
|
||||
|
||||
startup(CustomizableUIInternal) {
|
||||
CustomizableUIInternal.registerArea(
|
||||
@@ -39,7 +43,8 @@ export const ZenCustomizableUI = new (class {
|
||||
}
|
||||
|
||||
#addSidebarButtons(window) {
|
||||
const kDefaultSidebarWidth = AppConstants.platform === "macosx" ? "230px" : "186px";
|
||||
const kDefaultSidebarWidth =
|
||||
AppConstants.platform === "macosx" ? "230px" : "186px";
|
||||
const toolbox = window.gNavToolbox;
|
||||
|
||||
// Set a splitter to navigator-toolbox
|
||||
@@ -81,7 +86,7 @@ export const ZenCustomizableUI = new (class {
|
||||
</toolbar>
|
||||
`);
|
||||
toolbox.prepend(sidebarBox);
|
||||
new window.MutationObserver((e) => {
|
||||
new window.MutationObserver(e => {
|
||||
if (e[0].type !== "attributes" || e[0].attributeName !== "width") {
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +101,7 @@ export const ZenCustomizableUI = new (class {
|
||||
toolbox.style.width = width;
|
||||
toolbox.setAttribute("width", width);
|
||||
|
||||
splitter.addEventListener("dblclick", (e) => {
|
||||
splitter.addEventListener("dblclick", e => {
|
||||
if (e.button !== 0) {
|
||||
return;
|
||||
}
|
||||
@@ -104,7 +109,9 @@ export const ZenCustomizableUI = new (class {
|
||||
toolbox.setAttribute("width", kDefaultSidebarWidth);
|
||||
});
|
||||
|
||||
const newTab = window.document.getElementById("vertical-tabs-newtab-button");
|
||||
const newTab = window.document.getElementById(
|
||||
"vertical-tabs-newtab-button"
|
||||
);
|
||||
newTab.classList.add("zen-sidebar-action-button");
|
||||
|
||||
for (let id of this.defaultSidebarIcons) {
|
||||
@@ -124,7 +131,7 @@ export const ZenCustomizableUI = new (class {
|
||||
// If we use "mousedown" event for private windows (which open a new tab on "click"), we might end up with
|
||||
// the urlbar flicking and therefore we use "command" event to avoid that.
|
||||
let isPrivateMode = window.gZenWorkspaces.privateWindowOrDisabled;
|
||||
button.addEventListener(isPrivateMode ? "command" : "mousedown", (event) => {
|
||||
button.addEventListener(isPrivateMode ? "command" : "mousedown", event => {
|
||||
if (isPrivateMode) {
|
||||
window.document.getElementById("cmd_newNavigatorTab").doCommand();
|
||||
return;
|
||||
@@ -146,7 +153,9 @@ export const ZenCustomizableUI = new (class {
|
||||
}
|
||||
|
||||
#moveWindowButtons(window) {
|
||||
const windowControls = window.document.getElementsByClassName("titlebar-buttonbox-container");
|
||||
const windowControls = window.document.getElementsByClassName(
|
||||
"titlebar-buttonbox-container"
|
||||
);
|
||||
const toolboxIcons = window.document.getElementById(
|
||||
"zen-sidebar-top-buttons-customization-target"
|
||||
);
|
||||
@@ -173,7 +182,9 @@ export const ZenCustomizableUI = new (class {
|
||||
wrapper.prepend(elem);
|
||||
}
|
||||
}
|
||||
window.document.getElementById("stop-reload-button").removeAttribute("overflows");
|
||||
window.document
|
||||
.getElementById("stop-reload-button")
|
||||
.removeAttribute("overflows");
|
||||
}
|
||||
|
||||
_dispatchResizeEvent(window) {
|
||||
|
||||
@@ -24,7 +24,9 @@ class nsZenUIMigration {
|
||||
}
|
||||
this.clearVariables();
|
||||
if (this.shouldRestart) {
|
||||
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
Services.startup.quit(
|
||||
Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +63,24 @@ class nsZenUIMigration {
|
||||
userContentFile.append("userContent.css");
|
||||
Services.prefs.setBoolPref(
|
||||
"zen.workspaces.separate-essentials",
|
||||
Services.prefs.getBoolPref("zen.workspaces.container-specific-essentials-enabled", false)
|
||||
Services.prefs.getBoolPref(
|
||||
"zen.workspaces.container-specific-essentials-enabled",
|
||||
false
|
||||
)
|
||||
);
|
||||
const theme = Services.prefs.getIntPref(
|
||||
"layout.css.prefers-color-scheme.content-override",
|
||||
0
|
||||
);
|
||||
const theme = Services.prefs.getIntPref("layout.css.prefers-color-scheme.content-override", 0);
|
||||
Services.prefs.setIntPref("zen.view.window.scheme", theme);
|
||||
if (userChromeFile.exists() || userContentFile.exists()) {
|
||||
Services.prefs.setBoolPref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
|
||||
console.warn("ZenUIMigration: User stylesheets detected, enabling legacy stylesheets.");
|
||||
Services.prefs.setBoolPref(
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets",
|
||||
true
|
||||
);
|
||||
console.warn(
|
||||
"ZenUIMigration: User stylesheets detected, enabling legacy stylesheets."
|
||||
);
|
||||
this.shouldRestart = true;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +92,11 @@ class nsZenUIMigration {
|
||||
}
|
||||
|
||||
_migrateV3() {
|
||||
if (Services.prefs.getStringPref("zen.theme.accent-color", "").startsWith("system")) {
|
||||
if (
|
||||
Services.prefs
|
||||
.getStringPref("zen.theme.accent-color", "")
|
||||
.startsWith("system")
|
||||
) {
|
||||
Services.prefs.setStringPref("zen.theme.accent-color", "AccentColor");
|
||||
}
|
||||
}
|
||||
@@ -100,20 +117,23 @@ class nsZenUIMigration {
|
||||
lazy.SessionStore.promiseAllWindowsRestored.then(() => {
|
||||
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.setTimeout(async () => {
|
||||
const [title, message, learnMore, accept] = await win.document.l10n.formatMessages([
|
||||
"zen-window-sync-migration-dialog-title",
|
||||
"zen-window-sync-migration-dialog-message",
|
||||
"zen-window-sync-migration-dialog-learn-more",
|
||||
"zen-window-sync-migration-dialog-accept",
|
||||
]);
|
||||
const [title, message, learnMore, accept] =
|
||||
await win.document.l10n.formatMessages([
|
||||
"zen-window-sync-migration-dialog-title",
|
||||
"zen-window-sync-migration-dialog-message",
|
||||
"zen-window-sync-migration-dialog-learn-more",
|
||||
"zen-window-sync-migration-dialog-accept",
|
||||
]);
|
||||
|
||||
// buttonPressed will be 0 for cancel, 1 for "more info"
|
||||
let buttonPressed = Services.prompt.confirmEx(
|
||||
win,
|
||||
title.value,
|
||||
message.value,
|
||||
Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
|
||||
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_IS_STRING,
|
||||
Services.prompt.BUTTON_POS_0 *
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING +
|
||||
Services.prompt.BUTTON_POS_1 *
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING,
|
||||
learnMore.value,
|
||||
accept.value,
|
||||
null,
|
||||
@@ -122,7 +142,10 @@ class nsZenUIMigration {
|
||||
);
|
||||
// User has clicked on "Learn More"
|
||||
if (buttonPressed === 0) {
|
||||
win.openTrustedLinkIn("https://docs.zen-browser.app/user-manual/window-sync", "tab");
|
||||
win.openTrustedLinkIn(
|
||||
"https://docs.zen-browser.app/user-manual/window-sync",
|
||||
"tab"
|
||||
);
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user