123
This commit is contained in:
@ -287,7 +287,15 @@
|
||||
badge.style.cssText = 'position: fixed; top: 1rem; right: 1rem; background: rgba(212,168,75,0.9); color: #000; padding: 0.5rem 1rem; border-radius: 8px; font-weight: 700; z-index: 200; display: flex; align-items: center; gap: 0.5rem;';
|
||||
badge.innerHTML = '<i data-lucide="eye" style="width: 18px; height: 18px;"></i><span>НАБЛЮДАТЕЛЬ</span>';
|
||||
document.body.appendChild(badge);
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
if (typeof lucide !== 'undefined') {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const spectatorBadge = $('spectator-badge');
|
||||
@ -371,7 +379,13 @@
|
||||
|
||||
// Обновляем иконки Lucide после рендеринга
|
||||
if (typeof lucide !== 'undefined') {
|
||||
setTimeout(() => lucide.createIcons(), 100);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2200,7 +2214,13 @@
|
||||
|
||||
// Обновляем иконки Lucide после создания кнопок
|
||||
if (typeof lucide !== 'undefined') {
|
||||
setTimeout(() => lucide.createIcons(), 100);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
$('btn-instructions')?.addEventListener('click', () => {
|
||||
@ -2786,16 +2806,36 @@
|
||||
// Инициализация Lucide Icons после загрузки DOM
|
||||
if (typeof lucide !== 'undefined') {
|
||||
lucide.createIcons();
|
||||
// Обновляем иконки при изменении DOM
|
||||
const observer = new MutationObserver(() => {
|
||||
// Обновляем иконки при изменении DOM с debounce, чтобы избежать бесконечного цикла
|
||||
if (!window.lucideObserver) {
|
||||
let iconUpdateTimer = null;
|
||||
window.lucideObserver = new MutationObserver(() => {
|
||||
// Отменяем предыдущий таймер
|
||||
if (iconUpdateTimer) clearTimeout(iconUpdateTimer);
|
||||
// Устанавливаем новый таймер с задержкой
|
||||
iconUpdateTimer = setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
window.lucideObserver.observe(document.body, { childList: true, subtree: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init();
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
if (typeof lucide !== 'undefined') {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
if (window.Music) {
|
||||
window.Music.init();
|
||||
}
|
||||
|
||||
@ -372,9 +372,19 @@
|
||||
if (typeof lucide !== 'undefined') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
lucide.createIcons();
|
||||
// Обновляем иконки при изменении DOM
|
||||
// Обновляем иконки при изменении DOM с debounce, чтобы избежать бесконечного цикла
|
||||
let iconUpdateTimer = null;
|
||||
const observer = new MutationObserver(() => {
|
||||
// Отменяем предыдущий таймер
|
||||
if (iconUpdateTimer) clearTimeout(iconUpdateTimer);
|
||||
// Устанавливаем новый таймер с задержкой
|
||||
iconUpdateTimer = setTimeout(() => {
|
||||
try {
|
||||
lucide.createIcons();
|
||||
} catch (e) {
|
||||
console.warn('Error updating Lucide icons:', e);
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user