Browse Source

Minor optimization

master
KaKi87 3 months ago
parent
commit
1f11cccf47
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      public/assets/js/main.js

+ 4
- 2
public/assets/js/main.js View File

@@ -8,15 +8,17 @@ setInterval(() => document.querySelectorAll('.loading-dots').forEach(el => el.te
/*
Dark mode
*/
const darkButton = document.querySelector('.dark');
const toggleDark = () => {
// Toggle UIkit properties
['uk-light', 'uk-background-secondary'].forEach(Class => [document.body, document.querySelector('.uk-modal-body')].forEach(el => el.classList.toggle(Class)));
// Toggle dark button text
let darkButton = document.querySelector('.dark');
darkButton.textContent = darkButton.textContent === 'Dark' ? 'White' : 'Dark';
};
document.querySelector('.dark').onclick = () => {
darkButton.onclick = () => {
// Save white/dark state
if(Cookies.get('dark') === 'true'){
Cookies.set('dark', 'false');


Loading…
Cancel
Save