aboutsummaryrefslogtreecommitdiff
path: root/static/js/weabot.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/weabot.js')
-rw-r--r--static/js/weabot.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/static/js/weabot.js b/static/js/weabot.js
index da0ba83..0f27075 100644
--- a/static/js/weabot.js
+++ b/static/js/weabot.js
@@ -361,6 +361,11 @@ function catHidden() {
lbl.appendChild(shw); lbl.appendChild(document.createTextNode("]"));
}
+function applyTheme(){
+ var newTheme = document.getElementById("styles").value;
+ set_stylesheet(newTheme);
+}
+
document.addEventListener("DOMContentLoaded", function(e) {
checkhighlight();
if (localStorage.hasOwnProperty("weabot")) weabot = JSON.parse(localStorage.getItem("weabot"));
@@ -414,15 +419,11 @@ document.addEventListener("DOMContentLoaded", function(e) {
for(var i=0;i<tts.length;i++) {
tts[i].addEventListener('click', expandimg);
}
- var sss = document.getElementsByClassName("ss");
- for(var i=0;i<sss.length;i++) {
- sss[i].addEventListener('click', function() {
- var cur = document.getElementById("cur_stl");
- set_stylesheet(this.textContent);
- if (cur) cur.removeAttribute("id");
- this.id = "cur_stl";
- });
- if (sss[i].innerText == localStorage.getItem(style_cookie)) sss[i].id = "cur_stl";
+
+ var styleSelect = document.getElementById("styles");
+ if (styleSelect) {
+ styleSelect.addEventListener("change", applyTheme, false);
+ styleSelect.value = localStorage.getItem(style_cookie);
}
if (document.getElementById(board))