From dbaf69557c0d6e648120b068fec1920b9391a24a Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 18 Sep 2020 12:19:44 -0400 Subject: Update from local repo --- scripts/theme.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/theme.js (limited to 'scripts/theme.js') 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 -- cgit v1.2.3