summaryrefslogtreecommitdiff
path: root/webcards/scripts/theme.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-09-15 20:03:52 -0400
committerKyle Gunger <corechg@gmail.com>2020-09-15 20:03:52 -0400
commit2ce432034eb35f763182de03fb7b42d2a07afc4b (patch)
treee57d7bc40d12c32c79f1f16ba669a5426ae80525 /webcards/scripts/theme.js
parent20201f77b5cf5cbb1c70b1cc51c4108d620a3202 (diff)
Webcards update from local git server
Diffstat (limited to 'webcards/scripts/theme.js')
-rw-r--r--webcards/scripts/theme.js32
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