aboutsummaryrefslogtreecommitdiff
path: root/static/js/weabot.js
diff options
context:
space:
mode:
authorLibravatar Choom 2023-01-28 00:52:56 -0300
committerLibravatar Choom 2023-02-02 00:39:27 -0300
commit081ddc03aef7becc3b084a9079a2574fd3e3b49b (patch)
treea6ca793a0c21917d3774778c0a14f65a8c678113 /static/js/weabot.js
parentd0d6b8ebff31d2306a040dc9c53f9e5e7a0ec7a0 (diff)
downloadweabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.tar.gz
weabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.tar.xz
weabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.zip
userconf
Diffstat (limited to 'static/js/weabot.js')
-rw-r--r--static/js/weabot.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/static/js/weabot.js b/static/js/weabot.js
index afe65c8..c4a73b5 100644
--- a/static/js/weabot.js
+++ b/static/js/weabot.js
@@ -2,7 +2,12 @@ var style_cookie = "weabot_style_ib";
if (localStorage.hasOwnProperty(style_cookie)) {
var css = document.getElementById("css");
if (css) {
- css.href = "/static/css/" + localStorage.getItem(style_cookie).toLowerCase() + ".css";
+ var style = localStorage.getItem(style_cookie).trim().toLowerCase();
+ if (style != "") {
+ css.href = "/static/css/" + style + ".css";
+ } else {
+ localStorage.removeItem(style_cookie);
+ }
}
}
@@ -277,7 +282,9 @@ document.addEventListener("DOMContentLoaded", function(e) {
if (document.getElementById("postform")) {
setInputs("postform");
- postform.file.addEventListener("change", filePreview);
+ if (postform.file) {
+ postform.file.addEventListener("change", filePreview);
+ }
}
var del = document.getElementById("delform");