aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar Choom 2023-01-16 05:05:02 -0300
committerLibravatar Choom 2023-01-16 14:37:07 -0300
commit1f988f01c7eee932ef7d2fb80de5a2b3792097d3 (patch)
treea83fd88c3f8dc17390f9f084483d53c8884d63ec /static/js
parent4c31093827f57394563de037a21143407586e384 (diff)
downloadweabot-1f988f01c7eee932ef7d2fb80de5a2b3792097d3.tar.gz
weabot-1f988f01c7eee932ef7d2fb80de5a2b3792097d3.tar.xz
weabot-1f988f01c7eee932ef7d2fb80de5a2b3792097d3.zip
Divs únicos deben tener id
Diffstat (limited to 'static/js')
-rw-r--r--static/js/autorefresh.js7
-rw-r--r--static/js/weabotxt.js20
2 files changed, 15 insertions, 12 deletions
diff --git a/static/js/autorefresh.js b/static/js/autorefresh.js
index 91ac05c..d804675 100644
--- a/static/js/autorefresh.js
+++ b/static/js/autorefresh.js
@@ -233,7 +233,6 @@ function updateThread(posts, total_replies, serverTime) {
}
thread_length = parseInt(total_replies) + 1;
- //document.getElementsByClassName("thread")[0].firstChild.children[0].innerHTML = "("+thread_length+")";
new_unread = thread_length - thread_first_length;
if (new_unread) document.title = "(" + new_unread + ") " + thread_title;
@@ -244,7 +243,7 @@ function notif(title, msg) {
var n = new Notification(title, {
body: msg
});
- setTimeout(n.close.bind(n), 10000);
+ setTimeout(n.close.bind(n), 5000);
}
function counter() {
@@ -270,7 +269,7 @@ function detectService() {
if (thread_length == thread_lastreply) {
serviceType = 2;
document.getElementById("n").addEventListener("click", checkNew);
- var footer = document.getElementsByClassName("lastposts")[0];
+ var footer = document.getElementById("lastposts");
var in1 = document.createElement("input");
in1.id = "autorefresh";
in1.setAttribute("type", "checkbox");
@@ -281,7 +280,7 @@ function detectService() {
in2.setAttribute("for", "autorefresh");
in2.style.marginRight = "4px";
in2.style.cursor = "pointer";
- in2.textContent = "Auto refresh";
+ in2.textContent = "Automático";
var in3 = document.createElement("span");
in3.id = "counter";
in3.style.position = "absolute";
diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js
index ea060f8..2c93105 100644
--- a/static/js/weabotxt.js
+++ b/static/js/weabotxt.js
@@ -189,6 +189,17 @@ function listSort(e) {
for (var j = 0; j < arr.length; j++) table.appendChild(arr[j]);
}
+function checkHidden() {
+ var hidp = localStorage.getItem("hid-p-"+board);
+ if (hidp) {
+ var hid = hidp.split("!");
+ for (var i = 0; i < hid.length; i++) {
+ var post = document.getElementById("p"+hid[i]);
+ if (post) post.classList.add("hidden");
+ }
+ }
+}
+
function togglePost(e) {
var post = e.parentElement;
var pid = post.id.slice(1);
@@ -295,14 +306,7 @@ document.addEventListener("DOMContentLoaded", function() {
}
}
- var hidp = localStorage.getItem("hid-p-"+board);
- if (hidp) {
- var hid = hidp.split("!");
- for (var i = 0; i < hid.length; i++) {
- var post = document.getElementById("p"+hid[i]);
- if (post) post.classList.add("hidden");
- }
- }
+ checkHidden();
});
document.addEventListener("click", function(e) {