diff options
author | Kyle Gunger <corechg@gmail.com> | 2020-05-17 13:15:41 -0400 |
---|---|---|
committer | Kyle Gunger <corechg@gmail.com> | 2020-05-17 13:15:41 -0400 |
commit | b48f0adccb11619680a47cac5fa9c68f638bd489 (patch) | |
tree | 9e75612c21ae9944b354afa13e2e94834e020e9c /webcards/scripts/theme.js | |
parent | c9e2eee382df60bc7a058b56c804258848477d67 (diff) |
[WebCards] Update from my local repos
Diffstat (limited to 'webcards/scripts/theme.js')
-rw-r--r-- | webcards/scripts/theme.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/webcards/scripts/theme.js b/webcards/scripts/theme.js new file mode 100644 index 0000000..8e69377 --- /dev/null +++ b/webcards/scripts/theme.js @@ -0,0 +1,24 @@ +function Theme(){ + this.t = document.getElementById("theme"); +} + +Theme.prototype = { + init: function() { + if(Cookies.getCookie("theme") == ""){ + Cookies.setYearCookie("theme", "styles/themes/colors-base.css"); + } + }, + + restore: function() { + this.init(); + this.t.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now()); + }, + + set: function(sheet) { + Cookies.setYearCookie("theme", sheet); + this.restore(); + } +}; + +var GlobalTheme = new Theme(); +GlobalTheme.restore(); |