diff options
-rw-r--r-- | cgi/templates/kako.html | 4 | ||||
-rw-r--r-- | cgi/templates/revision.html | 2 | ||||
-rw-r--r-- | cgi/templates/stats.html | 2 | ||||
-rwxr-xr-x | cgi/weabot.py | 4 | ||||
-rw-r--r-- | static/css/txt/bbs.css | 5 | ||||
-rw-r--r-- | static/css/txt/material.css | 84 | ||||
-rw-r--r-- | static/js/shobon.js | 35 |
7 files changed, 120 insertions, 16 deletions
diff --git a/cgi/templates/kako.html b/cgi/templates/kako.html index 49d95df..921606e 100644 --- a/cgi/templates/kako.html +++ b/cgi/templates/kako.html @@ -8,7 +8,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="shortcut icon" href="#{static_url}img/favicon.ico" /> <style type="text/css"> - body {margin:8px} + body {background:#FFF;color:#000;margin:8px} h1 {margin:0 0 20px} pre {margin:0} .fake {color:#0000EE;text-decoration:underline;cursor:pointer} @@ -55,6 +55,6 @@ </table> <hr /> </pre> -<address>weabot/0.8.4 (CentOS) Servidor ubicado en bienvenidoainternet.org Puerto 443</address> +<address>weabot/<?py include('templates/revision.html') ?> (Debian GNU/Linux) Servidor ubicado en bienvenidoainternet.org Puerto 443</address> </body> </html>
\ No newline at end of file diff --git a/cgi/templates/revision.html b/cgi/templates/revision.html index 6201b5f..5c5cbb3 100644 --- a/cgi/templates/revision.html +++ b/cgi/templates/revision.html @@ -1 +1 @@ -0.8.8 +0.8.8
\ No newline at end of file diff --git a/cgi/templates/stats.html b/cgi/templates/stats.html index dd0e5ab..6cfe4f1 100644 --- a/cgi/templates/stats.html +++ b/cgi/templates/stats.html @@ -160,4 +160,4 @@ td a{display:block;padding:5px} <div id="foot">B.a.I. - 2010-2019 · Contacto: <a href="mailto:burocracia@bienvenidoainternet.org">burocracia@bienvenidoainternet.org</a></div> </body> -</html> +</html>
\ No newline at end of file diff --git a/cgi/weabot.py b/cgi/weabot.py index a85c2e7..f5451d9 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -39,7 +39,7 @@ class weabot(object): self.start = start_response - if self.environ["QUERY_STRING"] != "rawpost": + if self.environ.get("QUERY_STRING") != "rawpost": self.formdata = getFormData(self) self.output = "" @@ -599,7 +599,7 @@ class weabot(object): # process files if oek_file: try: - fname = "%s/%s/temp/%s.png" % (Settings.IMAGES_DIR, board['dir'], oek_file) + fname = os.path.join(Settings.IMAGES_DIR, board['dir'], "temp", oek_file + ".png") with open(fname, 'rb') as f: file = f.read() except: diff --git a/static/css/txt/bbs.css b/static/css/txt/bbs.css index b4372eb..477309a 100644 --- a/static/css/txt/bbs.css +++ b/static/css/txt/bbs.css @@ -20,14 +20,13 @@ pre{line-height:125%;margin:0;white-space:pre-wrap} #main_nav .cur_brd,#cur_stl,.locked{font-weight:bold} #main_nav{font-size:14px;padding:4px 0;text-align:center;width:100%} #main_nav a,#thread_nav a,#threadlinks a,.threadlinks a,label{display:inline-block} -.outerbox,.mainpage .thread,#footer,#content{margin-bottom:1em;margin-left:2.5%;margin-right:2.5%} +.outerbox,.mainpage .thread,#footer,#content{margin:0 2.5% 1em} .innerbox{padding:7px;margin:7px} .threadnav{float:right;font-family:mona,monapo,ipamonapgothic,monapo,'ms pgothic',yozfontaa97} #search input{margin-right:2px} #search input[type="text"]{padding:4px;max-width:500px;width:100%} .links{font-size:14px;text-align:center} -#threadlinks{margin-bottom:7px;text-align:center} -#threadlinks a{margin:0 4px} +#threadlinks{margin-bottom:.5em;text-align:center} #threadlist{font-size:14px;line-height:1;max-height:15em;overflow-y:scroll} #threadlist a{text-decoration:none} #thread_nav{padding-left:6px} diff --git a/static/css/txt/material.css b/static/css/txt/material.css new file mode 100644 index 0000000..dac8d7c --- /dev/null +++ b/static/css/txt/material.css @@ -0,0 +1,84 @@ +body,textarea{color:#111} +body{background:#f5f5f5} +a{color:#00BCD4;text-decoration:none} +a:hover{color:#FF6961} +.msg a{color:#111;text-decoration:underline} +.msg a:hover{color:#438ac1} +h1{font-size:30px;margin:0;background:#1a2357;margin:-7px -7px 16px;padding:16px;font-variant:small-caps;box-shadow:0 2px 10px #000} +h2{margin-bottom:.5em} +h2 span{color:#CCC} +h2 a{color:#616161} +h3{border-bottom:1px solid #CCC;color:#4b01d1;font-weight:bold;margin:0 0 8px;padding-bottom:8px;text-align:center} +h3 span{display:block;font-size:smaller;font-weight:normal;opacity:.7} +h4{color:#AAA;font-size:12px} +hr,#size,.banner,.threadpage .postform br{display:none} +#main_nav{background:#4b01d1;font-size:1px;font-size:0;position:relative;z-index:9} +#thread_nav{background:#303F9F;margin:-8px -8px -100px;padding:16px 0 116px;text-align:center} +#main_nav a,#thread_nav a{background:#FFF;border-radius:2px;color:#000;display:inline-block;font-size:14px;margin:0 2px;padding:2px} +#main_nav a:hover,.threadlinks a:hover,#thread_nav a:hover,#threadlist a:hover{background:#DDD} +#titlebox a,#threadbox a{color:#FFF} +#rules a:hover,.links a:hover,#threadlinks a:hover{border-radius:4px;margin:-2px;padding:2px;background:#1f285a;display:inline-block} +#titlebox,#createbox,#footer,.end{background:#303F9F;color:#FFF;margin:0} +#rules,#search{margin:1em 1em 0} +#threadbox{background:#3f51b5;color:#FFF;margin:0 0 -150px;padding:0 1em 150px} +.mainpage #threadbox .innerbox:after{content:'';box-shadow:0 0 20px 25px #3f51b5;display:block;position:relative;z-index:9} +#threadlinks{text-transform:uppercase} +#threadlist a{background:#FFF;border-bottom:1px solid #182050;border-radius:5px;color:#303F9F;display:inline-block;padding:3px;margin:3px} +.threadnav a{color:#FFF;padding:4px;display:inline-block} +.innerbox{margin:0} +.thread,.outerbox,#content{background:#FFF;margin-top:2em} +.mainpage .thread{margin-top:2em} +.thread,#content,.threadpage .postform{box-shadow:0px 2px 2px 0px rgba(0,0,0,.14),0px 3px 1px -2px rgba(0,0,0,.2),0px 1px 5px 0px rgba(0,0,0,.12);} +.thread .innerbox{background:#FFF;margin:0;padding:16px} +.threadpage .thread,.threadpage .postform{margin:0 2.5%;padding:1em} +.thread textarea,.threadpage textarea,.mainpage .threadlinks{margin-top:.5em} +input[type="submit"],input[type="button"],button,.lastposts a,#n2{background:#2296f3;border:0;border-radius:5px;box-shadow:0 2px 5px rgba(0,0,0,.12);color:#FFF;text-transform:uppercase;padding:6px} +input[type="submit"]:active,input[type="button"]:active,button:active,.threadnav a:hover{background:#438ac1} +input[type="text"],textarea,#search input[type="text"]{border:1px solid #CCC;border-radius:2px;padding:6px} +textarea{width:100%} +select{border-radius:2px;background:#2296f3 url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAADCAYAAABbNsX4AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4wQBBAYpAtmVHwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAfSURBVAjXY/z///9/BjTAyMDAwIAswcjIyAiXRZYAAKlrC/sti8JVAAAAAElFTkSuQmCC) no-repeat 95%;border:0;padding:0;color:#FFF;appearance:none;-webkit-appearance:none;-moz-appearance:none;} +a .name,.name,.abbrev{color:#2296f3} +.name em{color:#009} +.del{margin-right:4px} +.del a{color:#000} +a.thumb{margin-top:4px} +.q{color:#666} +a.yt{background:#FFF;border:1px solid #CCC;box-shadow:0 4px 10px -4px #CCC;color:#444;text-decoration:none} +a.yt,.yt .pvw{border-radius:10px} +.deleted{color:#AFAFAF;margin-bottom:24px} +#q-p{background:#FFF;border:1px solid #DDD;box-shadow:0 0 5px #CCC} +.lastposts{padding:16px 0;font-size:1px;font-size:0;text-align:center} +.lastposts a,.lastposts #n2{background:#ff4081;margin-right:5px;text-decoration:none} +.lastposts a:active,#n2:active{background:#b22d5a} +.threadpage .threadlinks{margin:0;margin-bottom:8px} +#counter,.threadnav a{background:#2296f3;border-radius:100%;box-shadow:0 2px 5px rgba(0,0,0,.12)} +.lastposts a,#n2,#counter{color:#FFF;display:inline-block;font-size:16px;padding:5px} +.mainpage .postform,.formpad{padding-left:0} +.mainpage .postform{margin:1em -1em -1em;padding:1em} +.postform{background:#EEE;color:#666;text-align:center} +.threadlinks a{background:#FFF;border-radius:.2em;color:#00BCD4;display:inline-block;font-size:smaller;padding:.2em;text-transform:uppercase} +form .msg{border:1px dotted #AAA;background:#FFF;color:#111} +h5{font-variant:small-caps;text-align:center} +#createbox{margin-top:2em;padding-top:1em} +#createbox .innerbox{padding:0} +#createbox table{margin:0 auto} +#createbox .threadnav{right:7px;position:relative} +#footer{padding:1em} +#footer a{color:#FFF} +.end{margin:-100px -8px -8px;padding:116px 0 16px;position:relative;text-align:center;z-index:-1} +#content .thread{background:none;box-shadow:none} +#content.list #header div{background:#FFF;border-bottom:1px solid #CCC} +#content .row:hover{background:#EEE} +#content.list .row div{border-bottom:1px solid #EEE} +#content.grid .row{border:1px solid #EEE;margin:0} +@media(max-width:720px){ + h1{font-size:18px} + #threadbox{padding-left:0;padding-right:0} + #rules,#search{margin-left:0;margin-right:0} + .thread .innerbox{padding:.5em} + .mainpage .thread{margin:2em .5em} + .mainpage .postform{margin:.5em -.5em -.5em;padding:.5em} + .threadpage .thread,.threadpage .postform{margin:0;padding:.5em} + .lastposts{padding:8px 0} + .postform>span{margin-top:.5em} +}
\ No newline at end of file diff --git a/static/js/shobon.js b/static/js/shobon.js index b4e48f6..c9bce95 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -43,8 +43,7 @@ function shobon() { } var lastReplyN = replyList[replyList.length - 1].attributes["data-n"].value; - - if (localStorage.getItem(boardName + "_" + threadId) == null) { + if(localStorage.getItem("shobon_newposts") == "true" && localStorage.getItem(boardName + "_" + threadId) == null) { localStorage.setItem(boardName + "_" + threadId, lastReplyN); } var lastSeen = localStorage.getItem(boardName + "_" + threadId); @@ -75,13 +74,18 @@ function shobon() { replaceCountryName(reply) } // colorea los id's - if(localStorage.getItem("shobon_ids") != "false") { + if(localStorage.getItem("shobon_ids") == "true") { paintIds(reply); } // deja la barra superior fija if(localStorage.getItem("shobon_navbar") == "true") { fixedNav(); } + // incluye imagenes + if(localStorage.getItem("shobon_embedimg") == "true") { + embedImg(reply); + } + } if (newRepliesInThread > 0 && !inThread) { thread.getElementsByClassName("threadlinks")[0].innerHTML += "<span onClick='localStorage.setItem(\"" + boardName + "_" + threadId + "\" , " + lastReplyN + "); this.hidden = true;' style='font-weight: bold; background: #81a2be; padding: 5px; border-radius: 5px; float: right; margin-bottom: 10px;'>Marcar como leido</span>"; @@ -96,10 +100,9 @@ function shobon() { document.body.appendChild(banner); } - if (inThread) { + if(localStorage.getItem("shobon_newposts") == "true" && inThread) { localStorage.setItem(boardName + "_" + threadId, lastReplyN); } - } function on_checked(e) { @@ -238,7 +241,8 @@ function shobonSettings(e) { var p = document.createElement("div"); 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_ids", "Colorear IDs", false)); + p.appendChild(createCheckbox("shobon_embedimg", "Incluir 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)); p.appendChild(createCheckbox("shobon_time", "Convertir fechas a hora local", true)); @@ -364,6 +368,23 @@ function paintIds(reply) { } } +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++) { @@ -405,4 +426,4 @@ function fixedNav() { } } -document.addEventListener('DOMContentLoaded', shobon, false);
\ No newline at end of file +document.addEventListener('DOMContentLoaded', shobon, false); |