summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html31
-rw-r--r--scripts/theme.js4
2 files changed, 27 insertions, 8 deletions
diff --git a/index.html b/index.html
index 78a5d53..690ea47 100644
--- a/index.html
+++ b/index.html
@@ -58,8 +58,8 @@
<script>
- var prev = Cookies.getCookie("prevAddr");
- var prevEl = document.getElementById("prev");
+ let prev = Cookies.getCookie("prevAddr");
+ let prevEl = document.getElementById("prev");
function hasAddr(url) {
let urls = prev.split(",");
@@ -151,15 +151,15 @@
Theme.set(e.target.getValue());
}
- var optionsEL = document.getElementById("options");
- var options = new Settings(Options);
+ let optionsEL = document.getElementById("options");
+ let options = new Settings(Options);
options.putSettings(optionsEL);
- var themeEL = document.getElementById("themes");
- var themeOpt = new Settings(ThemeOptions);
+ let themeEL = document.getElementById("themes");
+ let themeOpt = new Settings(ThemeOptions);
themeOpt.putSettings(themeEL);
- var themeSelector = MakeInput.selectInput(...BASE_THEMES);
+ let themeSelector = MakeInput.selectInput(...BASE_THEMES);
themeEL.appendChild(MakeInput.titleWrap(themeSelector, "Select Theme"));
themeSelector.addEventListener("change", changeTheme);
@@ -175,7 +175,7 @@
}
function remTheme() {
- var idx = themeSelector.getIndex();
+ let idx = themeSelector.getIndex();
if (idx < BASE_THEMES[0].length)
return;
@@ -192,6 +192,21 @@
//c.setAttribute("href", url);
window.location = "client.html?s=" + concat + "&g=-1";
}
+
+ let themeURL = Theme.get();
+ for(let i = 0; i < BASE_THEMES[0].length; i++) {
+ if(themeURL === BASE_THEMES[0][i]){
+ themeSelector.setIndex(i);
+ break;
+ }
+ }
+
+ for(let i = 0; i < Theme.UserThemes[1].length; i++) {
+ if(themeURL === Theme.UserThemes[1][i]){
+ themeSelector.setIndex(i + BASE_THEMES[0].length);
+ break;
+ }
+ }
</script>
</body>
diff --git a/scripts/theme.js b/scripts/theme.js
index 886a3a1..78f0149 100644
--- a/scripts/theme.js
+++ b/scripts/theme.js
@@ -40,6 +40,10 @@ class Theme{
Theme.theme.setAttribute("href", sheet + "?v=" + Date.now());
}
+ static get() {
+ return Cookies.getCookie("theme");
+ }
+
static setUserThemes() {
let out = "";
for (let i = 0; i < this.UserThemes[0].length; i++)