summaryrefslogtreecommitdiff
path: root/scripts/theme.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/theme.js')
-rw-r--r--scripts/theme.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/theme.js b/scripts/theme.js
new file mode 100644
index 0000000..e93f5b5
--- /dev/null
+++ b/scripts/theme.js
@@ -0,0 +1,26 @@
+'use strict';
+
+class Theme{
+ static theme = document.getElementById("theme");
+
+ static init()
+ {
+ if(Cookies.getCookie("theme") == ""){
+ Cookies.setYearCookie("theme", "styles/themes/colors-base.css");
+ }
+ }
+
+ static restore()
+ {
+ Theme.init();
+ Theme.theme.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now());
+ }
+
+ static set(sheet)
+ {
+ Cookies.setYearCookie("theme", sheet);
+ Theme.restore();
+ }
+}
+
+Theme.restore(); \ No newline at end of file