diff options
Diffstat (limited to 'webcards/scripts/theme.js')
-rw-r--r-- | webcards/scripts/theme.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/webcards/scripts/theme.js b/webcards/scripts/theme.js index 8e69377..e93f5b5 100644 --- a/webcards/scripts/theme.js +++ b/webcards/scripts/theme.js @@ -1,24 +1,26 @@ -function Theme(){ - this.t = document.getElementById("theme"); -} +'use strict'; + +class Theme{ + static theme = document.getElementById("theme"); -Theme.prototype = { - init: function() { + static init() + { 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()); - }, + static restore() + { + Theme.init(); + Theme.theme.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now()); + } - set: function(sheet) { + static set(sheet) + { Cookies.setYearCookie("theme", sheet); - this.restore(); + Theme.restore(); } -}; +} -var GlobalTheme = new Theme(); -GlobalTheme.restore(); +Theme.restore();
\ No newline at end of file |