This commit is contained in:
2026-01-27 23:05:14 +03:00
parent 761a3f6d31
commit 866ddf9a1a
2 changed files with 63 additions and 13 deletions

View File

@ -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.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>'; badge.innerHTML = '<i data-lucide="eye" style="width: 18px; height: 18px;"></i><span>НАБЛЮДАТЕЛЬ</span>';
document.body.appendChild(badge); 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 { } else {
const spectatorBadge = $('spectator-badge'); const spectatorBadge = $('spectator-badge');
@ -371,7 +379,13 @@
// Обновляем иконки Lucide после рендеринга // Обновляем иконки Lucide после рендеринга
if (typeof lucide !== 'undefined') { 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 после создания кнопок // Обновляем иконки Lucide после создания кнопок
if (typeof lucide !== 'undefined') { 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', () => { $('btn-instructions')?.addEventListener('click', () => {
@ -2786,16 +2806,36 @@
// Инициализация Lucide Icons после загрузки DOM // Инициализация Lucide Icons после загрузки DOM
if (typeof lucide !== 'undefined') { if (typeof lucide !== 'undefined') {
lucide.createIcons(); lucide.createIcons();
// Обновляем иконки при изменении DOM // Обновляем иконки при изменении DOM с debounce, чтобы избежать бесконечного цикла
const observer = new MutationObserver(() => { if (!window.lucideObserver) {
let iconUpdateTimer = null;
window.lucideObserver = new MutationObserver(() => {
// Отменяем предыдущий таймер
if (iconUpdateTimer) clearTimeout(iconUpdateTimer);
// Устанавливаем новый таймер с задержкой
iconUpdateTimer = setTimeout(() => {
try {
lucide.createIcons(); 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 { } else {
init(); 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) { if (window.Music) {
window.Music.init(); window.Music.init();
} }

View File

@ -372,9 +372,19 @@
if (typeof lucide !== 'undefined') { if (typeof lucide !== 'undefined') {
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
lucide.createIcons(); lucide.createIcons();
// Обновляем иконки при изменении DOM // Обновляем иконки при изменении DOM с debounce, чтобы избежать бесконечного цикла
let iconUpdateTimer = null;
const observer = new MutationObserver(() => { const observer = new MutationObserver(() => {
// Отменяем предыдущий таймер
if (iconUpdateTimer) clearTimeout(iconUpdateTimer);
// Устанавливаем новый таймер с задержкой
iconUpdateTimer = setTimeout(() => {
try {
lucide.createIcons(); lucide.createIcons();
} catch (e) {
console.warn('Error updating Lucide icons:', e);
}
}, 200);
}); });
observer.observe(document.body, { childList: true, subtree: true }); observer.observe(document.body, { childList: true, subtree: true });
}); });