diff options
author | Choom | 2022-12-13 03:13:00 -0300 |
---|---|---|
committer | Choom | 2022-12-13 04:01:36 -0300 |
commit | ffd2b09b25c61b285169557b93277e7c1476cd4f (patch) | |
tree | d9c33a81b834f60f8d368cbec9f78413d8b387c6 /static/js/weabot.js | |
parent | dee4796015e4df0900615bedcd78b03a92b140c2 (diff) | |
download | weabot-ffd2b09b25c61b285169557b93277e7c1476cd4f.tar.gz weabot-ffd2b09b25c61b285169557b93277e7c1476cd4f.tar.xz weabot-ffd2b09b25c61b285169557b93277e7c1476cd4f.zip |
Barra superior para móviles
Barra superior para móviles
Barra superior para móviles
Diffstat (limited to 'static/js/weabot.js')
-rw-r--r-- | static/js/weabot.js | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/static/js/weabot.js b/static/js/weabot.js index 3371437..1bab0f6 100644 --- a/static/js/weabot.js +++ b/static/js/weabot.js @@ -266,7 +266,8 @@ document.addEventListener("DOMContentLoaded", function(e) { weabot = { name: null, email: null, password: null }; } - var a = document.getElementById("main_nav").getElementsByTagName("a"); + var head = document.getElementById("main_nav"); + var a = head.getElementsByTagName("a"); for (var i = 0; i < a.length; i++) { if (a[i].getAttribute("href") == "/" + board + "/") { a[i].className = "cur_brd"; @@ -274,6 +275,45 @@ document.addEventListener("DOMContentLoaded", function(e) { } } + if (document.body.clientWidth < 600) { + var navlink = head.getElementsByTagName("a"); + + var sel = document.createElement("select"); + sel.id = head.id + "_sel"; + sel.addEventListener("change", function(e){ + window.location.href = this.value; + }); + + for (var i=1; i<navlink.length; i++) { + var c = document.createElement("option"); + c.text = navlink[i].textContent; + c.value = navlink[i].href; + if (navlink[i].className == "cur_brd") { + c.selected = true; + } + sel.options.add(c); + } + + var styles = document.getElementById("styles"); + if (styles) { + var li = document.createElement("li"); + li.appendChild(document.createTextNode("Estilo: ")); + li.appendChild(styles); + document.getElementById("rules").childNodes[1].appendChild(li); + } + + head.textContent = "" + var home = document.createElement("a"); + home.text = "Bienvenido a Internet"; + home.href = "/home.html"; + head.appendChild(home); + head.appendChild(document.createTextNode(" ★ ")); + head.appendChild(sel); + + head.className = "mob"; + document.body.style.marginTop = "1em"; + } + for (var i=0; i<2; i++) { var type = "pt".charAt(i); var hidp = localStorage.getItem("hid-" + type + "-" + board); |