aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Choom 2023-01-28 00:52:56 -0300
committerLibravatar Choom 2023-02-02 00:39:27 -0300
commit081ddc03aef7becc3b084a9079a2574fd3e3b49b (patch)
treea6ca793a0c21917d3774778c0a14f65a8c678113
parentd0d6b8ebff31d2306a040dc9c53f9e5e7a0ec7a0 (diff)
downloadweabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.tar.gz
weabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.tar.xz
weabot-081ddc03aef7becc3b084a9079a2574fd3e3b49b.zip
userconf
-rw-r--r--cgi/templates/board.0.html6
-rw-r--r--cgi/templates/board.html6
-rw-r--r--cgi/templates/board.jp.html6
-rw-r--r--cgi/templates/home.html9
-rw-r--r--cgi/templates/txt_board.en.html4
-rw-r--r--cgi/templates/txt_board.html7
-rw-r--r--cgi/templates/txt_thread.html1
-rw-r--r--static/css/txt/bbs.css28
-rw-r--r--static/css/txt/futanari.css15
-rw-r--r--static/example/ib1.html4
-rw-r--r--static/example/style.css18
-rw-r--r--static/js/aquiencitas.js3
-rw-r--r--static/js/autorefresh.js83
-rw-r--r--static/js/shobon.js435
-rw-r--r--static/js/userconf.js116
-rw-r--r--static/js/weabot.js11
-rw-r--r--static/js/weabotxt.js144
17 files changed, 282 insertions, 614 deletions
diff --git a/cgi/templates/board.0.html b/cgi/templates/board.0.html
index 5be1e28..9093386 100644
--- a/cgi/templates/board.0.html
+++ b/cgi/templates/board.0.html
@@ -113,7 +113,7 @@
<?py if maxage: ?>
<li>fadenoj estas senditaj al la mortoĉambro post <b>#{maxage}</b> tagoj.</li>
<?py #endif ?>
- <li>unuafoje? <a href="/guia.html" target="_blank">kiel uzi</a> · <a href="/faq.html" target="_blank">oftaj demandoj</a> · <a href="/bai/" target="_blank">burokratio</a></li>
+ <li>unuafoje? <a href="/guia.html">kiel uzi</a> · <a href="/faq.html">oftaj demandoj</a> · <a href="/bai/">burokratio</a> · <a href="/userconf.html">agordoj</a></li>
<li>konekti vian estaĵo, ŝlosita <a href="mailto:burocracia@bienvenidoainternet.org">en ekziston</a>.</li>
<li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">foliumi: </label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="iru"></form></li>
</ul>
@@ -219,9 +219,9 @@
</a>
<?py #endif ?>
<?py if post['thumb_width'] and post['parentid']: ?>
- <blockquote style="margin-left:#{post['thumb_width']+40}px">#{post['message']}</blockquote>
+ <blockquote class="msg" style="margin-left:#{post['thumb_width']+40}px">#{post['message']}</blockquote>
<?py else: ?>
- <blockquote>#{post['message']}</blockquote>
+ <blockquote class="msg">#{post['message']}</blockquote>
<?py #endif ?>
<?py if not replythread and post['shortened']: ?>
<blockquote class="abbrev">(parolas tro multe... klaku <a href="#{boards_url}#{board}/res/#{post['id'] if not post['parentid'] else post['parentid']}.html">ĉi tie</a> por vidi.)</blockquote>
diff --git a/cgi/templates/board.html b/cgi/templates/board.html
index 6254bd5..6cf10b1 100644
--- a/cgi/templates/board.html
+++ b/cgi/templates/board.html
@@ -115,7 +115,7 @@
<?py if maxage: ?>
<li>Los hilos son automáticamente eliminados a los <b>#{maxage}</b> días de edad.</li>
<?py #endif ?>
- <li>¿Eres nuevo? <a href="/guia.html" target="_blank">Leer antes de postear</a> · <a href="/faq.html" target="_blank">Preguntas frecuentes</a> · <a href="/bai/" target="_blank">Contacto</a></li>
+ <li>¿Eres nuevo? <a href="/guia.html">Cómo postear</a> · <a href="/faq.html">Preguntas frecuentes</a> · <a href="/bai/">Contacto</a> · <a href="/userconf.html">Configurar</a></li>
<li id="search"><form method="get" action="/tools/search.py" style="display:inline-block"><input type="hidden" name="board" value="${board}"><label for="searchin">Buscar: </label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="Ir"></form></li>
</ul>
</td>
@@ -236,9 +236,9 @@
</a>
<?py #endif ?>
<?py if post['thumb_width'] and post['parentid']: ?>
- <blockquote style="margin-left:#{post['thumb_width']+40}px">#{post['message']}</blockquote>
+ <blockquote class="msg" style="margin-left:#{post['thumb_width']+40}px">#{post['message']}</blockquote>
<?py else: ?>
- <blockquote>#{post['message']}</blockquote>
+ <blockquote class="msg">#{post['message']}</blockquote>
<?py #endif ?>
<?py if not replythread and post['shortened']: ?>
<blockquote class="abbrev">(Post muy largo... Presiona <a href="#{boards_url}#{board}/res/#{post['id'] if not post['parentid'] else post['parentid']}.html##{post['id']}">aqu&iacute;</a> para verlo completo.)</blockquote>
diff --git a/cgi/templates/board.jp.html b/cgi/templates/board.jp.html
index 5ce2017..dc9a30e 100644
--- a/cgi/templates/board.jp.html
+++ b/cgi/templates/board.jp.html
@@ -117,7 +117,7 @@
<?py if maxage: ?>
<li>スレは<b>#{maxage}</b>日間経つと自動的に消されられます.</li>
<?py #endif ?>
- <li><a href="/guia.html" target="_blank">使い方</a> · <a href="/faq.html" target="_blank">よくある質問</a> · <a href="/bai/" target="_blank">管理人への連絡</a></li>
+ <li><a href="/guia.html">使い方</a> · <a href="/faq.html">よくある質問</a> · <a href="/bai/">管理人への連絡</a> · <a href="/userconf.html">設定</a></li>
<li id="search"><form method="get" action="/tools/search.py" style="display: inline-block;"><input type="hidden" name="board" value="${board}"><label for="searchin">検索:</label><input type="text" name="q" id="searchin" value="" size="10"> <input id="searchbtn" type="submit" value="GO"></form></li>
</ul>
</td>
@@ -238,9 +238,9 @@
</a>
<?py #endif ?>
<?py if post['thumb_width'] and post['parentid']: ?>
- <blockquote style="margin-left:#{post['thumb_width']+40}px;">#{post['message']}</blockquote>
+ <blockquote class="msg" style="margin-left:#{post['thumb_width']+40}px;">#{post['message']}</blockquote>
<?py else: ?>
- <blockquote>#{post['message']}</blockquote>
+ <blockquote class="msg">#{post['message']}</blockquote>
<?py #endif ?>
<?py if not replythread and post['shortened']: ?>
<blockquote class="abbrev">(投稿は長すぎ... 全部読むには<a href="#{boards_url}#{board}/res/#{post['id'] if post['parentid'] == "0" else post['parentid']}.html##{post['id']}">こっちら</a>へ)</blockquote>
diff --git a/cgi/templates/home.html b/cgi/templates/home.html
index 295ddd1..6ce21fe 100644
--- a/cgi/templates/home.html
+++ b/cgi/templates/home.html
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bienvenido a Internet BBS/IB</title>
<link rel="shortcut icon" href="favicon.ico" />
- <link rel="stylesheet" type="text/css" href="/home.css?v=4" />
+ <link rel="stylesheet" type="text/css" href="/home.css?v=5" />
<script type="text/javascript" src="#{static_url}js/home.js?v=4"></script>
</head>
<body class="home">
@@ -71,7 +71,12 @@
</div>
</div>
<hr />
- <div id="links"><a href="/" target="_top"><b>Portada</b></a> · <a href="/guia.html"><b>¿Eres nuevo?</b></a> · <a href="/faq.html"><b>Preguntas Frecuentes</b></a></div>
+ <div id="links">
+ <a href="/" target="_top">Portada</a>
+ · <a href="/guia.html">¿Eres nuevo?</a>
+ · <a href="/faq.html">Preguntas Frecuentes</a>
+ · <a href="/userconf.html">Configurar</a>
+ </div>
<div id="extra">
<a href="/bai.html" target="_top">Frame</a> ·
<a href="/movil.html">BaI Móvil</a> ·
diff --git a/cgi/templates/txt_board.en.html b/cgi/templates/txt_board.en.html
index 567ef8e..f34dc27 100644
--- a/cgi/templates/txt_board.en.html
+++ b/cgi/templates/txt_board.en.html
@@ -13,7 +13,7 @@
<?py #endif ?>
<form method="get" action="/tools/search.py" id="search"><input type="text" name="q" value="" /><input type="hidden" name="board" value="#{board}" /><input type="submit" value="Search active posts" /><input type="submit" value="Search archives" formaction="/tools/search_kako.py" /></form>
</div>
- <div class="innerbox" id="bailinks"><b>¿Eres nuevo?</b> <a href="/guia.html" target="_blank"><b>C&oacute;mo postear</b></a> | <a href="/faq.html" target="_blank"><b>Preguntas frecuentes</b></a> | <a href="/bai/" target="_blank"><b>Contacto</b></a></div>
+ <div class="innerbox" id="bailinks"><b>¿Eres nuevo?</b> <a href="/guia.html"><b>C&oacute;mo postear</b></a> | <a href="/faq.html"><b>Preguntas frecuentes</b></a> | <a href="/bai/"><b>Contacto</b></a> | <a href="/userconf.html"><b>Configurar</b></a></div>
</div>
<?py if postarea_extra: ?>
<div class="outerbox"><div class="innerbox">#{postarea_extra}</div></div>
@@ -91,7 +91,7 @@
<div class="formpad">
<div id="preview#{thread['id']}" class="msg" style="display:none"></div>
<textarea name="message" cols="70" rows="6"></textarea>
- <?py if allow_image_replies: ?><br /><input type="file" name="file" /><?py #endif ?>
+ <?py if allow_image_replies: ?><input type="file" name="file" /><?py #endif ?>
<?py else: ?>
<form class="postform"><div class="locked"><b>Thread has been closed. You cannot reply anymore.</b></div><div class="formpad">
<?py #endif ?>
diff --git a/cgi/templates/txt_board.html b/cgi/templates/txt_board.html
index 843625a..2e87819 100644
--- a/cgi/templates/txt_board.html
+++ b/cgi/templates/txt_board.html
@@ -13,7 +13,7 @@
<?py #endif ?>
<form method="get" action="/tools/search.py" id="search"><input type="text" name="q" value="" /><input type="hidden" name="board" value="#{board}" /><input type="submit" value="Buscar en mensajes activos" /><input type="submit" value="Buscar en archivo" formaction="/tools/search_kako.py" /></form>
</div>
- <div class="innerbox" id="bailinks"><b>¿Eres nuevo?</b> <a href="/guia.html" target="_blank"><b>C&oacute;mo postear</b></a> | <a href="/faq.html" target="_blank"><b>Preguntas frecuentes</b></a> | <a href="/bai/" target="_blank"><b>Contacto</b></a></div>
+ <div class="innerbox" id="bailinks"><b>¿Eres nuevo?</b> <a href="/guia.html"><b>C&oacute;mo postear</b></a> | <a href="/faq.html"><b>Preguntas frecuentes</b></a> | <a href="/bai/"><b>Contacto</b></a> | <a href="/userconf.html"><b>Configurar</b></a></div>
</div>
<?py if postarea_extra: ?>
<div class="outerbox"><div class="innerbox">#{postarea_extra}</div></div>
@@ -77,8 +77,7 @@
<img src="#{'/static/' if post['thumb'].startswith('mime') else ('/'+board+'/thumb/')}#{post['thumb']}" width="#{post['thumb_width']}" height="#{post['thumb_height']}" title="${post['file']}-(${post['file_size']} B)" />
</a>
<?py #endif ?>
- <div class="msg">
- #{post['message']}
+ <div class="msg">#{post['message']}
<?py if post['shortened']: ?>
<div class="abbrev">(Post muy largo... Presiona <a href="#{boards_url}#{board}/read/#{thread['timestamp']}/#{post['num']}">aquí</a> para verlo completo.)</div>
<?py #endif ?>
@@ -95,7 +94,7 @@
<div class="formpad">
<div id="preview#{thread['id']}" class="msg" style="display:none"></div>
<textarea name="message" cols="70" rows="6"></textarea>
- <?py if allow_image_replies: ?><br /><input type="file" name="file" /><?py #endif ?>
+ <?py if allow_image_replies: ?><input type="file" name="file" /><?py #endif ?>
<?py else: ?>
<form class="postform"><div class="locked"><b>El hilo ha sido cerrado. Ya no se puede postear en él.</b></div><div class="formpad">
<?py #endif ?>
diff --git a/cgi/templates/txt_thread.html b/cgi/templates/txt_thread.html
index 8375d27..a013b88 100644
--- a/cgi/templates/txt_thread.html
+++ b/cgi/templates/txt_thread.html
@@ -99,7 +99,6 @@
<div id="preview#{thread['id']}" class="msg" style="display:none"></div>
<textarea name="message" cols="80" rows="7" accesskey="m"></textarea>
<?py if allow_image_replies: ?>
- <br />
<input type="file" name="file" accesskey="i" />
<?py #endif ?>
<?py else: ?>
diff --git a/static/css/txt/bbs.css b/static/css/txt/bbs.css
index 543fc8c..ec7fd9d 100644
--- a/static/css/txt/bbs.css
+++ b/static/css/txt/bbs.css
@@ -106,7 +106,7 @@ ul {
#main_nav {
font-size: 14px;
line-height: 18px;
- padding: 2px 0;
+ padding: 2px;
text-align: center;
width: 100%;
}
@@ -282,6 +282,8 @@ a.yt b {
margin-bottom: 0.5em;
}
textarea {
+ display: block;
+ margin: 1px 0;
line-height: 18px;
max-width: 100%;
}
@@ -318,7 +320,7 @@ form .msg {
color: #fff;
}
#listmenu {
- text-align: center;
+ text-align: right;
}
#threads td,
#threads th {
@@ -369,9 +371,7 @@ form .msg {
h2 span {
display: block;
}
- h2 span,
- #rules,
- .pblock {
+ #rules {
font-size: 12px;
line-height: 14px;
}
@@ -381,7 +381,7 @@ form .msg {
}
#threadlist > a {
font-size: 10px;
- padding: 6px 3px;
+ padding: 6px 4px;
}
.threadnav,
#size,
@@ -400,25 +400,23 @@ form .msg {
.formpad {
padding-left: 0;
}
- .postform input {
- margin-bottom: 2px;
+ .postform input,
+ textarea {
+ margin: 0 0 3px;
+ width: 100%;
}
.postform > span {
display: table;
width: 100%;
}
.postform input[type="submit"] {
- padding: 6px;
+ padding: 8px;
}
- .postform span > input,
- .postform span > span {
+ .postform > span > input,
+ .postform > span > span {
display: table-cell;
white-space: nowrap;
}
- .postform input,
- textarea {
- width: 100%;
- }
form,
#thread_nav,
.locked {
diff --git a/static/css/txt/futanari.css b/static/css/txt/futanari.css
index 365faf3..29d7264 100644
--- a/static/css/txt/futanari.css
+++ b/static/css/txt/futanari.css
@@ -40,10 +40,8 @@ h3 span {
input[type="text"],
textarea,
select {
- border-top: 1px solid #000;
- border-left: 1px solid #000;
- border-bottom: none;
- border-right: none;
+ border: 1px solid #10181f;
+ box-shadow: inset 1px 1px 2px rgb(0, 0, 0, 0.3);
}
input[type="submit"],
input[type="button"],
@@ -77,6 +75,9 @@ input[type="file"] {
#main_nav {
background: #1d7548;
}
+.cur_brd:before {
+ content: "◆";
+}
#titlebox {
margin-bottom: 0;
border-bottom: 0;
@@ -85,13 +86,14 @@ input[type="file"] {
.replies,
.thread .postform,
.threadpage .postform,
-#q-p .reply,
+#q-p,
#threads th {
background: #476a88;
border-top: 1px solid #5e8db4;
border-left: 1px solid #5e8db4;
border-bottom: 1px solid #10181f;
border-right: 1px solid #10181f;
+ box-shadow: 1px 1px #000;
}
#threadbox {
border-top: 0;
@@ -161,12 +163,11 @@ form .msg {
color: #fff;
}
#q-p {
- box-shadow: 2px 2px #21323f;
padding: 0;
}
#size {
float: left;
- margin: 1em -5em 1em 0;
+ margin: 1em -5em 0 0;
}
#threads th {
background: #5e8db4;
diff --git a/static/example/ib1.html b/static/example/ib1.html
index 69c5865..e2936da 100644
--- a/static/example/ib1.html
+++ b/static/example/ib1.html
@@ -16,9 +16,9 @@
<hr width="90%" size="1">
-<div class="postarea">
+<div id="postarea">
<form name="postform" id="postform" action="#">
-<table class="postform">
+<table id="postform-t">
<tr>
<td class="postblock">Asunto</td>
<td>
diff --git a/static/example/style.css b/static/example/style.css
index de0c621..b912b5d 100644
--- a/static/example/style.css
+++ b/static/example/style.css
@@ -44,6 +44,13 @@ a:active {
color:#900;
}
+textarea {
+ max-width: 100%;
+ width: 700px;
+ height: 200px;
+ display: block;
+}
+
.desc {
margin-left:40px;
}
@@ -153,10 +160,16 @@ iframe {
display: block;
}
+#config-url {
+ width: 400px;
+ border: 1px dotted #73B233;
+ display: block;
+ margin: 8px 0;
+}
+
@media (max-width: 600px) {
body {
text-align: center;
- font-size: 15px;
}
.desc {
@@ -169,7 +182,8 @@ iframe {
input[type="text"],
input[type="button"],
- .inputcont {
+ .inputcont,
+ #config-url {
margin: 8px 0;
width: 100%;
display: block;
diff --git a/static/js/aquiencitas.js b/static/js/aquiencitas.js
index 309df8f..4e137d9 100644
--- a/static/js/aquiencitas.js
+++ b/static/js/aquiencitas.js
@@ -154,8 +154,7 @@ function quotePreview() {
is_bbs = true;
else is_bbs = false;
- if (is_bbs) replies = document.getElementsByClassName("msg");
- else replies = document.getElementsByTagName("blockquote");
+ replies = document.getElementsByClassName("msg");
var urls = window.location.pathname.split("/");
cur_url = "/" + ((urls[2]) ? urls[1] + "/" + urls[2] + "/" + urls[3] : urls[1]);
diff --git a/static/js/autorefresh.js b/static/js/autorefresh.js
index d804675..e3fb4b6 100644
--- a/static/js/autorefresh.js
+++ b/static/js/autorefresh.js
@@ -22,17 +22,13 @@ function loadJSON() {
if (manual) document.getElementById("counter").innerText = "...";
var data_file;
if (serviceType == 2 || serviceType == 3) {
- board = document.getElementsByName("board")[0].value;
+ board = document.body.dataset.brd;
parent = document.getElementsByName("parent")[0].value;
data_file =
- "/cgi/api/thread?dir=" +
- board +
- "&id=" +
- parent +
- "&offset=" +
- thread_length +
- "&time=" +
- lastTime;
+ "/cgi/api/thread?dir=" + board
+ + "&id=" + parent
+ + "&offset=" + thread_length
+ + "&time=" + lastTime;
} else {
return false;
}
@@ -216,27 +212,35 @@ function updateThread(posts, total_replies, serverTime) {
threadDiv.setAttribute("data-length", num);
- if (serviceType == 2)
+ if (serviceType == 2) {
document
.getElementsByTagName("h3")[0]
.getElementsByTagName("span")[0].innerText = "(" + num + " respuestas)";
+ }
}
if (posts.length > 0) {
if (!manual) refreshMaxTime = 10;
if (!document.hasFocus())
- if (posts.length > 1)
+ if (posts.length > 1) {
notif(thread_title, posts.length + " nuevos mensajes");
- else notif(thread_title, "Un nuevo mensaje");
+ } else {
+ notif(thread_title, "Un nuevo mensaje");
+ }
} else {
- if (refreshMaxTime <= 60) refreshMaxTime += 5;
+ if (refreshMaxTime <= 60) {
+ refreshMaxTime += 5;
+ }
}
thread_length = parseInt(total_replies) + 1;
new_unread = thread_length - thread_first_length;
- if (new_unread) document.title = "(" + new_unread + ") " + thread_title;
- else document.title = thread_title;
+ if (new_unread) {
+ document.title = "(" + new_unread + ") " + thread_title;
+ } else {
+ document.title = thread_title;
+ }
}
function notif(title, msg) {
@@ -263,9 +267,9 @@ function detectService() {
document.getElementsByClassName("thread")[0].dataset.length
);
thread_first_length = thread_length;
- replylist = document.getElementsByClassName("reply");
- lastr = replylist[replylist.length - 1].textContent;
- thread_lastreply = parseInt(lastr.substr(0, lastr.indexOf(" :")));
+ thread_lastreply = parseInt(
+ document.getElementsByClassName("replies")[0].lastElementChild.dataset.n
+ );
if (thread_length == thread_lastreply) {
serviceType = 2;
document.getElementById("n").addEventListener("click", checkNew);
@@ -300,8 +304,6 @@ function detectService() {
document.getElementsByClassName("thread")[0].dataset.length
);
thread_first_length = thread_length;
- replylist = document.getElementsByClassName("thread");
- replylist += document.getElementsByClassName("reply");
var footer = document.getElementsByClassName("nav")[1];
var mnl = document.createElement("a");
mnl.id = "shownew";
@@ -346,15 +348,12 @@ function stopCounter(str) {
}
function autoRefresh(e) {
- chk_snd = document.getElementById("autosound");
if (document.getElementById("autorefresh").checked) {
- if (chk_snd) chk_snd.disabled = false;
Notification.requestPermission();
lastTime = Math.floor(Date.now() / 1000);
refreshTime = refreshMaxTime;
startCounter();
} else {
- if (chk_snd) document.getElementById("autosound").disabled = true;
stopCounter("OFF");
}
}
@@ -374,31 +373,31 @@ http_request.onreadystatechange = function() {
manual = 0;
}
};
+
+function setCookie(e) {
+ if (chk.checked) {
+ weabot.autorefresh = true;
+ } else {
+ weabot.autorefresh = false;
+ }
+ localStorage.setItem("weabot", JSON.stringify(weabot));
+}
+
document.addEventListener("DOMContentLoaded", function() {
if (!detectService()) return;
+ if (localStorage.hasOwnProperty("weabot")) {
+ weabot = JSON.parse(localStorage.getItem("weabot"));
+ } else {
+ weabot = { autorefresh: false };
+ }
+
chk = document.getElementById("autorefresh");
- chk_snd = document.getElementById("autosound");
- if (localStorage.getItem("autorefresh")) {
- document.getElementById("autorefresh").checked = true;
+ if (weabot.autorefresh) {
+ chk.checked = true;
autoRefresh();
}
- if (!chk_snd) return;
- if (localStorage.getItem("mainpage_nosound"))
- document.getElementById("autosound").checked = false;
-});
-
-window.addEventListener("unload", function() {
- if (!serviceType) return;
-
- chk = document.getElementById("autorefresh");
- chk_snd = document.getElementById("autosound");
- if (chk.checked) localStorage.setItem("autorefresh", true);
- else localStorage.removeItem("autorefresh");
- if (!chk_snd) return;
- if (!document.getElementById("autosound").checked)
- localStorage.setItem("mainpage_nosound", true);
- else localStorage.removeItem("mainpage_nosound");
+ chk.addEventListener('change', setCookie);
});
diff --git a/static/js/shobon.js b/static/js/shobon.js
deleted file mode 100644
index 3a790a7..0000000
--- a/static/js/shobon.js
+++ /dev/null
@@ -1,435 +0,0 @@
-var are_filters = false;
-var hide_word = new Set();
-var hide_name = new Set();
-var hide_id = new Set();
-
-var shobon_ver = "v0.4+";
-function shobon() {
- boardName = document.body.dataset.brd;
- var where = document.body.classList;
- var inThread = where.contains("threadpage");
-
- if (!inThread) {
- /* Create settings link */
- var box = document.getElementsByClassName("links")[0];
- box.appendChild(document.createTextNode(" | "));
- var slnk = document.createElement("a");
- slnk.href = "#";
- slnk.innerHTML = "<b>Configurar</b>";
- slnk.addEventListener("click", shobonSettings);
- box.appendChild(slnk);
- }
-
- if (localStorage.getItem("shobon_on") == "false") return;
- else console.log("Running shobon " + shobon_ver);
-
- var newRepliesCounter = 0;
-
- if (localStorage.getItem("shobon_usefilters") != "false") {
- loadFilters();
- }
-
- var threadList = document.getElementsByClassName("thread");
- for (var i = 0; i < threadList.length; i++) {
- var threadId;
- var thread = threadList[i];
- var replyList = thread.getElementsByClassName("reply");
- if (inThread) {
- threadId = document.getElementsByName("parent")[0].value;
- } else {
- threadId = thread.getElementsByTagName("input").parent.value;
- }
-
- var lastReplyN = replyList[replyList.length - 1].attributes["data-n"].value;
- if (
- localStorage.getItem("shobon_newposts") == "true" &&
- localStorage.getItem(boardName + "_" + threadId) == null
- ) {
- localStorage.setItem(boardName + "_" + threadId, lastReplyN);
- }
- var lastSeen = localStorage.getItem(boardName + "_" + threadId);
- var newRepliesInThread = 0;
-
- for (var e = 0; e < replyList.length; e++) {
- var reply = replyList[e];
- var message = reply.getElementsByClassName("msg")[0];
- var id = 0;
-
- if (localStorage.getItem("shobon_newposts") == "true") {
- var replyId = reply.attributes["data-n"].value;
- var isNewReply = parseInt(lastSeen) < parseInt(replyId);
-
- if (isNewReply) {
- newRepliesCounter++;
- newRepliesInThread++;
- reply.children[0].innerHTML += " <span class='shobonNew' style='color:#CC6666; font-weight:bold;'>Nuevo!</span>";
- }
- }
-
- // ocultar mensajes que coinciden con lista negra
- if (are_filters) {
- checkBlackList(reply);
- }
- // colorear IDs
- if (localStorage.getItem("shobon_ids") == "true") {
- paintIds(reply);
- }
- // insertar imágenes
- if (localStorage.getItem("shobon_embedimg") == "true") {
- embedImg(reply);
- }
- }
- if (newRepliesInThread > 0 && !inThread) {
- var btnNew = document.createElement("span");
- btnNew.dataset.id = boardName + "_" + threadId;
- btnNew.dataset.last = lastReplyN;
- btnNew.textContent = "Marcar como leído";
- btnNew.setAttribute(
- "style",
- "font-weight:bold; background:#81a2be; padding:5px; border-radius:5px; float:right; margin-bottom:10px;"
- );
- btnNew.onclick = function() {
- localStorage.setItem(this.dataset.id, this.dataset.last);
- this.hidden = true;
- };
- thread.getElementsByClassName("threadlinks")[0].appendChild(btnNew);
- }
- }
- if (newRepliesCounter > 0 && !inThread) {
- var banner = document.createElement("span");
- banner.onclick = function() {
- this.hidden = true;
- };
- banner.setAttribute(
- "style",
- "font-weight:bold; background:#8c9440; padding:8px; border-radius:30px; float:right; position:fixed; bottom:10px; right:10px"
- );
- banner.textContent = "Nuevas respuestas: " + newRepliesCounter;
- document.body.appendChild(banner);
- }
-
- if (localStorage.getItem("shobon_newposts") == "true" && inThread) {
- localStorage.setItem(boardName + "_" + threadId, lastReplyN);
- }
-}
-
-function on_checked(e) {
- localStorage.setItem(e.target.id, e.target.checked);
-}
-function createCheckbox(name, label, def) {
- var lbl = document.createElement("label");
- var chk = document.createElement("input");
- chk.type = "checkbox";
- chk.id = name;
- chk.onchange = on_checked;
- lbl.appendChild(chk);
- lbl.insertAdjacentHTML("beforeend", " " + label + " ");
-
- var checked = localStorage.getItem(name);
- if (checked !== null) {
- chk.checked = checked == "true";
- } else {
- chk.checked = def;
- }
-
- return lbl;
-}
-function createOption(name, label) {
- var opt = document.createElement("option");
- opt.value = name;
- opt.text = label;
- return opt;
-}
-function createButton(label, func) {
- var btn = document.createElement("button");
- btn.type = "button";
- btn.textContent = label;
- btn.onclick = func;
- return btn;
-}
-function createTh(label, w) {
- var th = document.createElement("th");
- th.textContent = label;
- th.width = w;
- return th;
-}
-
-function loadFilters() {
- var filters = JSON.parse(localStorage.getItem("shobon_filters"));
-
- if (filters) {
- are_filters = true;
- hide_word = new Set(filters.word);
- hide_name = new Set(filters.name);
- hide_id = new Set(filters.id);
- }
-}
-function saveFilters() {
- var filters = {
- word: Array.from(hide_word),
- name: Array.from(hide_name),
- id: Array.from(hide_id)
- };
- localStorage.setItem("shobon_filters", JSON.stringify(filters));
-}
-function deleteFilter(e) {
- var tr = this.parentElement.parentElement;
- var name = tr.dataset.name;
- var type = tr.dataset.type;
- switch (type) {
- case "word":
- hide_word.delete(name);
- break;
- case "name":
- hide_name.delete(name);
- break;
- case "id":
- hide_id.delete(name);
- break;
- }
- saveFilters();
- tr.remove();
-}
-function addFilter(e) {
- var name = document.getElementById("txt_filter").value;
- var type = document.getElementById("lst_type").value;
- if (!name) {
- return;
- }
-
- switch (type) {
- case "word":
- hide_word.add(name);
- break;
- case "name":
- hide_name.add(name);
- break;
- case "id":
- hide_id.add(name);
- break;
- }
- addToFilterTable(name, type);
- saveFilters();
- document.getElementById("txt_filter").value = "";
-}
-
-function addToFilterTable(name, type) {
- var dict = { word: "Palabra", name: "Nombre/Tripcode", id: "ID" };
- var table = document.getElementById("tbl_filters");
-
- var td_type = document.createElement("td");
- td_type.textContent = dict[type];
- var td_name = document.createElement("td");
- td_name.textContent = name;
- var td_btn = document.createElement("td");
- td_btn.appendChild(createButton("X", deleteFilter));
-
- var tr = document.createElement("tr");
- tr.dataset.type = type;
- tr.dataset.name = name;
- tr.appendChild(td_type);
- tr.appendChild(td_name);
- tr.appendChild(td_btn);
-
- table.appendChild(tr);
-}
-function shobonSettings(e) {
- e.preventDefault();
-
- var titlebox = document.getElementById("titlebox");
-
- var box = document.getElementById("settings");
- if (box) {
- box.hidden = !box.hidden;
- } else {
- box = document.createElement("div");
- box.id = "settings";
- box.className = "innerbox";
- box.style.textAlign = "center";
-
- var p = document.createElement("div");
- 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_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() {
- var x = document.getElementById("filters");
- x.hidden = !x.hidden;
- });
- p.appendChild(a);*/
- box.appendChild(p);
-
- var title2 = document.createElement("h6");
- title2.textContent = "Filtros";
- title2.style.fontSize = "18px";
- title2.style.margin = "0.5em 0";
- box.appendChild(title2);
-
- box.appendChild(document.createTextNode("Filtrar mensajes por: "));
-
- var lst_type = document.createElement("select");
- lst_type.id = "lst_type";
- lst_type.appendChild(createOption("word", "Palabra"));
- lst_type.appendChild(createOption("name", "Nombre/Tripcode"));
- lst_type.appendChild(createOption("id", "ID"));
- box.appendChild(lst_type);
-
- var txt_filter = document.createElement("input");
- txt_filter.id = "txt_filter";
- txt_filter.type = "text";
- box.appendChild(txt_filter);
-
- box.appendChild(createButton("Agregar", addFilter));
-
- var tbl_filters = document.createElement("table");
- tbl_filters.id = "tbl_filters";
- tbl_filters.border = "1";
- tbl_filters.style.margin = "0 auto";
- var row = document.createElement("tr");
- row.appendChild(createTh("Tipo", 150));
- row.appendChild(createTh("Filtro", 300));
- row.appendChild(createTh("", 75));
- tbl_filters.appendChild(row);
- box.appendChild(tbl_filters);
-
- var msg = document.createElement("a");
- msg.style.display = "block";
- msg.href = "#";
- msg.textContent = "Actualizar para ver cambios";
- msg.style.marginTop = "1em";
- msg.addEventListener("click", function() {
- location.reload();
- });
- box.appendChild(msg);
-
- titlebox.appendChild(box);
-
- var i;
- hide_word.forEach(v => {
- addToFilterTable(v, "word");
- });
- hide_name.forEach(v => {
- addToFilterTable(v, "name");
- });
- hide_id.forEach(v => {
- addToFilterTable(v, "id");
- });
- }
-}
-
-function checkBlackList(reply) {
- var i;
-
- // Check words
- var low = reply.children[1].textContent.toLowerCase();
- hide_word.forEach(v => {
- console.log(v);
- if (low.includes(v.toLowerCase())) {
- hidepost(reply);
- }
- });
-
- // Check name/trip
- var msg_name = reply.firstElementChild
- .getElementsByClassName("name")[0]
- .textContent.toLowerCase();
- hide_name.forEach(v => {
- if (msg_name.includes(hide_name[i])) {
- hidepost(reply);
- }
- });
-
- // Check ID
- var date_div = reply.firstElementChild.getElementsByClassName("date")[0]
- .textContent;
- var id_index = date_div.indexOf("ID:");
- if (id_index != -1) {
- var id = date_div.substr(id_index + 3);
-
- hide_id.forEach(v => {
- if (id.includes(v)) {
- hidepost(reply);
- }
- });
- }
-}
-
-var currentSel = null;
-function paintIds(reply) {
- var dateId = reply.getElementsByClassName("date")[0];
- if (dateId.textContent.includes("ID:")) {
- var postDate = dateId.textContent.split("ID:")[0];
- var userId = dateId.textContent.split("ID:")[1];
- var idColor = toHex(userId).substring(0, 6);
- var reverseColor = invertColor(idColor);
- var lastChar = userId.substring(userId.length - 1, userId.length);
- dateId.innerHTML =
- postDate +
- "<span class='uid ID_" + userId.slice(0, -1) +
- "' style='background-color:#" +
- idColor +
- ";color:#" +
- reverseColor +
- ";padding:0 3px;border-radius:5px; font-size:0.9em;vertical-align:top;'>ID:" +
- userId +
- "</span>";
- }
-}
-
-function embedImg(reply) {
- var links = reply.getElementsByTagName("a");
- for (i = 0; i < links.length && i < 5; i++) {
- var url = links[i].href;
- if (url.startsWith("https://i.imgur.com")) {
- var ext = url.lastIndexOf(".");
- var thumburl = url.slice(0, ext) + "s" + url.slice(ext);
- } else if (links[i].href.startsWith("https://pbs.twimg.com")) {
- var thumburl = links[i].href + ":thumb";
- } else continue;
- var thumb = document.createElement("img");
- thumb.src = thumburl;
- links[i].appendChild(document.createElement("br"));
- links[i].appendChild(thumb);
- }
-}
-
-function toHex(str) {
- var hex = "";
- for (var i = 0; i < str.length; i++) {
- hex += "" + (str.charCodeAt(i) + 125).toString(16);
- }
- return hex;
-}
-
-function invertColor(hex) {
- if (hex.indexOf("#") === 0) {
- hex = hex.slice(1);
- }
- // convert 3-digit hex to 6-digits.
- if (hex.length === 3) {
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
- }
- if (hex.length !== 6) {
- throw new Error("Invalid HEX color.");
- }
- // invert color components
- var r = (255 - parseInt(hex.slice(0, 2), 16)).toString(16),
- g = (255 - parseInt(hex.slice(2, 4), 16)).toString(16),
- b = (255 - parseInt(hex.slice(4, 6), 16)).toString(16);
- // pad each with zeros and return
- return padZero(r) + padZero(g) + padZero(b);
-}
-
-function padZero(str, len) {
- len = len || 2;
- var zeros = new Array(len).join("0");
- return (zeros + str).slice(-len);
-}
-
-document.addEventListener("DOMContentLoaded", shobon, false);
diff --git a/static/js/userconf.js b/static/js/userconf.js
index 0118e88..399878e 100644
--- a/static/js/userconf.js
+++ b/static/js/userconf.js
@@ -1,35 +1,3 @@
-var request = new XMLHttpRequest();
-
-function cargarEstilos() {
- var api = '/cgi/api/styles';
- request.open("GET", api, true);
- request.send();
-}
-
-function listarEstilos(id, estilos, def) {
- var select = document.getElementById(id);
-
- for (var i=0; i < estilos.length; i++) {
- var opt = document.createElement('option');
- opt.value = estilos[i];
- opt.textContent = estilos[i];
- if (i == def) {
- opt.selected = true;
- }
- select.appendChild(opt);
- }
-}
-
-request.onreadystatechange = function() {
- if (request.readyState == 4) {
- var json = JSON.parse(request.responseText);
- if (json.state == "success") {
- listarEstilos('stylebbs', json.bbs_styles, json.bbs_styles_default);
- listarEstilos('styleib', json.ib_styles, json.ib_styles_default);
- }
- }
-};
-
function cambiarModo(e) {
var iframe = document.getElementById('examplebbs');
var estilo = document.getElementById('stylebbs').value;
@@ -63,7 +31,7 @@ function mostrarEstilo(e) {
loc += 'txt/';
}
- css.href = loc + estilo.toLowerCase() + ".css";
+ css.href = loc + estilo.trim().toLowerCase() + ".css";
var key = 'weabot_style_' + tipo;
var estilo = document.getElementById(('style'+tipo)).value;
@@ -74,32 +42,41 @@ function cargariframe(tipo) {
var iframe = document.createElement('iframe');
iframe.id = 'example' + tipo;
iframe.dataset.type = tipo;
- iframe.addEventListener('load', cargarDatos);
+ iframe.addEventListener('load', cargarEstilo);
iframe.src = '/static/example/' + tipo + '1.html';
var div = document.getElementById("desc" + tipo);
div.appendChild(iframe);
}
-function cargarDatos(e) {
+function cargarEstilo(e) {
var tipo = this.dataset.type;
var key = 'weabot_style_' + tipo;
+
if (localStorage.hasOwnProperty(key)) {
- var estilo = localStorage.getItem(key);
- document.getElementById(('style'+tipo)).value = estilo;
+ var estilo = localStorage.getItem(key).trim();
+
+ if (estilo != '') {
+ document.getElementById(('style'+tipo)).value = estilo;
+ } else {
+ localStorage.removeItem(key);
+ return;
+ }
+
mostrarEstilo(e);
this.tabIndex = -1;
}
- this.removeEventListener('load', cargarDatos);
+
+ this.removeEventListener('load', cargarEstilo);
}
function init(tipo) {
- cargariframe(tipo);
document.getElementById('style'+tipo).addEventListener('change', mostrarEstilo);
+ cargariframe(tipo);
}
function checkboxes() {
var chk = document.getElementsByClassName("weabot-obj");
- for (var i=0; i < chk.length; i++) {
+ for (var i=0; i < chk.length; i++) {
chk[i].addEventListener("change", saveInput);
}
}
@@ -151,19 +128,19 @@ function nuevoFiltro(usar, patron, tipo) {
var lista = document.getElementById("filterlist");
var fila = document.createElement("tr");
- var selected = ['', '', '', ''];
- selected[tipo] = ' selected="selected"';
+ var selected = ['', '', '', ''];
+ selected[tipo] = ' selected="selected"';
var html = '<td><input type="checkbox" name="f-enabled"'
+ (usar ? ' checked="checked"></td>' : '></td>');
html += '<td><input type="text" name="f-pattern" value="' + patron + '"></td>';
html += '<td><select class="f-type">'
- + '<option value="0"' + selected[0] + '>Mensaje</option>'
- + '<option value="1"' + selected[1] + '>ID</option>'
- + '<option value="2"' + selected[2] + '>Tripcode</option>'
- + '<option value="3"' + selected[3] + '>Nombre</option>'
- + '</select></td>';
- html += '<td><input type="button" name="f-remove" class="f-remove" value="x"></td>';
- fila.innerHTML = html;
+ + '<option value="0"' + selected[0] + '>Mensaje</option>'
+ + '<option value="1"' + selected[1] + '>ID</option>'
+ + '<option value="2"' + selected[2] + '>Tripcode</option>'
+ + '<option value="3"' + selected[3] + '>Nombre</option>'
+ + '</select></td>';
+ html += '<td><input type="button" name="f-remove" class="f-remove" value="x"></td>';
+ fila.innerHTML = html;
fila.children[3].firstChild.addEventListener('click', quitarFiltro);
lista.appendChild(fila);
}
@@ -201,7 +178,46 @@ function guardarFiltros() {
}
}
+function importar() {
+ var url = location.href;
+ if (url.includes('#import=')) {
+ var data = location.href.split('#import=')[1];
+ var conf = JSON.parse( decodeURIComponent(data) );
+ for (var c in conf) {
+ localStorage.setItem(c, conf[c]);
+ }
+ }
+}
+
+function exportar(e) {
+ var keys = Object.keys(localStorage);
+ var conf = {};
+ for (var i=0; i < keys.length; i++) {
+ var value = localStorage.getItem(keys[i]);
+ if (value.trim() != '') {
+ conf[keys[i]] = value;
+ }
+ }
+ var data = encodeURIComponent( JSON.stringify(conf) );
+ var box = document.getElementById('config-url');
+ if (!box) {
+ var box = document.createElement('input');
+ box.id = 'config-url';
+ box.type = 'text';
+ box.readOnly = true;
+ e.target.parentElement.appendChild(box);
+ var div = document.createElement('div');
+ div.textContent = 'Copia y pega el enlace generado en un navegador para importar tu configuración.';
+ e.target.parentElement.appendChild(div);
+ }
+ box.value = location.href.split('#')[0] + '#import=' + data;
+ box.focus();
+ box.select();
+}
+
document.addEventListener("DOMContentLoaded", function() {
+ importar();
+
if (localStorage.hasOwnProperty("weabot")) {
weabot = JSON.parse(localStorage.getItem("weabot"));
} else {
@@ -215,11 +231,11 @@ document.addEventListener("DOMContentLoaded", function() {
}
setInputs();
- cargarEstilos();
checkboxes();
cargarFiltros();
document.getElementById('switchview').addEventListener('click', cambiarModo);
+ document.getElementById('export').addEventListener('click', exportar);
init('bbs');
init('ib');
diff --git a/static/js/weabot.js b/static/js/weabot.js
index afe65c8..c4a73b5 100644
--- a/static/js/weabot.js
+++ b/static/js/weabot.js
@@ -2,7 +2,12 @@ var style_cookie = "weabot_style_ib";
if (localStorage.hasOwnProperty(style_cookie)) {
var css = document.getElementById("css");
if (css) {
- css.href = "/static/css/" + localStorage.getItem(style_cookie).toLowerCase() + ".css";
+ var style = localStorage.getItem(style_cookie).trim().toLowerCase();
+ if (style != "") {
+ css.href = "/static/css/" + style + ".css";
+ } else {
+ localStorage.removeItem(style_cookie);
+ }
}
}
@@ -277,7 +282,9 @@ document.addEventListener("DOMContentLoaded", function(e) {
if (document.getElementById("postform")) {
setInputs("postform");
- postform.file.addEventListener("change", filePreview);
+ if (postform.file) {
+ postform.file.addEventListener("change", filePreview);
+ }
}
var del = document.getElementById("delform");
diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js
index 273856d..06819ff 100644
--- a/static/js/weabotxt.js
+++ b/static/js/weabotxt.js
@@ -2,7 +2,12 @@ var style_cookie = "weabot_style_bbs";
if (localStorage.hasOwnProperty(style_cookie)) {
var css = document.getElementById("css");
if (css) {
- css.href = "/static/css/txt/" + localStorage.getItem(style_cookie).toLowerCase() + ".css";
+ var style = localStorage.getItem(style_cookie).trim().toLowerCase();
+ if (style != "") {
+ css.href = "/static/css/txt/" + localStorage.getItem(style_cookie).toLowerCase() + ".css";
+ } else {
+ localStorage.removeItem(style_cookie);
+ }
}
}
@@ -225,42 +230,101 @@ function togglePost(e) {
localStorage.setItem("hid-p-"+board, hid.join("!"));
}
-function smallsjis() {
- var rx = /(  \|  /|\  |/  | ̄ ̄||  |  ||\|  |  \|)/;
- var msg = document.getElementsByClassName("msg");
- for (var i=0; i < msg.length; i++) {
- if (msg[i].textContent.match(rx)) {
- msg[i].classList.add("sjis-mob");
- }
- }
-}
-function setLocalTime() {
- if (weabot.localtime != true) {
- return;
- }
- week = ["dom", "lun", "mar", "mie", "jue", "vie", "sab"];
- var dt = document.getElementsByClassName("date");
- for (var i = 0; i < dt.length; i++) {
- dt[i].textContent = localTime(dt[i].dataset.unix);
- }
-}
function localTime(timestamp) {
var newdate = new Date(timestamp * 1000);
- newdate =
- ("0" + newdate.getDate()).slice(-2) + "/" +
- ("0" + (newdate.getMonth() + 1)).slice(-2) +
- "/" + newdate.getFullYear().toString().slice(-2) +
- "(" + week[newdate.getDay()] + ")" +
- ("0" + newdate.getHours()).slice(-2) + ":" +
- ("0" + newdate.getMinutes()).slice(-2) + ":" +
- ("0" + newdate.getSeconds()).slice(-2);
- return newdate;
+ newdate =
+ ("0" + newdate.getDate()).slice(-2) + "/" +
+ ("0" + (newdate.getMonth() + 1)).slice(-2) +
+ "/" + newdate.getFullYear().toString().slice(-2) +
+ "(" + week[newdate.getDay()] + ")" +
+ ("0" + newdate.getHours()).slice(-2) + ":" +
+ ("0" + newdate.getMinutes()).slice(-2) + ":" +
+ ("0" + newdate.getSeconds()).slice(-2);
+ return newdate;
}
function parsePosts() {
-
+ if (!weabot.localtime && !weabot.filters && clientw > 600) {
+ return;
+ }
+
+ console.log('parsePosts() begin');
+ var sjisrx = /(  \|  /|\  |/  | ̄ ̄||  |  ||\|  |  \|)/;
+
+ var p = document.getElementsByClassName("reply");
+ for (var i = 0; i < p.length; i++) {
+ if (p[i].classList.contains('deleted')) {
+ continue;
+ }
+ if (weabot.localtime) {
+ var date = p[i].getElementsByClassName("date")[0];
+ date.textContent = localTime(date.dataset.unix);
+ }
+ if (weabot.filters) {
+ var hit = false;
+ for (var f in active) {
+ if (active[f].type == 0) { //mensaje
+ var rx = new RegExp(active[f].pattern);
+ if (p[i].getElementsByClassName('msg')[0].textContent.match(rx)) {
+ hit = true;
+ break;
+ }
+ } else if (active[f].type == 1) { //ID
+ if (p[i].getElementsByClassName('hash')[0].textContent
+ == ('ID:'+active[f].pattern)) {
+ hit = true;
+ break;
+ }
+ } else if (active[f].type == 2) { //tripcode
+ var trip = p[i].getElementsByClassName('trip')[0];
+ if (trip) {
+ if (trip.textContent.split(' ')[0] == ('◆'+active[f].pattern)) {
+ hit = true;
+ break;
+ }
+ }
+ } else if (active[f].type == 3) { //nombre
+ if (p[i].getElementsByClassName('name')[0].textContent.startsWith(active[f].pattern)) {
+ hit = true;
+ break;
+ }
+ }
+ }
+ if (hit) {
+ p[i].classList.add('hidden');
+ }
+ }
+ if (clientw <= 600) {
+ var msg = p[i].getElementsByClassName('msg')[0];
+ if (msg.textContent.match(sjisrx)) {
+ msg.classList.add("sjis-mob");
+ }
+ }
+ }
+}
+
+function loadFilters() {
+ if (!weabot.filters) { return; }
+
+ if (localStorage.hasOwnProperty("weabot-filtros")) {
+ var filtros = JSON.parse(localStorage.getItem("weabot-filtros"));
+ active = [];
+ for (var f in filtros) {
+ if (filtros[f].usar) {
+ active.push({
+ type: filtros[f].tipo,
+ pattern: filtros[f].patron
+ });
+ }
+ }
+ if (active.length == 0) {
+ weabot.filters = false;
+ }
+ } else {
+ weabot.filters = false;
+ }
}
document.addEventListener("DOMContentLoaded", function() {
@@ -279,20 +343,21 @@ document.addEventListener("DOMContentLoaded", function() {
};
}
- var head = document.getElementById("main_nav");
- if (head) {
- document.getElementById("b-" + board).className = 'cur_brd';
+ var b_link = document.getElementById("b-" + board);
+ if (b_link) {
+ b_link.className = 'cur_brd';
}
clientw = document.body.clientWidth;
if (clientw < 800) {
+ var head = document.getElementById('main_nav');
if (head) {
var navlink = head.children;
var sel = document.createElement("select");
sel.id = head.id + "_sel";
sel.addEventListener("change", function(e){
- window.location.href = e.target.value;
+ window.location.href = e.target.value;
});
for (var i=1; i < navlink.length; i++) {
@@ -312,9 +377,6 @@ document.addEventListener("DOMContentLoaded", function() {
document.body.style.marginTop = "2em";
}
}
- if (clientw < 600) {
- smallsjis();
- }
});
window.addEventListener("load", function() {
@@ -325,9 +387,13 @@ window.addEventListener("load", function() {
}
}
+ if (weabot.localtime) {
+ week = ["dom", "lun", "mar", "mie", "jue", "vie", "sab"];
+ }
+
checkHidden();
- setLocalTime();
- //parsePosts();
+ loadFilters();
+ parsePosts();
if (document.getElementById("threads")) {
listPrepare();