aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jay 2019-04-11 02:15:26 -0400
committerLibravatar Jay 2019-04-11 02:28:34 -0400
commit7c83a7e4807b387894abdb4b6edaa92479cc9281 (patch)
treea0a519755755ecb254db25ad9757df4ab80f0f74
parentff5c78c312ac1f043835415bca210a072e8551d6 (diff)
downloadweabot-7c83a7e4807b387894abdb4b6edaa92479cc9281.tar.gz
weabot-7c83a7e4807b387894abdb4b6edaa92479cc9281.tar.xz
weabot-7c83a7e4807b387894abdb4b6edaa92479cc9281.zip
IB: Moviendo tamaños legibles a shobon y subiendo menú de estilos
De paso no hay que agregar el mismo menú a cada plantilla que el IB tiene.
-rw-r--r--cgi/templates/base_top.html11
-rw-r--r--cgi/templates/board.html6
-rw-r--r--cgi/templates/board.jp.html6
-rw-r--r--static/css/ib.css6
-rw-r--r--static/js/shobon.js26
-rw-r--r--static/js/weabot.js26
6 files changed, 38 insertions, 43 deletions
diff --git a/cgi/templates/base_top.html b/cgi/templates/base_top.html
index 6c51bef..424c309 100644
--- a/cgi/templates/base_top.html
+++ b/cgi/templates/base_top.html
@@ -35,12 +35,17 @@
<?py if board == "2d": ?>
<link rel="stylesheet" href="#{static_url}css/txt/sjis.css" />
<?py #endif ?>
- <script type="text/javascript" src="#{static_url}js/weabot.js?v=5"></script>
+ <script type="text/javascript" src="#{static_url}js/weabot.js"></script>
<script type="text/javascript" src="#{static_url}js/aquiencitas.js"></script>
- <script type="text/javascript" src="#{static_url}js/autorefresh.js?v=3"></script>
+ <script type="text/javascript" src="#{static_url}js/autorefresh.js"></script>
</head>
<body#{' class="res"' if replythread else ''} data-brd="#{board}">
- <div id="main_nav">[<a href="/" target="_top">Bienvenido a Internet</a>] [<?py include('templates/navbar.html') ?>]</div>
+ <div id="main_nav"><span>[<a href="/" target="_top">Bienvenido a Internet</a>] [<?py include('templates/navbar.html') ?>]</span>
+ <?py if not force_css: ?>
+ <span>[Estilo: <select id="styles">
+ <?py for title in styles: ?><option value="#{title}">#{title}</option><?py #endfor ?>
+ </select>]</span>
+<?py #endif ?></div>
<div class="logo">
<?py if board: ?>
#{board_long}
diff --git a/cgi/templates/board.html b/cgi/templates/board.html
index 0583230..4b94e87 100644
--- a/cgi/templates/board.html
+++ b/cgi/templates/board.html
@@ -261,10 +261,4 @@
<?py if pagenav: ?>
<div class="pg">#{pagenav}</div>
<?py #endif ?>
-<?py if not force_css: ?>
- <div class="selector"><b>Estilo:</b><select id="styles">
- <?py for title in styles: ?><option value="#{title}">#{title}</option><?py #endfor ?>
- </select>
- </div>
-<?py #endif ?>
<?py include('templates/base_bottom.html') ?> \ No newline at end of file
diff --git a/cgi/templates/board.jp.html b/cgi/templates/board.jp.html
index 12772e8..a595780 100644
--- a/cgi/templates/board.jp.html
+++ b/cgi/templates/board.jp.html
@@ -268,10 +268,4 @@
<?py if pagenav: ?>
<div class="pg">#{pagenav}</div>
<?py #endif ?>
-<?py if not force_css: ?>
- <div class="selector"><b>外観:</b><select id="styles">
- <?py for title in styles: ?><option value="#{title}">#{title}</option><?py #endfor ?>
- </select>
- </div>
-<?py #endif ?>
<?py include('templates/base_bottom.html') ?> \ No newline at end of file
diff --git a/static/css/ib.css b/static/css/ib.css
index 55e8012..e338d6d 100644
--- a/static/css/ib.css
+++ b/static/css/ib.css
@@ -1,13 +1,14 @@
*{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;word-wrap:break-word}
html,body{font-family:arial,helvetica,"nimbus sans l",sans-serif}
html{margin:0;padding:0}
-body{margin:0;padding:10px;font-size:16px}
+body{margin:0;padding:8px;font-size:16px}
blockquote{line-height:20px}
.spoil{background:#000;color:#000}.spoil:hover{color:#fff}
.postarea table{margin:0 auto;text-align:left}
#main_nav{font-size:14px;line-height:1.3em;margin-bottom:.5em;text-align:center}
#main_nav span{display:inline-block}
-#main_nav #sel,#main_nav .cur_brd,#main_nav #cur_stl{font-weight:bold}
+#main_nav #sel,#main_nav .cur_brd{font-weight:bold}
+select{background:#FFF;border:1px inset #DDD;color:#000;font-size:85%;padding:1px}
.logo{font-size:160%;font-weight:bold;margin:8px 0;text-align:center}
input[type="text"],input[type="password"],textarea{background:#FFF;border:1px inset gray;padding:3px}
.postform input{max-width:250px}
@@ -56,6 +57,7 @@ input[type="text"],input[type="password"],textarea{background:#FFF;border:1px in
@media(max-width:900px){.thread{margin-right:0}}
@media(max-width:720px){
body{font-size:15px;padding:4px}
+ #main_nav span{display:block;margin-top:8px}
.postblock{font-size:14px;white-space:nowrap}
.pass,.ell,.thumbmsg{display:none}
.thread table,#postform input[type="text"],#postform input[type="submit"],#postform textarea,#postform input[type="file"],.rules{max-width:100%;width:100%}
diff --git a/static/js/shobon.js b/static/js/shobon.js
index b9e265c..5c65e94 100644
--- a/static/js/shobon.js
+++ b/static/js/shobon.js
@@ -95,7 +95,10 @@ function shobon() {
if(localStorage.getItem("shobon_embedimg") == "true") {
embedImg(reply);
}
-
+ // convertir tamaños de archivo a formato legible
+ if(localStorage.getItem("shobon_size") == "true") {
+ fixFileSize();
+ }
}
if (newRepliesInThread > 0 && !inThread) {
var btnNew = document.createElement("span");
@@ -284,6 +287,7 @@ function shobonSettings(e) {
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_size", "Tamaños de archivo legibles", 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));
@@ -431,6 +435,26 @@ function markId(e) {
}
}
+function readableSize(B) {
+ var thresh = 1024;
+ if(Math.abs(B) < thresh) return B + " B";
+ var units = ["KB","MB","GB"];
+ var u = -1;
+ do {
+ B /= thresh;
+ ++u;
+ } while(Math.abs(B) >= thresh && u < units.length - 1);
+ return B.toFixed(1)+" "+units[u];
+}
+function fixFileSize(){
+ var obj = document.getElementsByClassName("fs");
+ for (var i=0; i<obj.length; i++){
+ var parts = obj[i].childNodes[2].textContent.split(" B, ");
+ var filesize = parts[0].substring(2);
+ obj[i].childNodes[2].textContent = "-(" + readableSize(filesize) + ", " + parts[1];
+ }
+}
+
function embedImg(reply) {
var links = reply.getElementsByTagName("a");
for(i=0;i<links.length&&i<5;i++) {
diff --git a/static/js/weabot.js b/static/js/weabot.js
index f063735..3f8aac7 100644
--- a/static/js/weabot.js
+++ b/static/js/weabot.js
@@ -327,34 +327,11 @@ function catHidden() {
lbl.appendChild(shw); lbl.appendChild(document.createTextNode("]"));
}
-function applyTheme(){
+function applyTheme() {
var newTheme = document.getElementById("styles").value;
set_stylesheet(newTheme);
}
-function humanFileSize(bytes) {
- var thresh = 1024;
- if(Math.abs(bytes) < thresh) {
- return bytes + ' B';
- }
- var units = ['kB','MB','GB'];
- var u = -1;
- do {
- bytes /= thresh;
- ++u;
- } while(Math.abs(bytes) >= thresh && u < units.length - 1);
- return bytes.toFixed(1)+' '+units[u];
-}
-
-function fixFileSize(){
- var obj = document.getElementsByClassName("fs");
- for (var i = 0; i < obj.length; i++){
- var parts = obj[i].childNodes[2].textContent.split(" B, ");
- var filesize = parts[0].substring(2);
- obj[i].childNodes[2].textContent = " (" + humanFileSize(filesize) + ", " + parts[1];
- }
-}
-
document.addEventListener("DOMContentLoaded", function(e) {
checkhighlight();
if (localStorage.hasOwnProperty("weabot")) weabot = JSON.parse(localStorage.getItem("weabot"));
@@ -399,7 +376,6 @@ document.addEventListener("DOMContentLoaded", function(e) {
types = document.getElementById("filetypes").innerText.split(", ");
if (types.includes("JPG")) types.push("JPEG");
postform.file.addEventListener("change", filePreview);
- fixFileSize();
}
var del = document.getElementById("delform");