From 2ce432034eb35f763182de03fb7b42d2a07afc4b Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Tue, 15 Sep 2020 20:03:52 -0400 Subject: Webcards update from local git server --- webcards/scripts/theme.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'webcards/scripts/theme.js') 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 -- cgit v1.2.3