- Redesigned the main page with a modern look and feel. - Added search and filtering functionality for drills. - Implemented pagination for browsing drills. - Added the ability for users to mark drills as favorites.
21 lines
728 B
JavaScript
21 lines
728 B
JavaScript
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const themeSwitcher = document.getElementById('theme-switcher');
|
|
const body = document.body;
|
|
|
|
// Set the default theme to light if no preference is saved
|
|
const savedTheme = localStorage.getItem('theme') || 'light';
|
|
body.setAttribute('data-theme', savedTheme);
|
|
themeSwitcher.checked = savedTheme === 'dark';
|
|
|
|
themeSwitcher.addEventListener('change', function() {
|
|
if (this.checked) {
|
|
body.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
body.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
});
|
|
});
|