Missing js file in myShaarly plugin
This commit is contained in:
parent
be68590e2e
commit
9603ff163c
2 changed files with 17 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -35,6 +35,7 @@ plugins/*
|
||||||
!default_colors
|
!default_colors
|
||||||
!demo_plugin
|
!demo_plugin
|
||||||
!isso
|
!isso
|
||||||
|
!myShaarli
|
||||||
!piwik
|
!piwik
|
||||||
!playvideos
|
!playvideos
|
||||||
!pubsubhubbub
|
!pubsubhubbub
|
||||||
|
|
16
plugins/myShaarli/myShaarli.js
Normal file
16
plugins/myShaarli/myShaarli.js
Normal 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);
|
||||||
|
}
|
Loading…
Reference in a new issue