docs: add comprehensive JSDoc comments to all JavaScript functions
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
// Theme toggle functionality
|
||||
/**
|
||||
* LogBoard+ - Скрипт страницы ошибок
|
||||
* Автор: Сергей Антропов
|
||||
* Сайт: https://devops.org.ru
|
||||
*/
|
||||
|
||||
/**
|
||||
* Переключает тему между светлой и темной
|
||||
* Обновляет атрибут data-theme и сохраняет выбор в localStorage
|
||||
*/
|
||||
function toggleTheme() {
|
||||
const html = document.documentElement;
|
||||
const currentTheme = html.getAttribute('data-theme');
|
||||
@@ -14,7 +23,10 @@ function toggleTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize theme on page load
|
||||
/**
|
||||
* Инициализация темы при загрузке страницы
|
||||
* Загружает сохраненную тему из localStorage
|
||||
*/
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const savedTheme = localStorage.getItem('lb_theme') || 'dark';
|
||||
document.documentElement.setAttribute('data-theme', savedTheme);
|
||||
@@ -26,7 +38,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Keyboard shortcut for theme toggle (Ctrl+T)
|
||||
/**
|
||||
* Горячая клавиша для переключения темы (Ctrl+T)
|
||||
*/
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.ctrlKey && e.key === 't') {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user