diff options
Diffstat (limited to 'static/js/weabot.js')
-rw-r--r-- | static/js/weabot.js | 11 |
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"); |