diff options
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(); |