From 6d6906724ad6f527068d2c9530db7f358ba99407 Mon Sep 17 00:00:00 2001 From: felex67 Date: Sun, 12 Jul 2026 02:47:21 +0500 Subject: [PATCH] cookie bug fixed --- js/felexdev-theme-manager-minified.js | 7 +++++-- js/felexdev-theme-manager.js | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/js/felexdev-theme-manager-minified.js b/js/felexdev-theme-manager-minified.js index 442c418..9ad845c 100644 --- a/js/felexdev-theme-manager-minified.js +++ b/js/felexdev-theme-manager-minified.js @@ -1,10 +1,12 @@ /** * @file felexdev-theme-manager.js - * @description Миниицированная версия + * @description Модуль переключения тем. Рекомендации по применению: статические/генерируемые сайты. Минимизировано вручную. + * @description Singleton theme switcher module. Manualy minified version * @version 0.0.1 * @author felex67 (admin@felexdev.ru) * @license Apache2.0 * @warning Системная версия('auto') должна регистрироваться первой!!! + * @warning The system theme must be addet first!!! */ class ThemeManager { /** Cunfigurations */ @@ -26,7 +28,8 @@ class ThemeManager { add('auto',''); add('light',''); add('dark',''); - /* Темы добавлять здесь */ + /* Темы добавлять здесь. */ + /* Add new themes here. */ add('old-terminal',''); /* */ if(m.#i>=m.#t.length||m.#i<0){console.error(`${m.#c.gpfx}bottom-static: Invalid theme index loaded '${m.#i}'`);m.#i=0;m.#sv(m.#i)}if(m.#i)m.#cl.add(m.#t[m.#i].s);m.#b.innerHTML=m.#t[m.#i].i;m.#b.setAttribute('aria-current',m.#t[m.#i].n); diff --git a/js/felexdev-theme-manager.js b/js/felexdev-theme-manager.js index 3c27a6b..75f2833 100644 --- a/js/felexdev-theme-manager.js +++ b/js/felexdev-theme-manager.js @@ -1,10 +1,12 @@ /** * @file felexdev-theme-manager.js - * @description Минифицированная версия + * @description Модуль переключения тем. Рекомендации по применению: статические/генерируемые сайты + * @description Singleton theme switcher module * @version 0.0.1 * @author felex67 (admin@felexdev.ru) * @license Apache2.0 * @warning Системная версия('auto') должна регистрироваться первой!!! + * @warning The system theme must be addet first!!! */ class ThemeManager { /** @@ -116,7 +118,7 @@ class ThemeManager { console.error(this.#config.globalPrefix + '#sv-IIFE: localStorage не доступен, пробую cookie.'); try { 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) => { try { document.cookie = `${this.#config.themePrefix}=${i};max-age=${31536000};path=/`; @@ -128,7 +130,8 @@ class ThemeManager { } return save; })(); - static /* Инициализация тем */ { + static { + /* Инициализация тем */ let index = this.#index; let themes = this.#themes; let addTheme = this.#addTheme;