cookie bug fixed

This commit is contained in:
2026-07-12 02:47:21 +05:00
parent eb637d89bd
commit 6d6906724a
2 changed files with 11 additions and 5 deletions
File diff suppressed because one or more lines are too long
+6 -3
View File
@@ -1,10 +1,12 @@
/** /**
* @file felexdev-theme-manager.js * @file felexdev-theme-manager.js
* @description Минифицированная версия * @description Модуль переключения тем. Рекомендации по применению: статические/генерируемые сайты
* @description Singleton theme switcher module
* @version 0.0.1 * @version 0.0.1
* @author felex67 (admin@felexdev.ru) * @author felex67 (admin@felexdev.ru)
* @license Apache2.0 * @license Apache2.0
* @warning Системная версия('auto') должна регистрироваться первой!!! * @warning Системная версия('auto') должна регистрироваться первой!!!
* @warning The system theme must be addet first!!!
*/ */
class ThemeManager { class ThemeManager {
/** /**
@@ -116,7 +118,7 @@ class ThemeManager {
console.error(this.#config.globalPrefix + '#sv-IIFE: localStorage не доступен, пробую cookie.'); console.error(this.#config.globalPrefix + '#sv-IIFE: localStorage не доступен, пробую cookie.');
try { try {
let cookie = document.cookie.match(`${this.#config.themePrefix}\\s*=\\s*(\\d+)`); let cookie = document.cookie.match(`${this.#config.themePrefix}\\s*=\\s*(\\d+)`);
this.#index = cookie ? parseInt(c[1]) || 0 : 0; this.#index = cookie ? parseInt(cookie[1]) || 0 : 0;
save = (i) => { save = (i) => {
try { try {
document.cookie = `${this.#config.themePrefix}=${i};max-age=${31536000};path=/`; document.cookie = `${this.#config.themePrefix}=${i};max-age=${31536000};path=/`;
@@ -128,7 +130,8 @@ class ThemeManager {
} }
return save; return save;
})(); })();
static /* Инициализация тем */ { static {
/* Инициализация тем */
let index = this.#index; let index = this.#index;
let themes = this.#themes; let themes = this.#themes;
let addTheme = this.#addTheme; let addTheme = this.#addTheme;