mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 00:59:57 +02:00
fix(zenThemesImporter): fixed wrong preferences filtering
This commit is contained in:
parent
118de1ed15
commit
df1c0886d6
1 changed files with 13 additions and 9 deletions
|
@ -145,9 +145,13 @@ var gZenThemeImporter = new (class {
|
|||
const browser = this._getBrowser();
|
||||
|
||||
for (const theme of Object.values(await this.getThemes())) {
|
||||
const { preferences, areOldPreferences } = (await this._getThemePreferences(theme)).filter(
|
||||
({ type }) => type !== 'checkbox'
|
||||
);
|
||||
const { preferences, areOldPreferences } = await this._getThemePreferences(theme);
|
||||
|
||||
if (areOldPreferences) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const filteredPreferences = preferences.filter(({ type }) => type !== 'checkbox');
|
||||
const sanitizedName = `theme-${theme.name?.replaceAll(/\s/g, '-')?.replaceAll(/[^A-z_-]+/g, '')}`;
|
||||
|
||||
if (!theme.enabled) {
|
||||
|
@ -157,17 +161,17 @@ var gZenThemeImporter = new (class {
|
|||
element.remove();
|
||||
}
|
||||
|
||||
if (document.querySelector(':root').style.hasProperty(`--${sanitizedProperty}`)) {
|
||||
document.querySelector(':root').style.removeProperty(`--${sanitizedProperty}`);
|
||||
for (const { property } of filteredPreferences) {
|
||||
const sanitizedProperty = property?.replaceAll(/\./g, '-');
|
||||
|
||||
if (document.querySelector(':root').style.hasProperty(`--${sanitizedProperty}`)) {
|
||||
document.querySelector(':root').style.removeProperty(`--${sanitizedProperty}`);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (areOldPreferences) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const { property, type } of preferences) {
|
||||
const value = Services.prefs.getStringPref(property, '');
|
||||
const sanitizedProperty = property?.replaceAll(/\./g, '-');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue