Missing js file in myShaarly plugin

This commit is contained in:
Knah Tsaeb 2024-09-16 10:38:00 +02:00
parent be68590e2e
commit 9603ff163c
2 changed files with 17 additions and 0 deletions

1
.gitignore vendored
View file

@ -35,6 +35,7 @@ plugins/*
!default_colors !default_colors
!demo_plugin !demo_plugin
!isso !isso
!myShaarli
!piwik !piwik
!playvideos !playvideos
!pubsubhubbub !pubsubhubbub

View file

@ -0,0 +1,16 @@
function switchTheme(e) {
let actualTheme = document.documentElement.getAttribute('data-theme');
if (actualTheme === null || actualTheme === 'light') {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
return false;
}
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
if (currentTheme) {
document.documentElement.setAttribute('data-theme', currentTheme);
}