aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar Choom 2022-12-13 03:13:00 -0300
committerLibravatar Choom 2022-12-13 04:01:36 -0300
commitffd2b09b25c61b285169557b93277e7c1476cd4f (patch)
treed9c33a81b834f60f8d368cbec9f78413d8b387c6 /static/js
parentdee4796015e4df0900615bedcd78b03a92b140c2 (diff)
downloadweabot-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')
-rw-r--r--static/js/home.js2
-rw-r--r--static/js/weabot.js42
-rw-r--r--static/js/weabotxt.js32
3 files changed, 74 insertions, 2 deletions
diff --git a/static/js/home.js b/static/js/home.js
index f670ce1..32ade31 100644
--- a/static/js/home.js
+++ b/static/js/home.js
@@ -1,4 +1,4 @@
-console.log("%c¡Es calidad BaI!", "font-size: 50px; font-weight: bold;");
+console.log("%c¡Es calidad BaI!", "font-size: 32px; font-weight: bold;");
function set_stylesheet(styletitle) {
opcs.style = styletitle;
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);
diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js
index fec445d..7bbddcb 100644
--- a/static/js/weabotxt.js
+++ b/static/js/weabotxt.js
@@ -230,6 +230,37 @@ document.addEventListener("DOMContentLoaded", function() {
}
}
+ if (document.body.clientWidth < 600 && head) {
+ 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);
+ }
+
+ 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 = "2em";
+ }
+
var forms = document.getElementsByTagName("form");
for (var i = 0; i < forms.length; i++) {
if (forms[i].id.startsWith("postform")) setInputs(forms[i].id);
@@ -277,6 +308,7 @@ document.addEventListener("dblclick", function(e) {
if (e.target.closest("h4")) {
e.preventDefault();
togglePost(e.target.closest("h4"));
+ window.getSelection().removeAllRanges();
return;
}
}, false); \ No newline at end of file