Тема оформления: переключатель дня, ночи и авто-режима
This commit is contained in:
+22
-4
@@ -174,10 +174,13 @@ function buildSidebar(active) {
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="bottom-actions">
|
||||
<a href="/" data-nav="home" title="Перейти на главную страницу">
|
||||
<i data-lucide="home"></i>
|
||||
<span>На главную</span>
|
||||
</a>
|
||||
<div class="home-row">
|
||||
<a href="/" data-nav="home" title="Перейти на главную страницу">
|
||||
<i data-lucide="home"></i>
|
||||
<span>На главную</span>
|
||||
</a>
|
||||
<button type="button" class="theme-toggle" id="themeToggle" data-theme-toggle title="Тема оформления" aria-label="Тема оформления"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-footer">
|
||||
<a class="logout-btn" href="#" data-action="logout" title="Выйти из аккаунта">
|
||||
@@ -188,6 +191,7 @@ function buildSidebar(active) {
|
||||
</div>
|
||||
</div>`;
|
||||
renderIcons();
|
||||
syncThemeToggle();
|
||||
loadVersion();
|
||||
loadBrand();
|
||||
initNotifications();
|
||||
@@ -546,6 +550,18 @@ function renderIcons() {
|
||||
}
|
||||
}
|
||||
|
||||
function syncThemeToggle() {
|
||||
const btn = document.getElementById('themeToggle');
|
||||
if (!btn || !window.WhatIDoTheme) return;
|
||||
const mode = WhatIDoTheme.get();
|
||||
btn.innerHTML = `<i data-lucide="${WhatIDoTheme.icons[mode]}"></i>`;
|
||||
btn.title = 'Тема оформления · нажмите, чтобы переключить';
|
||||
btn.setAttribute('aria-label', btn.title);
|
||||
renderIcons();
|
||||
}
|
||||
|
||||
document.addEventListener('whatido:themechange', () => { syncThemeToggle(); });
|
||||
|
||||
function showToast(msg, isError) {
|
||||
const t = document.getElementById('toast');
|
||||
if (!t) return;
|
||||
@@ -1203,6 +1219,8 @@ function renderPager(el, page, totalPages, onPage) {
|
||||
}
|
||||
|
||||
document.addEventListener('click', e => {
|
||||
const themeBtn = e.target.closest('[data-theme-toggle]');
|
||||
if (themeBtn) { e.preventDefault(); if (window.WhatIDoTheme) WhatIDoTheme.next(); return; }
|
||||
const imgEl = e.target.closest('[data-img]');
|
||||
if (imgEl) { e.preventDefault(); showImg(imgEl.dataset.img); return; }
|
||||
const out = e.target.closest('[data-action="logout"]');
|
||||
|
||||
Reference in New Issue
Block a user