aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar Terry 2019-03-29 11:19:08 -0300
committerLibravatar Terry 2019-03-29 11:19:08 -0300
commitaba26b4a8731a3485eba3d0a7d0d1d3f2401ac66 (patch)
tree8ab99851662c1c24464e1ee429d3c17db6dc052a /static/js
parentcbcec8cdc72261fda3784cf629cbbf98ebdea93d (diff)
downloadweabot-aba26b4a8731a3485eba3d0a7d0d1d3f2401ac66.tar.gz
weabot-aba26b4a8731a3485eba3d0a7d0d1d3f2401ac66.tar.xz
weabot-aba26b4a8731a3485eba3d0a7d0d1d3f2401ac66.zip
size 🤡
Diffstat (limited to 'static/js')
-rw-r--r--static/js/autorefresh.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/static/js/autorefresh.js b/static/js/autorefresh.js
index 9aa6e0e..b09758c 100644
--- a/static/js/autorefresh.js
+++ b/static/js/autorefresh.js
@@ -35,10 +35,10 @@ function loadJSON() {
}
function updateThread(posts, total_replies, serverTime) {
- thread_div = document.getElementsByClassName("thread")[0];
-
-
- for (var i = 0; i < posts.length; i++) {
+ var thread_div = document.getElementsByClassName("thread")[0];
+ if (serviceType == 2) var last_elem = document.getElementById("size");
+ else var last_elem = document.getElementsByClassName("cut")[0];
+ for (var i=0; i<posts.length; i++) {
post = posts[i];
var num = thread_length + i + 1;
var div = document.createElement('div');
@@ -77,13 +77,9 @@ function updateThread(posts, total_replies, serverTime) {
}
}
- if (serviceType == 2) thread_div.appendChild(div);
- else thread_div.insertBefore(div, document.getElementsByClassName("cut")[0]);
+ thread_div.insertBefore(div, last_elem);
thread_div.setAttribute("data-length",num);
- if (serviceType == 2) {
- var res=document.getElementsByTagName("h3")[0].getElementsByTagName("span")[0];
- res.innerText = res.innerText.replace(/[0-9]+/, num);
- }
+ if (serviceType == 2) document.getElementsByTagName("h3")[0].getElementsByTagName("span")[0].innerText = "("+num+" respuestas)";
}
if (posts.length > 0) {