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

@ -285,9 +285,17 @@
const badge = document.createElement('div');
badge.id = 'spectator-badge';
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();
badge.innerHTML = '<i data-lucide="eye" style="width: 18px; height: 18px;"></i><span>НАБЛЮДАТЕЛЬ</span>';
document.body.appendChild(badge);
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(() => {
lucide.createIcons();
});
observer.observe(document.body, { childList: true, subtree: true });
// Обновляем иконки при изменении 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);
});
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();
}