1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 05:59:58 +02:00

New welcome page and logo

This commit is contained in:
mr. M 2024-12-07 21:12:01 +01:00
parent acdca8320b
commit 5f512db55f
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
54 changed files with 299 additions and 68 deletions

View file

@ -485,6 +485,9 @@ var gZenMarketplaceManager = {
},
};
const kZenExtendedSidebar = 'zen.view.sidebar-expanded';
const kZenSingleToolbar = 'zen.view.use-single-toolbar';
var gZenLooksAndFeel = {
init() {
if (this.__hasInitialized) return;
@ -495,12 +498,57 @@ var gZenLooksAndFeel = {
gZenMarketplaceManager.init();
var onPreferColorSchemeChange = this.onPreferColorSchemeChange.bind(this);
window.matchMedia('(prefers-color-scheme: dark)').addListener(onPreferColorSchemeChange);
for (const pref of [kZenExtendedSidebar, kZenSingleToolbar]) {
Services.prefs.addObserver(pref, this);
}
this.onPreferColorSchemeChange();
window.addEventListener('unload', () => {
window.matchMedia('(prefers-color-scheme: dark)').removeListener(onPreferColorSchemeChange);
for (const pref of [kZenExtendedSidebar, kZenSingleToolbar]) {
Services.prefs.removeObserver(pref, this);
}
});
this.setDarkThemeListener();
this.setCompactModeStyle();
this.applySidebarLayout();
},
observe(subject, topic, data) {
this.applySidebarLayout();
},
applySidebarLayout() {
const isSingleToolbar = Services.prefs.getBoolPref(kZenSingleToolbar);
const isExtendedSidebar = Services.prefs.getBoolPref(kZenExtendedSidebar);
for (const layout of document.getElementById('zenLayoutList').children) {
layout.classList.remove('selected');
if (layout.getAttribute('layout') == 'single' && isSingleToolbar) {
layout.classList.add('selected');
} else if (layout.getAttribute('layout') == 'multiple' && !isSingleToolbar && isExtendedSidebar) {
layout.classList.add('selected');
} else if (layout.getAttribute('layout') == 'collapsed' && !isExtendedSidebar) {
layout.classList.add('selected');
}
}
if (this.__hasInitializedLayout) return;
this.__hasInitializedLayout = true;
for (const layout of document.getElementById('zenLayoutList').children) {
layout.addEventListener('click', () => {
if (layout.hasAttribute('disabled')) {
return;
}
for (const el of document.getElementById('zenLayoutList').children) {
el.classList.remove('selected');
}
layout.classList.add('selected');
Services.prefs.setBoolPref(kZenExtendedSidebar, layout.getAttribute('layout') != 'collapsed');
Services.prefs.setBoolPref(kZenSingleToolbar, layout.getAttribute('layout') == 'single');
});
}
},
onPreferColorSchemeChange(event) {