From 28b8f6106eadf5c94d79509df7a311b9dfe529c2 Mon Sep 17 00:00:00 2001
From: Choom
Date: Sun, 18 Dec 2022 05:29:23 -0300
Subject: Fix autorefresh
---
cgi/templates/board.html | 3 +-
cgi/templates/board.jp.html | 3 +-
static/css/ib.css | 8 +++-
static/js/autorefresh.js | 110 ++++++++++++++++++--------------------------
4 files changed, 55 insertions(+), 69 deletions(-)
diff --git a/cgi/templates/board.html b/cgi/templates/board.html
index ab867d4..778fb31 100644
--- a/cgi/templates/board.html
+++ b/cgi/templates/board.html
@@ -256,7 +256,8 @@
-
[
Volver al IB]
diff --git a/cgi/templates/board.jp.html b/cgi/templates/board.jp.html
index 0e223c9..8e1a1c0 100644
--- a/cgi/templates/board.jp.html
+++ b/cgi/templates/board.jp.html
@@ -249,7 +249,8 @@
-
+
+ [
掲示板に戻る]
diff --git a/static/css/ib.css b/static/css/ib.css
index e56c4b6..fb0433d 100644
--- a/static/css/ib.css
+++ b/static/css/ib.css
@@ -30,7 +30,7 @@ body[data-brd="2d"], body[data-brd="2d"] textarea {
}
#main_nav {
font-size: 14px;
- line-height: 1.3em;
+ line-height: 1.2em;
margin-bottom: 0.5em;
text-align: center;
}
@@ -105,6 +105,7 @@ textarea {
}
.thread {
margin-right: 170px;
+ line-height: 18px;
}
.thread table {
border-collapse: collapse;
@@ -202,7 +203,10 @@ textarea {
font-size: 12px;
line-height: 1;
margin: 0 -1px;
- padding: 2px 4px;
+ padding: 1px 4px;
+}
+.nav {
+ line-height: 1;
}
.thumbpreview {
display: inline-block;
diff --git a/static/js/autorefresh.js b/static/js/autorefresh.js
index cec1e33..cd4bf39 100644
--- a/static/js/autorefresh.js
+++ b/static/js/autorefresh.js
@@ -41,80 +41,53 @@ function loadJSON() {
}
function updateThread(posts, total_replies, serverTime) {
- var thread_div = document.getElementsByClassName("thread")[0];
- if (serviceType == 2) var last_elem = document.getElementById("size");
- else var last_elem = document.getElementsByClassName("cut")[0];
+ var threadDiv = document.getElementsByClassName("thread")[0];
+ if (serviceType == 2) {
+ var repliesDiv = threadDiv.getElementsByClassName("replies")[0];
+ }
+
for (var i = 0; i < posts.length; i++) {
post = posts[i];
var num = thread_length + i + 1;
+
var div = document.createElement("div");
- if (serviceType == 2) div.className = "reply";
- else div.className = "replycont";
- if (post.email) {
- if (post.tripcode)
- s_name =
- '
' +
- post.name +
- " " +
- post.tripcode +
- "";
- else
- s_name =
- '
' +
- post.name +
- "";
+ div.id = 'p' + post.id;
+ if (serviceType == 2) {
+ div.dataset.n = num;
+ div.className = "reply";
+ if (post.IS_DELETED > 0) {
+ div.className += " deleted";
+ }
} else {
- if (post.tripcode)
- s_name =
- '
' +
- post.name +
- " " +
- post.tripcode +
- "";
- else s_name = '
' + post.name + "";
+ div.className = "replycont";
}
+
+ var s_name = '';
+ if (post.email) s_name += '
' + post.name + '';
+ if (post.tripcode) s_name += ' ' + post.tripcode;
+ s_name += '';
+ if (post.email) s_name += '';
+
+ var s_img = '';
if (serviceType == 2) {
if (post.file) {
- s_img =
- '
' +
- Math.round(post.file_size / 1024) +
- "KB " +
- post.file
- .substring(post.file.lastIndexOf(".") + 1, post.file.length)
- .toUpperCase() +
- "";
- } else s_img = "";
- if (post.IS_DELETED == 1)
+ s_img = '
' +
+ '';
+ }
+
+ if (post.IS_DELETED == 1) {
div.innerHTML =
- '
' +
- num +
- " : Mensaje eliminado por el usuario.
";
- else if (post.IS_DELETED == 2)
+ '
' + num + " : Mensaje eliminado por usuario.
";
+ } else if (post.IS_DELETED == 2) {
div.innerHTML =
- '
' +
- num +
- " : Mensaje eliminado por miembro del staff.
";
- else
+ '
' + num + " : Mensaje eliminado por staff.
";
+ } else {
div.innerHTML =
- '
' +
+ '' +
num +
- "
: " +
+ " : " +
s_name +
' : ' +
post.message +
"
";
+ }
} else {
+ var s_msg = '';
if (post.file) {
if (post.image_width != 0) {
s_img =
@@ -199,7 +174,6 @@ function updateThread(posts, total_replies, serverTime) {
post.message +
"";
} else {
- s_img = "";
s_msg = "