diff options
author | Kyle Gunger <corechg@gmail.com> | 2020-09-18 12:19:44 -0400 |
---|---|---|
committer | Kyle Gunger <corechg@gmail.com> | 2020-09-18 12:19:44 -0400 |
commit | dbaf69557c0d6e648120b068fec1920b9391a24a (patch) | |
tree | f31f7b956455b1243d344d0c54d5b04e9e80fb3f /scripts/theme.js | |
parent | e5515d3e1603339b4957421c9494ca619490a03d (diff) |
Update from local repo
Diffstat (limited to 'scripts/theme.js')
-rw-r--r-- | scripts/theme.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/theme.js b/scripts/theme.js new file mode 100644 index 0000000..e93f5b5 --- /dev/null +++ b/scripts/theme.js @@ -0,0 +1,26 @@ +'use strict'; + +class Theme{ + static theme = document.getElementById("theme"); + + static init() + { + if(Cookies.getCookie("theme") == ""){ + Cookies.setYearCookie("theme", "styles/themes/colors-base.css"); + } + } + + static restore() + { + Theme.init(); + Theme.theme.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now()); + } + + static set(sheet) + { + Cookies.setYearCookie("theme", sheet); + Theme.restore(); + } +} + +Theme.restore();
\ No newline at end of file |