diff options
Diffstat (limited to 'static/js/weabotxt.js')
-rw-r--r-- | static/js/weabotxt.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js index 91e2ab0..9cd407c 100644 --- a/static/js/weabotxt.js +++ b/static/js/weabotxt.js @@ -243,7 +243,7 @@ function togglepost(e) { } function applyTheme(){ - var newTheme = document.getElementById("themeSelector").value; + var newTheme = document.getElementById("styles").value; set_stylesheet(newTheme); } @@ -251,30 +251,31 @@ document.addEventListener("DOMContentLoaded", function() { if (localStorage.hasOwnProperty("weabot")) weabot = JSON.parse(localStorage.getItem("weabot")); else weabot = {"name":null,"email":null,"password":null}; - board = document.getElementsByName("board")[0].value; - - if(localStorage.getItem("shobon_time") != "false") { - changeDate(); - } + board = document.body.dataset.brd; var ids = document.getElementsByClassName("num"); - for(var i=0;i<ids.length;i++) ids[i].addEventListener('click', postClick); + for(var i=0;i<ids.length;i++) ids[i].addEventListener("click", postClick); var forms = document.getElementsByTagName("form"); for(var i=0;i<forms.length;i++) { if(forms[i].id.startsWith("postform")) setInputs(forms[i].id); } if (document.body.className == "mainpage") { - var themeSelector = document.getElementById("themeSelector"); - themeSelector.addEventListener("change", applyTheme, false); - themeSelector.value = localStorage.getItem(style_cookie); + var styleSelect = document.getElementById("styles"); + if (styleSelect) { + styleSelect.addEventListener("change", applyTheme, false); + styleSelect.value = localStorage.getItem(style_cookie); + } + + var where = document.getElementById(board); + if (where) where.className = "cur_brd"; } + if(localStorage.getItem("shobon_time") != "false") + changeDate(); + var dds = document.getElementsByClassName("del"); for(var i=0;i<dds.length;i++) { dds[i].children[1].addEventListener("click", deletePost); } - var where = document.getElementById(document.getElementsByName("board")[0].value); - if (where) where.className = "cur_brd"; - if (document.body.className == "threads") { var srt = document.getElementsByClassName("l_s"); for(var i=0;i<srt.length;i++){ srt[i].addEventListener("click",function(e){ e.preventDefault(); opcs.sort=this.textContent; listSort(); }); } @@ -294,7 +295,6 @@ document.addEventListener("DOMContentLoaded", function() { console.log(pps[i].dataset.unix); hidepost(pps[i].parentElement.parentElement); } - - pps[i].parentElement.addEventListener('dblclick', togglepost); + pps[i].parentElement.addEventListener("dblclick", togglepost); } });
\ No newline at end of file |