cookie bug fixed
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user