diff --git a/templates/index.html b/templates/index.html index 5df7a12..53dbd73 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,11 +8,38 @@ @@ -171,6 +280,7 @@

АйТи-Депо логотип Органайзер АйТи-Депо +

@@ -254,6 +364,57 @@ 'rdp': 'rdp://' }; + // Проверка и применение сохранённой темы + document.addEventListener('DOMContentLoaded', () => { + const savedTheme = localStorage.getItem('theme'); + if (savedTheme === 'dark') { + document.body.classList.add('dark-theme'); + document.getElementById('installs-container').classList.add('dark-theme'); + document.getElementById('tree-container').classList.add('dark-theme'); + document.getElementById('notes-panel').classList.add('dark-theme'); + document.getElementById('note-modal').classList.add('dark-theme'); + document.getElementById('search-container').classList.add('dark-theme'); + document.getElementById('import-label').classList.add('dark-theme'); + document.querySelector('.theme-toggle').classList.add('dark-theme'); + document.querySelector('.theme-toggle').textContent = 'Светлая тема'; + } + }); + + function toggleTheme() { + const body = document.body; + const installsContainer = document.getElementById('installs-container'); + const treeContainer = document.getElementById('tree-container'); + const notesPanel = document.getElementById('notes-panel'); + const noteModal = document.getElementById('note-modal'); + const searchContainer = document.getElementById('search-container'); + const importLabel = document.getElementById('import-label'); + const themeToggle = document.querySelector('.theme-toggle'); + + if (body.classList.contains('dark-theme')) { + body.classList.remove('dark-theme'); + installsContainer.classList.remove('dark-theme'); + treeContainer.classList.remove('dark-theme'); + notesPanel.classList.remove('dark-theme'); + noteModal.classList.remove('dark-theme'); + searchContainer.classList.remove('dark-theme'); + importLabel.classList.remove('dark-theme'); + themeToggle.classList.remove('dark-theme'); + themeToggle.textContent = 'Темная тема'; + localStorage.setItem('theme', 'light'); + } else { + body.classList.add('dark-theme'); + installsContainer.classList.add('dark-theme'); + treeContainer.classList.add('dark-theme'); + notesPanel.classList.add('dark-theme'); + noteModal.classList.add('dark-theme'); + searchContainer.classList.add('dark-theme'); + importLabel.classList.add('dark-theme'); + themeToggle.classList.add('dark-theme'); + themeToggle.textContent = 'Светлая тема'; + localStorage.setItem('theme', 'dark'); + } + } + $(document).ready(function () { // Загружаем все папки и записи при инициализации loadFolders(); @@ -280,7 +441,7 @@ cb(treeData); // Автоматически выбираем папку "Несортированные" после загрузки дерева - const unsortedFolder = sortedFolders.find(f => f.name === '00.Несортированные'); + const unsortedFolder = sortedFolders.find(f => f.name === 'Несортированные'); if (unsortedFolder) { setTimeout(() => { $('#folder-tree').jstree('select_node', unsortedFolder.id);