aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
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