summaryrefslogtreecommitdiff
path: root/webcards/scripts/theme.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-05-17 13:15:41 -0400
committerKyle Gunger <corechg@gmail.com>2020-05-17 13:15:41 -0400
commitb48f0adccb11619680a47cac5fa9c68f638bd489 (patch)
tree9e75612c21ae9944b354afa13e2e94834e020e9c /webcards/scripts/theme.js
parentc9e2eee382df60bc7a058b56c804258848477d67 (diff)
[WebCards] Update from my local repos
Diffstat (limited to 'webcards/scripts/theme.js')
-rw-r--r--webcards/scripts/theme.js24
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();