aboutsummaryrefslogtreecommitdiff
path: root/static/js/shobon.js
diff options
context:
space:
mode:
authorLibravatar junk 2021-03-27 20:20:28 -0300
committerLibravatar junk 2021-03-27 20:53:56 -0300
commit9b039e42df4eefb7971a2cfa19bce260ab4ef08f (patch)
tree5ad65f7f0dabaa439745daeae5a7dd374c8a1b03 /static/js/shobon.js
parent0e86988ba9099072dcd2af5142f8f4e988908e9b (diff)
downloadweabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.tar.gz
weabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.tar.xz
weabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.zip
Arreglando diseño para móviles
Diffstat (limited to 'static/js/shobon.js')
-rw-r--r--static/js/shobon.js98
1 files changed, 27 insertions, 71 deletions
diff --git a/static/js/shobon.js b/static/js/shobon.js
index e7a9073..d4b345c 100644
--- a/static/js/shobon.js
+++ b/static/js/shobon.js
@@ -15,7 +15,7 @@ function shobon() {
box.appendChild(document.createTextNode(" | "));
var slnk = document.createElement("a");
slnk.href = "#";
- slnk.innerHTML = "<b>Configuración</b>";
+ slnk.innerHTML = "<b>Configurar</b>";
slnk.addEventListener("click", shobonSettings);
box.appendChild(slnk);
}
@@ -25,11 +25,6 @@ function shobon() {
var newRepliesCounter = 0;
- // dejar barra superior fija
- if (localStorage.getItem("shobon_navbar") == "true") {
- fixedNav();
- }
-
var shobon_time = localStorage.getItem("shobon_time");
if (shobon_time != "false") {
if (boardName == "world")
@@ -98,8 +93,7 @@ function shobon() {
if (isNewReply) {
newRepliesCounter++;
newRepliesInThread++;
- reply.children[0].innerHTML +=
- " <span class='shobonNew' style='color:#CC6666; font-weight:bold;'>Nuevo!</span>";
+ reply.children[0].innerHTML += " <span class='shobonNew' style='color:#CC6666; font-weight:bold;'>Nuevo!</span>";
}
}
@@ -115,7 +109,7 @@ function shobon() {
replaceCountryName(reply);
}
// colorear IDs
- if (localStorage.getItem("shobon_ids") != "false") {
+ if (localStorage.getItem("shobon_ids") == "true") {
paintIds(reply);
}
// insertar imágenes
@@ -213,29 +207,22 @@ function timeAgo(timestamp) {
else if (el < 31536000) return Math.round(el / 2628000) + " meses";
else if (el > 31535999) return "más de un año";
}
+
function localTime(timestamp, id) {
id = id || 0;
var lcl = new Date(timestamp * 1000);
lcl =
- ("0" + lcl.getDate()).slice(-2) +
- "/" +
+ ("0" + lcl.getDate()).slice(-2) + "/" +
("0" + (lcl.getMonth() + 1)).slice(-2) +
- "/" +
- lcl
- .getFullYear()
- .toString()
- .slice(-2) +
- "(" +
- week[lcl.getDay()] +
- ")" +
- ("0" + lcl.getHours()).slice(-2) +
- ":" +
- ("0" + lcl.getMinutes()).slice(-2) +
- ":" +
+ "/" + lcl.getFullYear().toString().slice(-2) +
+ "(" + week[lcl.getDay()] + ")" +
+ ("0" + lcl.getHours()).slice(-2) + ":" +
+ ("0" + lcl.getMinutes()).slice(-2) + ":" +
("0" + lcl.getSeconds()).slice(-2);
if (id) lcl = lcl + " " + id;
return lcl;
}
+
function loadFilters() {
var filters = JSON.parse(localStorage.getItem("shobon_filters"));
@@ -330,46 +317,23 @@ function shobonSettings(e) {
box.style.textAlign = "center";
var p = document.createElement("div");
- p.appendChild(
- createCheckbox("shobon_on", "<b>Activar extensión</b>", true)
- );
- p.appendChild(
- createCheckbox("shobon_navbar", "Fijar barra superior", false)
- );
- p.appendChild(createCheckbox("shobon_ids", "Colorear IDs", true));
- p.appendChild(
- createCheckbox("shobon_embedimg", "Insertar imágenes miniatura", false)
- );
- p.appendChild(
- createCheckbox("shobon_newposts", "Destacar mensajes nuevos", false)
- );
- p.appendChild(
- createCheckbox(
- "shobon_country",
- "Reemplazar códigos de país por nombres",
- false
- )
- );
- p.appendChild(
- createCheckbox("shobon_time", "Convertir fechas a hora local", true)
- );
- p.appendChild(
- createCheckbox("shobon_backlink", "Mostrar quién ha citado un post", true)
- );
- p.appendChild(
- createCheckbox("shobon_preview", "Previsualizar citas", true)
- );
- p.appendChild(
- createCheckbox("shobon_usefilters", "Activar filtros", false)
- );
+ p.appendChild(createCheckbox("shobon_on", "<b>Activar extensión</b>", true));
+ p.appendChild(createCheckbox("shobon_ids", "Colorear IDs", false));
+ p.appendChild(createCheckbox("shobon_embedimg", "Insertar imágenes miniatura", false));
+ p.appendChild(createCheckbox("shobon_newposts", "Destacar mensajes nuevos", false));
+ p.appendChild(createCheckbox("shobon_country", "Reemplazar códigos de país por nombres", false));
+ p.appendChild(createCheckbox("shobon_time", "Convertir fechas a hora local", true));
+ p.appendChild(createCheckbox("shobon_backlink", "Mostrar quién ha citado un post", true));
+ p.appendChild(createCheckbox("shobon_preview", "Previsualizar citas", true));
+ p.appendChild(createCheckbox("shobon_usefilters", "Activar filtros", false));
/*var a = document.createElement("a");
- a.href = "#";
- a.textContent = "[Editar filtros]";
- a.addEventListener("click", function() {
+ a.href = "#";
+ a.textContent = "[Editar filtros]";
+ a.addEventListener("click", function() {
var x = document.getElementById("filters");
x.hidden = !x.hidden;
- });
- p.appendChild(a);*/
+ });
+ p.appendChild(a);*/
box.appendChild(p);
var title2 = document.createElement("h6");
@@ -408,7 +372,7 @@ function shobonSettings(e) {
var msg = document.createElement("a");
msg.style.display = "block";
msg.href = "#";
- msg.textContent = "Actualizar página para ver cambios";
+ msg.textContent = "Actualizar para ver cambios";
msg.style.marginTop = "1em";
msg.addEventListener("click", function() {
location.reload();
@@ -487,8 +451,7 @@ function paintIds(reply) {
var lastChar = userId.substring(userId.length - 1, userId.length);
dateId.innerHTML =
postDate +
- "<span class='uid ID_" +
- userId.slice(0, -1) +
+ "<span class='uid ID_" + userId.slice(0, -1) +
"' style='background-color:#" +
idColor +
";color:#" +
@@ -496,9 +459,7 @@ function paintIds(reply) {
";padding:0 3px;border-radius:5px; font-size:0.9em;vertical-align:top;'>ID:" +
userId +
"</span>";
- dateId
- .getElementsByClassName("uid")[0]
- .addEventListener("click", markId, false);
+ dateId.getElementsByClassName("uid")[0].addEventListener("click", markId, false);
}
}
@@ -571,9 +532,4 @@ function padZero(str, len) {
return (zeros + str).slice(-len);
}
-function fixedNav() {
- var bar = document.getElementById("main_nav");
- if (bar) document.body.className += " fix";
-}
-
document.addEventListener("DOMContentLoaded", shobon, false);