summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html8
-rw-r--r--scripts/cookie.js2
-rw-r--r--scripts/light-dark.js8
-rw-r--r--scripts/theme.js20
4 files changed, 21 insertions, 17 deletions
diff --git a/index.html b/index.html
index 6c4325f..3dc7f46 100644
--- a/index.html
+++ b/index.html
@@ -12,12 +12,12 @@
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
- <link rel="stylesheet" href="/styles/style.css"/>
+ <link rel="stylesheet" href="styles/style.css"/>
<link rel="stylesheet" id="theme"/>
- <script defer="true" src="/scripts/cookie.js"></script>
- <script defer="true" src="/scripts/theme.js"></script>
- <script defer="true" src="/scripts/light-dark.js"></script>
+ <script defer="true" src="scripts/cookie.js"></script>
+ <script defer="true" src="scripts/theme.js"></script>
+ <script defer="true" src="scripts/light-dark.js"></script>
<title>CircleShift</title>
</head>
diff --git a/scripts/cookie.js b/scripts/cookie.js
index 9c88963..44992a2 100644
--- a/scripts/cookie.js
+++ b/scripts/cookie.js
@@ -34,3 +34,5 @@ class Cookies {
Cookies.setCookie(name, "", {SameSite: "Strict", expires: date.toUTCString()});
}
}
+
+window.Cookies = Cookies; \ No newline at end of file
diff --git a/scripts/light-dark.js b/scripts/light-dark.js
index 643f8b7..5f0b4d4 100644
--- a/scripts/light-dark.js
+++ b/scripts/light-dark.js
@@ -4,17 +4,17 @@
var lightDark = document.getElementById("light-dark");
function setButtonText() {
- if(Theme.get() == BASE_THEMES[0][0])
+ if(window.Theme.get() == BASE_THEMES[0][0])
lightDark.innerText = BASE_THEMES[1][1] + " Mode";
else
lightDark.innerText = BASE_THEMES[1][0] + " Mode";
}
function changeTheme(e) {
- if(Theme.get() == BASE_THEMES[0][0])
- Theme.set(BASE_THEMES[0][1]);
+ if(window.Theme.get() == BASE_THEMES[0][0])
+ window.Theme.set(BASE_THEMES[0][1]);
else
- Theme.set(BASE_THEMES[0][0]);
+ window.Theme.set(BASE_THEMES[0][0]);
setButtonText();
}
diff --git a/scripts/theme.js b/scripts/theme.js
index 1840e02..06d6811 100644
--- a/scripts/theme.js
+++ b/scripts/theme.js
@@ -1,8 +1,8 @@
'use strict';
const BASE_THEMES = [[
- "/styles/themes/colors-base.css",
- "/styles/themes/colors-dark.css"
+ "styles/themes/colors-base.css",
+ "styles/themes/colors-dark.css"
],
[
"Light",
@@ -17,7 +17,7 @@ class Theme{
static init()
{
- let uth = Cookies.getCookie("userThemes-" + APP_NAME).split(',');
+ let uth = window.Cookies.getCookie("userThemes-" + APP_NAME).split(',');
for (let i = 1; i < uth.length; i += 2)
{
@@ -25,8 +25,8 @@ class Theme{
this.UserThemes[1].push(uth[i]);
}
- if(Cookies.getCookie("theme-" + APP_NAME) == ""){
- Cookies.setYearCookie("theme-" + APP_NAME, BASE_THEMES[0][0]);
+ if(window.Cookies.getCookie("theme-" + APP_NAME) == ""){
+ window.Cookies.setYearCookie("theme-" + APP_NAME, BASE_THEMES[0][0]);
}
Theme.theme.setAttribute("href", Cookies.getCookie("theme-" + APP_NAME) + "?v=" + Date.now());
@@ -34,12 +34,12 @@ class Theme{
static set(sheet)
{
- Cookies.setYearCookie("theme-" + APP_NAME, sheet);
+ window.Cookies.setYearCookie("theme-" + APP_NAME, sheet);
Theme.theme.setAttribute("href", sheet + "?v=" + Date.now());
}
static get() {
- return Cookies.getCookie("theme-" + APP_NAME);
+ return window.Cookies.getCookie("theme-" + APP_NAME);
}
static setUserThemes() {
@@ -52,7 +52,7 @@ class Theme{
out = out + this.UserThemes[0][i] + "," + this.UserThemes[1][i];
}
- Cookies.setYearCookie("userThemes-" + APP_NAME, out);
+ window.Cookies.setYearCookie("userThemes-" + APP_NAME, out);
}
static removeUserTheme (index) {
@@ -68,4 +68,6 @@ class Theme{
}
}
-Theme.init(); \ No newline at end of file
+window.Theme = Theme;
+
+window.Theme.init(); \ No newline at end of file