updates
This commit is contained in:
20
themes/default/static/js/theme.js
Normal file
20
themes/default/static/js/theme.js
Normal file
@@ -0,0 +1,20 @@
|
||||
console.log('Default theme loaded.')
|
||||
|
||||
const saved_color_theme = localStorage.getItem('saved_color_theme');
|
||||
|
||||
if (saved_color_theme) {
|
||||
document.documentElement.setAttribute('data-bs-theme', saved_color_theme);
|
||||
}
|
||||
|
||||
document.getElementById("categories_toggle").onclick = function() {
|
||||
categories_menu_item = document.getElementById("categories_menu");
|
||||
categories_menu_item.style.display = categories_menu_item.style.display === "none" ? "block" : "none"
|
||||
}
|
||||
|
||||
document.getElementById("dark_theme_toggle").onclick = function() {
|
||||
html = document.documentElement;
|
||||
current_color_theme = html.getAttribute('data-bs-theme');
|
||||
new_color_theme = current_color_theme === 'dark' ? 'light' : 'dark';
|
||||
html.setAttribute('data-bs-theme', new_color_theme);
|
||||
localStorage.setItem('saved_color_theme', new_color_theme);
|
||||
}
|
||||
Reference in New Issue
Block a user