diff options
author | junk | 2021-03-27 20:20:28 -0300 |
---|---|---|
committer | junk | 2021-03-27 20:53:56 -0300 |
commit | 9b039e42df4eefb7971a2cfa19bce260ab4ef08f (patch) | |
tree | 5ad65f7f0dabaa439745daeae5a7dd374c8a1b03 | |
parent | 0e86988ba9099072dcd2af5142f8f4e988908e9b (diff) | |
download | weabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.tar.gz weabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.tar.xz weabot-9b039e42df4eefb7971a2cfa19bce260ab4ef08f.zip |
Arreglando diseño para móviles
-rw-r--r-- | cgi/templates/mobile/base_top.html | 4 | ||||
-rw-r--r-- | cgi/templates/mobile/board.html | 6 | ||||
-rw-r--r-- | cgi/templates/mobile/latest.html | 2 | ||||
-rw-r--r-- | cgi/templates/mobile/threadlist.html | 2 | ||||
-rw-r--r-- | cgi/templates/mobile/txt_newthread.html | 2 | ||||
-rw-r--r-- | cgi/templates/mobile/txt_thread.html | 2 | ||||
-rw-r--r-- | cgi/templates/mobile/txt_threadlist.html | 2 | ||||
-rw-r--r-- | cgi/templates/navbar.html | 4 | ||||
-rw-r--r-- | cgi/templates/txt_board.html | 10 | ||||
-rw-r--r-- | cgi/templates/txt_thread.en.html | 1 | ||||
-rw-r--r-- | cgi/templates/txt_thread.html | 11 | ||||
-rw-r--r-- | cgi/templates/txt_threadlist.html | 41 | ||||
-rw-r--r-- | static/css/ib.css | 5 | ||||
-rw-r--r-- | static/css/mobile.css | 11 | ||||
-rw-r--r-- | static/css/txt/bbs.css | 20 | ||||
-rw-r--r-- | static/js/mobile.js | 19 | ||||
-rw-r--r-- | static/js/shobon.js | 98 | ||||
-rw-r--r-- | static/js/weabot.js | 212 | ||||
-rw-r--r-- | static/js/weabotxt.js | 119 |
19 files changed, 191 insertions, 380 deletions
diff --git a/cgi/templates/mobile/base_top.html b/cgi/templates/mobile/base_top.html index 6a6c5bd..aa016a4 100644 --- a/cgi/templates/mobile/base_top.html +++ b/cgi/templates/mobile/base_top.html @@ -9,6 +9,6 @@ <?py #endif ?> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="shortcut icon" href="#{static_url}img/favicon.ico" /> - <link rel="stylesheet" type="text/css" href="#{static_url}css/mobile.css?v=8" /> - <script type="text/javascript" src="#{static_url}js/mobile.js?v=9"></script> + <link rel="stylesheet" type="text/css" href="#{static_url}css/mobile.css" /> + <script type="text/javascript" src="#{static_url}js/mobile.js"></script> </head> diff --git a/cgi/templates/mobile/board.html b/cgi/templates/mobile/board.html index 70b8461..8466c8f 100644 --- a/cgi/templates/mobile/board.html +++ b/cgi/templates/mobile/board.html @@ -1,13 +1,13 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="img"><a name="top"></a> +<body class="img" data-brd="#{board}"><a name="top"></a> <div class="nav"><div><a href="//m.bienvenidoainternet.org">Home</a><a href="#{cgi_url}mobile/#{board}/">Volver</a><a href="#form">▼</a></div></div> <?py for thread in threads: ?> <div id="thread"> <?py for post in thread['posts']: ?> <?py if post['IS_DELETED'] == "1": ?> - <div class="pst"><h3 class="del"><a name="#{post['id']}"></a>No.#{post['id']} eliminado por el usuario.</h3></div> + <div class="pst"><h3 class="del"><a name="#{post['id']}"></a>No.#{post['id']} eliminado por usuario.</h3></div> <?py elif post['IS_DELETED'] == "2": ?> - <div class="pst"><h3 class="del"><a name="#{post['id']}"></a>No.#{post['id']} eliminado por miembro del staff.</h3></div> + <div class="pst"><h3 class="del"><a name="#{post['id']}"></a>No.#{post['id']} eliminado por staff.</h3></div> <?py else: ?> <?py if post['parentid'] == "0": ?> <div class="first"><h1>#{post["subject"]} <span>(#{thread['length']})</span></h1> diff --git a/cgi/templates/mobile/latest.html b/cgi/templates/mobile/latest.html index 91c3514..50fae25 100644 --- a/cgi/templates/mobile/latest.html +++ b/cgi/templates/mobile/latest.html @@ -1,5 +1,5 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="txt"> +<body class="txt" data-brd="#{board}"> <div class="top"> <a href="/movil.html"><img src="#{static_url}css/img/0info.png" /><br />Info</a> Bienvenido a Internet Móvil diff --git a/cgi/templates/mobile/threadlist.html b/cgi/templates/mobile/threadlist.html index edb81eb..4247ee9 100644 --- a/cgi/templates/mobile/threadlist.html +++ b/cgi/templates/mobile/threadlist.html @@ -1,5 +1,5 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="img"> +<body class="img" data-brd="#{board}"> <div class="top"> <a href="//m.bienvenidoainternet.org"><img src="#{static_url}css/img/0back.png" /><br />Home</a> #{board_name} diff --git a/cgi/templates/mobile/txt_newthread.html b/cgi/templates/mobile/txt_newthread.html index b19d2fa..aafcdfa 100644 --- a/cgi/templates/mobile/txt_newthread.html +++ b/cgi/templates/mobile/txt_newthread.html @@ -1,5 +1,5 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="#{"txt" if board_type == '1' else "img"}"> +<body class="#{"txt" if board_type == '1' else "img"}" data-brd="#{board}"> <div class="top"> <a href="//m.bienvenidoainternet.org"><img src="#{static_url}css/img/0back.png" /><br />Home</a> #{board_name} diff --git a/cgi/templates/mobile/txt_thread.html b/cgi/templates/mobile/txt_thread.html index 8a19a94..c9b58a8 100644 --- a/cgi/templates/mobile/txt_thread.html +++ b/cgi/templates/mobile/txt_thread.html @@ -1,5 +1,5 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="txt"> +<body class="txt" data-brd="#{board}"> <a name="top"></a> <?py for thread in threads: ?> <div class="nav"><div><a href="//m.bienvenidoainternet.org">Home</a><a href="#{cgi_url}mobile/#{board}/">Volver</a><a href="#form">▼</a></div></div> diff --git a/cgi/templates/mobile/txt_threadlist.html b/cgi/templates/mobile/txt_threadlist.html index 5e3d133..57cad18 100644 --- a/cgi/templates/mobile/txt_threadlist.html +++ b/cgi/templates/mobile/txt_threadlist.html @@ -1,5 +1,5 @@ <?py include('templates/mobile/base_top.html') ?> -<body class="txt"> +<body class="txt" data-brd="#{board}"> <div class="top"> <a href="//m.bienvenidoainternet.org"><img src="#{static_url}css/img/0back.png" /><br />Home</a> #{board_name} diff --git a/cgi/templates/navbar.html b/cgi/templates/navbar.html index e545776..e40e420 100644 --- a/cgi/templates/navbar.html +++ b/cgi/templates/navbar.html @@ -4,7 +4,7 @@ <a href="/musica/">Música</a> <a href="/letras/">Humanidades</a> <a href="/zonavip/">Club VIP</a> -<a href="/world/">World Lobby</a> +<a href="/world/">World</a> | <a href="/dqn/">Club DQN</a> <a href="/2d/">二次元画像</a> @@ -12,4 +12,4 @@ <a href="/o/">Oekaki</a> <a href="/0/">Cero</a> | -<a href="/bai/">Meta</a> +<a href="/bai/">Meta</a>
\ No newline at end of file diff --git a/cgi/templates/txt_board.html b/cgi/templates/txt_board.html index 63913ea..f819f05 100644 --- a/cgi/templates/txt_board.html +++ b/cgi/templates/txt_board.html @@ -46,9 +46,9 @@ <h2><span>[#{titer}:#{thread['length']}]</span><a href="#{boards_url}#{board}/read/#{thread['timestamp']}/#{'l50' if thread['length'] > 50 else ''}">#{thread['posts'][0]['subject']}</a></h2> <?py for post in thread['posts']: ?> <?py if post['IS_DELETED'] == '1': ?> - <h4 class="deleted">#{post['num']} Mensaje eliminado por el usuario.</h4> + <h4 class="deleted">#{post['num']} Mensaje eliminado por usuario.</h4> <?py elif post['IS_DELETED'] == '2': ?> - <h4 class="deleted">#{post['num']} Mensaje eliminado por miembro del staff.</h4> + <h4 class="deleted">#{post['num']} Mensaje eliminado por staff.</h4> <?py else: ?> <div class="reply#{' first' if post['num'] == 1 else ''}" data-id="#{post['id']}" data-n="#{post['num']}"> <h4>#{post['num']} : @@ -66,7 +66,7 @@ <?py #endif ?> <?py #endif ?> : <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span></h4> <?py if post['file']: ?> - <a href="/#{board}/src/#{post['file']}" target="_blank" class="thumb"><img src="#{'/static/' if post['thumb'].startswith('mime') else ('/'+board+'/thumb/')}#{post['thumb']}" width="#{post['thumb_width']}" height="#{post['thumb_height']}" /><div>${int(post['file_size'])//1024}KB ${post['file'].split(".")[1].upper()}</div></a> + <a href="/#{board}/src/#{post['file']}" target="_blank" class="thumb"><img src="#{'/static/' if post['thumb'].startswith('mime') else ('/'+board+'/thumb/')}#{post['thumb']}" width="#{post['thumb_width']}" height="#{post['thumb_height']}" alt="${post['file']}-(${post['file_size']}B)" /></a> <?py #endif ?> <div class="msg"> #{post['message']} @@ -81,7 +81,7 @@ <form id="postform#{thread['id']}" class="postform" action="#{cgi_url}post" method="post" enctype="multipart/form-data"> <input type="hidden" name="board" value="#{board}" /><input type="hidden" name="parent" value="#{thread['id']}" /><input type="hidden" name="password" value="" /> <div style="display:none"><input type="text" name="name" size="15" /> <input type="text" name="email" size="15" /></div> - <span><input type="submit" value="Responder" /></span> <span><span>Nombre: </span><input type="text" name="fielda" size="15" /><span> E-mail: </span><input type="text" name="fieldb" size="15" /></span> + <input type="submit" value="Responder" /> <span><span>Nombre: </span><input type="text" name="fielda" size="15" /> <span>E-mail: </span><input type="text" name="fieldb" size="15" /></span> <div class="formpad"> <textarea name="message" cols="70" rows="5"></textarea> <?py if allow_image_replies: ?><br /><input type="file" name="file" /><?py #endif ?> @@ -135,4 +135,4 @@ </div> <center id="footer"><a href="/" target="_top">Bienvenido a Internet BBS/IB</a> weabot.py <?py include('templates/revision.html') ?> + FastCGI + tenjin<br />No se ponga sensible, baisano...</center> </body> -</html> +</html>
\ No newline at end of file diff --git a/cgi/templates/txt_thread.en.html b/cgi/templates/txt_thread.en.html index c820a78..b9215f7 100644 --- a/cgi/templates/txt_thread.en.html +++ b/cgi/templates/txt_thread.en.html @@ -1,6 +1,5 @@ <?py include('templates/txt_base_top.html') ?> <body class="threadpage" data-brd="#{board}"> -<div id="main_nav" style="display:none;"><a href="/" target="_top">Bienvenido a Internet</a> | <?py include('templates/navbar.html') ?></div> <?py if threads: ?> <?py for thread in threads: ?> <div id="thread_nav"> diff --git a/cgi/templates/txt_thread.html b/cgi/templates/txt_thread.html index be257e6..55f5e82 100644 --- a/cgi/templates/txt_thread.html +++ b/cgi/templates/txt_thread.html @@ -1,6 +1,5 @@ <?py include('templates/txt_base_top.html') ?> <body class="threadpage" data-brd="#{board}"> -<div id="main_nav" style="display:none;"><a href="/" target="_top">Bienvenido a Internet</a> | <?py include('templates/navbar.html') ?></div> <?py if threads: ?> <?py for thread in threads: ?> <div id="thread_nav"> @@ -28,9 +27,9 @@ <h3>#{thread['subject']} <span>(${(str(thread['length'])+" respuestas") if thread['length']>1 else "Una respuesta"})</span></h3> <?py for post in thread['posts']: ?> <?py if post['IS_DELETED'] == '1': ?> - <h4 class="deleted">#{post['num']} : Mensaje eliminado por el usuario.</h4> + <h4 class="deleted">#{post['num']} : Mensaje eliminado por usuario.</h4> <?py elif post['IS_DELETED'] == '2': ?> - <h4 class="deleted">#{post['num']} : Mensaje eliminado por miembro del staff.</h4> + <h4 class="deleted">#{post['num']} : Mensaje eliminado por staff.</h4> <?py else: ?> <?py if post['num'] == 1: ?> <div class="reply first" data-n="#{post['num']}"> @@ -53,7 +52,7 @@ <?py #endif ?> : <span class="date" data-unix="#{post['timestamp']}">#{post['timestamp_formatted']}</span> <span class="del"><a href="#{cgi_url}report/#{board}/#{post['id']}/#{post['num']}">rep</a> <a href="#">del</a></span></h4> <?py if post['file']: ?> - <a href="/#{board}/src/#{post['file']}" target="_blank" class="thumb"><img src="#{'/static/' if post['thumb'].startswith('mime') else ('/'+board+'/thumb/')}#{post['thumb']}" width="#{post['thumb_width']}" height="#{post['thumb_height']}" /><div>${int(post['file_size'])//1024}KB ${post['file'].split(".")[1].upper()}</div></a> + <a href="/#{board}/src/#{post['file']}" target="_blank" class="thumb"><img src="#{'/static/' if post['thumb'].startswith('mime') else ('/'+board+'/thumb/')}#{post['thumb']}" width="#{post['thumb_width']}" height="#{post['thumb_height']}" alt="${post['file']}-(${post['file_size']}B)" /></a> <?py #endif ?> <div class="msg">#{post['message']}</div> </div> @@ -89,7 +88,7 @@ <input type="hidden" name="board" value="#{board}" /><input type="hidden" name="parent" value="#{thread['id']}" /><input type="hidden" name="password" value="" /> <?py if thread['locked'] != '1': ?> <div style="display:none"><input type="text" name="name" size="13" /> <input type="text" name="email" size="13" /></div> - <span><input type="submit" value="Responder" accesskey="z" /> <input type="button" name="preview" value="Previsualizar" /></span> <span><span>Nombre: </span><input type="text" name="fielda" size="13" accesskey="n" /><span> E-mail: </span><input type="text" name="fieldb" size="13" accesskey="e" /></span><br /> + <input type="submit" value="Responder" accesskey="z" /> <input type="button" name="preview" value="Previsualizar" /> <span><span>Nombre: </span><input type="text" name="fielda" size="13" accesskey="n" /> <span>E-mail: </span><input type="text" name="fieldb" size="13" accesskey="e" /></span><br /> <textarea name="message" cols="80" rows="7" accesskey="m"></textarea><br /> <div id="preview#{thread['id']}" class="msg" style="display:none"></div> <?py if allow_image_replies: ?> @@ -106,4 +105,4 @@ </div> <a name="bottom"></a> </body> -</html> +</html>
\ No newline at end of file diff --git a/cgi/templates/txt_threadlist.html b/cgi/templates/txt_threadlist.html index 0d68abb..74df30e 100644 --- a/cgi/templates/txt_threadlist.html +++ b/cgi/templates/txt_threadlist.html @@ -1,28 +1,38 @@ <?py include('templates/txt_base_top.html') ?> -<body class="threads" data-brd="#{board}"> +<body class="mainpage" data-brd="#{board}"> <div id="main_nav"><a href="/" target="_top">Bienvenido a Internet</a> | <?py include('templates/navbar.html') ?></div> <?py if banner_url: ?> <img class="banner" src="#{banner_url}" style="width:#{banner_width}px;height:#{banner_height}px;" /> <?py #endif ?> <div id="titlebox" class="outerbox"> - <div class="innerbox"><h1>#{board_long}</h1></div> + <div class="innerbox"> + <div class="threadnav"><a href="#menu" title="Ir a lista de hilos">■</a><a href="#1" title="Ir a primer hilo">▼</a></div> + <h1>#{board_long}</h1> + <?py if postarea_desc: ?> + <div id="rules">#{postarea_desc}</div> + <?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 links"><b>¿Eres nuevo?</b> <a href="/guia.html"><b>Cómo postear</b></a> | <a href="/faq.html"><b>Preguntas frecuentes</b></a> | <a href="/bai/"><b>Contacto</b></a> <?py if not force_css: ?>| <b>Estilo: </b><select id="styles"> <?py for title in txt_styles: ?><option value="#{title}">#{title}</option><?py #endfor ?></select> <?py #endif ?> - </div> </div> +</div> +<?py if postarea_extra: ?> +<div class="outerbox"><div class="innerbox">#{postarea_extra}</div></div> +<?py #endif ?> <a name="menu"></a> <div id="threadbox" class="outerbox"><div class="innerbox"> <div id="threadlinks"><a href="#{boards_url}#{board}/"><b>Volver al BBS</b></a> <a href="/#{board}/kako/"><b>Ver hilos archivados</b></a> <a href="#newthread"><b>Crear nuevo hilo</b></a></div> - <div id="listmenu">Orden: <a class="l_s" href="#">Normal</a> <a class="l_s" href="#">Edad</a> <a class="l_s" href="#">Largo</a> <a class="l_s" href="#">Rapidez</a> <a class="l_s" href="#">Aleatorio</a> / Modo: <a class="l_d" href="#">Lista</a> <a class="l_d" href="#">Malla</a> / Buscar: <input id="l_sr" style="padding:0px;width:100px;" type="text"></div> + <div id="listmenu">Orden: <a class="l_s" href="#">Normal</a> <a class="l_s" href="#">Edad</a> <a class="l_s" href="#">Largo</a> <a class="l_s" href="#">Rapidez</a> <a class="l_s" href="#">Aleatorio</a> / Modo: <a class="l_d" href="#">Lista</a> <a class="l_d" href="#">Malla</a> / Filtrar: <input id="l_sr" style="padding:0px;width:100px;" type="text"></div> </div></div> <div id="content" class="list"> <div id="header" class="row"> <div>#</div> <div style="width:100%;">Asunto</div> - <div>Resp.</div> - <div class="hdate">Última respuesta</div> + <div>Posts</div> + <div class="hdate">Último</div> </div> <?py iter = 1 ?> <?py for thread in more_threads: ?> @@ -39,27 +49,28 @@ <div id="createbox" class="outerbox"> <div class="extrabox"></div> <div class="innerbox"> + <div class="threadnav"><a href="#menu" title="Lista de hilos">■</a></div> <h5>Formulario de nuevo hilo</h5> <form id="postform0" action="#{cgi_url}post" method="post" enctype="multipart/form-data"> <input type="hidden" name="board" value="#{board}" /><input type="hidden" name="password" value="" /> - <table style="max-width:600px;"> + <table style="max-width:600px"> <tr> - <td style="text-align:right;">Asunto:</td> - <td colspan="3" style="width:100%;"><input type="text" name="subject" size="50" maxlength="100" /></td> + <td class="pblock">Asunto:</td> + <td colspan="3" style="width:100%"><input type="text" name="subject" size="50" maxlength="100" /></td> <td><input type="submit" value="Crear nuevo hilo" /></td> </tr> <tr> - <td style="text-align:right;">Nombre:</td><td><input type="text" name="fielda" /></td> - <td style="text-align:right;">E-mail:</td><td><input type="text" name="fieldb" /></td> + <td class="pblock">Nombre:</td><td><input type="text" name="fielda" /></td> + <td class="pblock">E-mail:</td><td><input type="text" name="fieldb" /></td> <td><input type="button" name="preview" value="Previsualizar" /></td> </tr> - <tr id="options" style="display:none;"><td></td><td colspan="4"><div id="preview0" class="msg"></div></td></tr> - <tr><td style="text-align:right;">Mensaje:</td><td colspan="4"><textarea name="message" cols="70" rows="10"></textarea></td></tr> + <tr id="options" style="display:none"><td></td><td colspan="4"><div id="preview0" class="msg"></div></td></tr> + <tr><td class="pblock">Mensaje:</td><td colspan="4"><textarea name="message" cols="70" rows="10"></textarea></td></tr> <?py if allow_images: ?> - <tr><td style="text-align:right;">Archivo:</td><td colspan="4"><input type="file" name="file" /></td></tr> + <tr><td class="pblock">Archivo:</td><td colspan="4"><input type="file" name="file" /></td></tr> <?py #endif ?> </table> - <div style="display:none;">Trampa: <input type="text" name="name" maxlength="50" /> <input type="text" name="email" maxlength="50" /></div> + <div style="display:none">Trampa: <input type="text" name="name" maxlength="50" /> <input type="text" name="email" maxlength="50" /></div> </form> </div> </div> diff --git a/static/css/ib.css b/static/css/ib.css index 443dae8..b1bcefe 100644 --- a/static/css/ib.css +++ b/static/css/ib.css @@ -34,7 +34,7 @@ body[data-brd="2d"], body[data-brd="2d"] textarea { margin-bottom: 0.5em; text-align: center; } -#main_nav span { +#main_nav span:last-child { display: inline-block; } #main_nav #sel, @@ -292,8 +292,7 @@ textarea { .pass, .ell, .thumbmsg, - .fs span, - { + .fs small { display: none; } .thread table, diff --git a/static/css/mobile.css b/static/css/mobile.css index 726abbf..58997d7 100644 --- a/static/css/mobile.css +++ b/static/css/mobile.css @@ -7,7 +7,7 @@ input, textarea { color: #000; margin: 0 auto; - max-width: 700px; + max-width: 800px; padding: 0; } body, @@ -15,6 +15,11 @@ textarea { font-family: arial, sans-serif; font-size: 16px; } +body[data-brd="zonavip"], body[data-brd="zonavip"] textarea, +body[data-brd="world"], body[data-brd="world"] textarea, +body[data-brd="2d"], body[data-brd="2d"] textarea { + font-family: Mona,'MS PGothic',IPAMonaPGothic,sans-serif; +} .txt { background: #efefef; } @@ -319,6 +324,10 @@ m .img hr { font-size: inherit; padding: 2px 4px; } +.minisjis { + font-size: 10px; + line-height: 12px; +} .thm { color: grey !important; font-size: 12px; diff --git a/static/css/txt/bbs.css b/static/css/txt/bbs.css index 628eac7..aff6748 100644 --- a/static/css/txt/bbs.css +++ b/static/css/txt/bbs.css @@ -353,6 +353,10 @@ form .msg { #content.grid .row div { display: inline; } +.minisjis { + font-size: 10px; + line-height: 12px; +} @media (max-width: 600px) { br { line-height: 0.5em; @@ -373,11 +377,13 @@ form .msg { h5 { font-size: 18px; } - h4, h2 span, #rules { font-size: 12px; } + h4 { + font-size: 10px; + } #threadlist { overflow-x: auto; white-space: nowrap; @@ -389,11 +395,6 @@ form .msg { div.reply, .deleted { margin-bottom: 0.5em; } - .num { - margin: -10px; - padding: 10px; - position: relative; - } .del { visibility: visible; } @@ -404,13 +405,18 @@ form .msg { .formpad { padding-left: 0; } + .postform input { + margin-bottom: 2px; + } .postform > span { display: table; width: 100%; } + .postform input[type="submit"] { + padding: 0.5em; + } .postform span > * { display: table-cell; - margin-bottom: 2px; white-space: nowrap; } .postform input, diff --git a/static/js/mobile.js b/static/js/mobile.js index 22606b9..36747e8 100644 --- a/static/js/mobile.js +++ b/static/js/mobile.js @@ -90,7 +90,7 @@ function showMenu(e) { e.preventDefault(); if (document.getElementById("mnu-opened")) closeMenu(e); this.id = "mnu-opened"; - var brd = postform.board.value; + var brd = document.body.dataset.brd; var post = this.parentNode.parentNode; if (document.body.className === "txt") { var id = post.id.substr(1); @@ -422,7 +422,7 @@ function counter() { } function detectService() { - if (document.getElementById("thread")) { + if (document.getElementById("thread") && document.getElementById("postform")) { thread_title = document.getElementsByTagName("h1")[0].innerHTML.split(" <span>")[0] + " - " + @@ -444,12 +444,7 @@ function detectService() { ); if (thread_length == thread_lastreply) { serviceType = 1; - document - .getElementById("n2") - .setAttribute( - "style", - "border-top:1px solid #c6c7c8;border-left:1px solid #c6c7c8;display:inline-block;text-align:center;width:50%;" - ); + document.getElementById("n2").setAttribute("style","border-top:1px solid #c6c7c8;border-left:1px solid #c6c7c8;display:inline-block;text-align:center;width:50%;"); return true; } else return false; } else if (document.body.className === "img") { @@ -585,6 +580,14 @@ document.addEventListener("DOMContentLoaded", function(e) { ft[i].appendChild(cln); } } + + var sjis = /( \| /|\ |/ | ̄ ̄|| | ||\| | \|)/; + var msg = document.getElementsByClassName("msg"); + for (var i=0; i<msg.length; i++) { + if (msg[i].textContent.match(sjis)) { + msg[i].classList.add("minisjis"); + } + } } if (!detectService()) return; diff --git a/static/js/shobon.js b/static/js/shobon.js index e7a9073..d4b345c 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -15,7 +15,7 @@ function shobon() { box.appendChild(document.createTextNode(" | ")); var slnk = document.createElement("a"); slnk.href = "#"; - slnk.innerHTML = "<b>Configuración</b>"; + slnk.innerHTML = "<b>Configurar</b>"; slnk.addEventListener("click", shobonSettings); box.appendChild(slnk); } @@ -25,11 +25,6 @@ function shobon() { var newRepliesCounter = 0; - // dejar barra superior fija - if (localStorage.getItem("shobon_navbar") == "true") { - fixedNav(); - } - var shobon_time = localStorage.getItem("shobon_time"); if (shobon_time != "false") { if (boardName == "world") @@ -98,8 +93,7 @@ function shobon() { if (isNewReply) { newRepliesCounter++; newRepliesInThread++; - reply.children[0].innerHTML += - " <span class='shobonNew' style='color:#CC6666; font-weight:bold;'>Nuevo!</span>"; + reply.children[0].innerHTML += " <span class='shobonNew' style='color:#CC6666; font-weight:bold;'>Nuevo!</span>"; } } @@ -115,7 +109,7 @@ function shobon() { replaceCountryName(reply); } // colorear IDs - if (localStorage.getItem("shobon_ids") != "false") { + if (localStorage.getItem("shobon_ids") == "true") { paintIds(reply); } // insertar imágenes @@ -213,29 +207,22 @@ function timeAgo(timestamp) { else if (el < 31536000) return Math.round(el / 2628000) + " meses"; else if (el > 31535999) return "más de un año"; } + function localTime(timestamp, id) { id = id || 0; var lcl = new Date(timestamp * 1000); lcl = - ("0" + lcl.getDate()).slice(-2) + - "/" + + ("0" + lcl.getDate()).slice(-2) + "/" + ("0" + (lcl.getMonth() + 1)).slice(-2) + - "/" + - lcl - .getFullYear() - .toString() - .slice(-2) + - "(" + - week[lcl.getDay()] + - ")" + - ("0" + lcl.getHours()).slice(-2) + - ":" + - ("0" + lcl.getMinutes()).slice(-2) + - ":" + + "/" + lcl.getFullYear().toString().slice(-2) + + "(" + week[lcl.getDay()] + ")" + + ("0" + lcl.getHours()).slice(-2) + ":" + + ("0" + lcl.getMinutes()).slice(-2) + ":" + ("0" + lcl.getSeconds()).slice(-2); if (id) lcl = lcl + " " + id; return lcl; } + function loadFilters() { var filters = JSON.parse(localStorage.getItem("shobon_filters")); @@ -330,46 +317,23 @@ function shobonSettings(e) { box.style.textAlign = "center"; 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_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 - ) - ); - p.appendChild( - createCheckbox("shobon_time", "Convertir fechas a hora local", true) - ); - 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) - ); + 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_country", "Reemplazar códigos de país por nombres", false)); + p.appendChild(createCheckbox("shobon_time", "Convertir fechas a hora local", true)); + 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() { + a.href = "#"; + a.textContent = "[Editar filtros]"; + a.addEventListener("click", function() { var x = document.getElementById("filters"); x.hidden = !x.hidden; - }); - p.appendChild(a);*/ + }); + p.appendChild(a);*/ box.appendChild(p); var title2 = document.createElement("h6"); @@ -408,7 +372,7 @@ function shobonSettings(e) { var msg = document.createElement("a"); msg.style.display = "block"; msg.href = "#"; - msg.textContent = "Actualizar página para ver cambios"; + msg.textContent = "Actualizar para ver cambios"; msg.style.marginTop = "1em"; msg.addEventListener("click", function() { location.reload(); @@ -487,8 +451,7 @@ function paintIds(reply) { var lastChar = userId.substring(userId.length - 1, userId.length); dateId.innerHTML = postDate + - "<span class='uid ID_" + - userId.slice(0, -1) + + "<span class='uid ID_" + userId.slice(0, -1) + "' style='background-color:#" + idColor + ";color:#" + @@ -496,9 +459,7 @@ function paintIds(reply) { ";padding:0 3px;border-radius:5px; font-size:0.9em;vertical-align:top;'>ID:" + userId + "</span>"; - dateId - .getElementsByClassName("uid")[0] - .addEventListener("click", markId, false); + dateId.getElementsByClassName("uid")[0].addEventListener("click", markId, false); } } @@ -571,9 +532,4 @@ function padZero(str, len) { return (zeros + str).slice(-len); } -function fixedNav() { - var bar = document.getElementById("main_nav"); - if (bar) document.body.className += " fix"; -} - document.addEventListener("DOMContentLoaded", shobon, false); diff --git a/static/js/weabot.js b/static/js/weabot.js index 6557f66..9ab84f3 100644 --- a/static/js/weabot.js +++ b/static/js/weabot.js @@ -40,9 +40,7 @@ function insert(text) { // IE var caretPos = textarea.caretPos; caretPos.text = - caretPos.text.charAt(caretPos.text.length - 1) == " " - ? text + " " - : text; + caretPos.text.charAt(caretPos.text.length - 1) == " " ? text + " " : text; } else if (textarea.setSelectionRange) { // Firefox var start = textarea.selectionStart; @@ -58,25 +56,19 @@ function insert(text) { return false; } -function quote(b, a) { - var v = eval("document." + a + ".message"); - v.value += ">>" + b + "a\ndfs"; - v.focus(); -} - function checkhighlight() { var match; - if ((match = /#i([0-9]+)/.exec(document.location.toString()))) + if ((match = /#i([0-9]+)/.exec(document.location.toString()))) { if (!document.forms.postform.message.value) insert(">>" + match[1] + "\r\n"); - if ((match = /#([0-9]+)/.exec(document.location.toString()))) + } else if ((match = /#([0-9]+)/.exec(document.location.toString()))) { highlight(match[1]); + } } function highlight(post) { - var cells = document.getElementsByClassName("reply"); - for (var i = 0; i < cells.length; i++) - if (cells[i].className == "reply highlight") cells[i].className = "reply"; + var hl = document.getElementsByClassName("reply highlight"); + if (hl.length) { hl[0].className = "reply"; } var reply = document.getElementById("reply" + post); if (reply) { reply.className = "reply highlight"; @@ -92,16 +84,15 @@ function expandimg(e) { var img_w = parseInt(e.dataset.w); var img_h = parseInt(e.dataset.h); var thumb_w = parseInt(e.dataset.tw); + if (thumb_w < 1) return true; var thumb_h = parseInt(e.dataset.th); var format = img_url.substring(img_url.lastIndexOf(".") + 1, img_url.length); var exp_vid = 0; if (window.innerWidth > 900) - var ratio = Math.min((window.innerWidth - 130) / img_w, 1); + var ratio = Math.min((window.innerWidth - 130) / img_w, 1); else var ratio = Math.min((window.innerWidth - 40) / img_w, 1); - if (thumb_w < 1) return true; - var img_cont = document.getElementById("thumb" + post_id); var post_block = img_cont.parentElement.parentElement.getElementsByTagName( "blockquote" @@ -117,18 +108,17 @@ function expandimg(e) { } if (img) { - if (format == "webm" && exp_vid == 0) + if (format == "webm" || format == "mp4" && exp_vid == 0) var new_img = document.createElement("video"); else var new_img = document.createElement("img"); + new_img.setAttribute("class", "thumb"); new_img.setAttribute("alt", "" + post_id); - if ( - img.getAttribute("width") == "" + thumb_w && - img.getAttribute("height") == "" + thumb_h - ) { + if (img.getAttribute("width") == "" + thumb_w && + img.getAttribute("height") == "" + thumb_h) { // thumbnail -> fullsize - if (format == "webm") { + if (format == "webm" || format == "mp4") { new_img.setAttribute("controls", ""); new_img.setAttribute("loop", ""); new_img.setAttribute("autoplay", ""); @@ -136,19 +126,14 @@ function expandimg(e) { new_img.setAttribute("src", "" + img_url); new_img.setAttribute("width", img_w); new_img.setAttribute("height", img_h); - new_img.setAttribute( - "style", - "max-width:" + - Math.floor(img_w * ratio) + - "px;max-height:" + - Math.floor(img_h * ratio) + - "px;" - ); + new_img.setAttribute("style", "max-width:" + + Math.floor(img_w * ratio) + "px;max-height:" + + Math.floor(img_h * ratio) + "px;"); post_block.setAttribute("style", ""); img_cont.style.display = "table"; } else { // fullsize -> thumbnail - if (format == "webm") { + if (format == "webm" || format == "mp4") { new_img.removeAttribute("controls"); new_img.removeAttribute("loop"); new_img.removeAttribute("autoplay"); @@ -156,14 +141,9 @@ function expandimg(e) { new_img.setAttribute("src", "" + thumb_url); new_img.setAttribute("width", thumb_w); new_img.setAttribute("height", thumb_h); - post_block.setAttribute( - "style", - "margin-left:" + - (parseInt(thumb_w) + 40) + - "px;max-width:" + - (1000 - parseInt(thumb_w)) + - "px" - ); + post_block.setAttribute("style", "margin-left:" + + (parseInt(thumb_w) + 40) + "px;max-width:" + + (1000 - parseInt(thumb_w)) + "px"); img_cont.removeAttribute("style"); } @@ -179,20 +159,6 @@ function filePreview(e) { var prev = document.getElementById("filepreview"); var noimg = document.getElementById("noimage"); if (noimg) noimg = document.getElementById("noimage").parentNode; - if (file.size > maxsize * 1024) { - inpt.value = ""; - return alert( - "El archivo es muy grande. El tamaño máximo es " + maxsize + " KB." - ); - } - if ( - !types.includes( - inpt.value.slice(inpt.value.lastIndexOf(".") + 1).toUpperCase() - ) - ) { - inpt.value = ""; - return alert("Tipo de archivo no soportado."); - } var read = new FileReader(); read.readAsDataURL(file); read.onload = function() { @@ -202,10 +168,8 @@ function filePreview(e) { var fname = file.name.length < 20 ? file.name : file.name.substr(0, 19) + "…"; if (file.type.startsWith("image")) - prev.insertAdjacentHTML( - "beforeend", - '<img class="thumbpreview" src="' + read.result + '" /> ' + fname - ); + prev.insertAdjacentHTML("beforeend", + '<img class="thumbpreview" src="' + read.result + '" /> ' + fname); else prev.insertAdjacentHTML("beforeend", fname); prev.appendChild(document.createTextNode(" [")); var btn = document.createElement("a"); @@ -286,25 +250,15 @@ function catSort(type) { var elem = document.getElementsByClassName("thread"); var arr = Array.prototype.slice.call(elem); if (type == 0) - arr.sort(function(a, b) { - return a.dataset.num - b.dataset.num; - }); + arr.sort(function(a, b) { return a.dataset.num - b.dataset.num; }); else if (type == 1) - arr.sort(function(a, b) { - return b.dataset.id - a.dataset.id; - }); + arr.sort(function(a, b) { return b.dataset.id - a.dataset.id; }); else if (type == 2) - arr.sort(function(a, b) { - return a.dataset.id - b.dataset.id; - }); + arr.sort(function(a, b) { return a.dataset.id - b.dataset.id; }); else if (type == 3) - arr.sort(function(a, b) { - return b.dataset.res - a.dataset.res; - }); + arr.sort(function(a, b) { return b.dataset.res - a.dataset.res; }); else if (type == 4) - arr.sort(function(a, b) { - return a.dataset.res - b.dataset.res; - }); + arr.sort(function(a, b) { return a.dataset.res - b.dataset.res; }); for (var j = 0; j < arr.length; j++) cont.appendChild(arr[j]); localStorage.setItem("catalog", JSON.stringify(opcs)); } @@ -347,7 +301,7 @@ function catTeasers(teaser) { var style = document.createElement("style"); style.id = "teaser_style"; style.type = "text/css"; - style.innerText = "#catalog p{display:none}"; + style.innerText = "#catalog p {display:none}"; document.head.appendChild(style); btn.innerText = "Mostrar"; } else { @@ -361,14 +315,9 @@ function catTeasers(teaser) { function catMenu(e) { var brd = document.getElementsByName("board")[0].value; var id = this.dataset.id; - this.insertAdjacentHTML( - "afterbegin", + this.insertAdjacentHTML("afterbegin", '<div id="thread_ctrl" style="margin-bottom:3px;">[<a href="/cgi/report/' + - brd + - "/" + - id + - '">Denunciar</a>] [<a href="#" class="hh">Ocultar</a>]' - ); + brd + "/" + id + '">Denunciar</a>] [<a href="#" class="hh">Ocultar</a>]'); this.getElementsByClassName("hh")[0].addEventListener("click", function(e) { document.getElementById("cat" + id + brd).style.display = "none"; hiddenthreads.push(id + brd); @@ -403,9 +352,7 @@ function catHidden() { e.preventDefault(); for (var i = 0; i < hiddenthreads.length; i++) { try { - document - .getElementById("cat" + hiddenthreads[i]) - .removeAttribute("style"); + document.getElementById("cat" + hiddenthreads[i]).removeAttribute("style"); } catch (err) { continue; } @@ -437,28 +384,6 @@ function applyTheme() { set_stylesheet(newTheme); } -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]; - } -} - document.addEventListener("DOMContentLoaded", function(e) { checkhighlight(); if (localStorage.hasOwnProperty("weabot")) @@ -474,33 +399,13 @@ document.addEventListener("DOMContentLoaded", function(e) { } } - if (screen.width < 720) { - var head = document.getElementById("main_nav"); - var b = head.getElementsByTagName("a"); - var s = document.createElement("select"); - for (var i = 1; i < b.length; i++) { - var o = document.createElement("option"); - o.value = b[i].href; - o.textContent = b[i].textContent; - if (b[i].className == "cur_brd") o.defaultSelected = true; - s.appendChild(o); - } - s.addEventListener("change", function(e) { - window.location.href = this.value; - }); - head.removeChild(head.childNodes[0]); - head.className = "mob fix"; - head.insertBefore(s, head.childNodes[0]); - } - if (localStorage.hasOwnProperty("hiddenthreads")) { hiddenthreads = localStorage.getItem("hiddenthreads").split("!"); if (document.getElementById("catalog")) { hidden_num = 0; for (var i = 0; i < hiddenthreads.length; i++) { try { - document.getElementById("cat" + hiddenthreads[i]).style.display = - "none"; + document.getElementById("cat" + hiddenthreads[i]).style.display = "none"; hidden_num++; } catch (err) { continue; @@ -512,11 +417,8 @@ document.addEventListener("DOMContentLoaded", function(e) { } else { for (var i = 0; i < hiddenthreads.length; i++) { try { - document - .getElementById("unhide" + hiddenthreads[i]) - .removeAttribute("style"); - document.getElementById("thread" + hiddenthreads[i]).style.display = - "none"; + document.getElementById("unhide" + hiddenthreads[i]).removeAttribute("style"); + document.getElementById("thread" + hiddenthreads[i]).style.display = "none"; } catch (err) { continue; } @@ -529,14 +431,10 @@ document.addEventListener("DOMContentLoaded", function(e) { styleSelect.addEventListener("change", applyTheme, false); styleSelect.value = localStorage.getItem(style_cookie); } - + if (document.getElementById("postform")) { setInputs("postform"); - maxsize = document.getElementById("maxsize").innerText; - types = document.getElementById("filetypes").innerText.split(", "); - if (types.includes("JPG")) types.push("JPEG"); postform.file.addEventListener("change", filePreview); - fixFileSize(); } var del = document.getElementById("delform"); @@ -583,25 +481,21 @@ document.addEventListener("DOMContentLoaded", function(e) { } } }); -document.addEventListener( - "click", - function(e) { - var cn = e.target.className; - if (cn == "num") { - e.preventDefault(); - postClick(e.target.textContent); - return; - } - if (cn == "tt") { - e.preventDefault(); - togglethread(e.target); - return; - } - if (cn == "expimg") { - e.preventDefault(); - expandimg(e.target); - return; - } - }, - false -); +document.addEventListener("click", function(e) { + var cn = e.target.className; + if (cn == "num") { + e.preventDefault(); + postClick(e.target.textContent); + return; + } + if (cn == "tt") { + e.preventDefault(); + togglethread(e.target); + return; + } + if (cn == "expimg") { + e.preventDefault(); + expandimg(e.target); + return; + } +}, false); diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js index ba3e51d..cf4209a 100644 --- a/static/js/weabotxt.js +++ b/static/js/weabotxt.js @@ -11,17 +11,6 @@ function set_stylesheet(styletitle) { localStorage.setItem(style_cookie, styletitle); } -function timeMob(timestamp) { - var time = Math.round(Date.now() / 1000); - var el = time - timestamp; - if (el < 60) return el + "s"; - else if (el < 3600) return Math.round(el / 60) + "m"; - else if (el < 86400) return Math.round(el / 3600) + "h"; - else if (el < 2628000) return Math.round(el / 86400) + "d"; - else if (el < 31536000) return Math.round(el / 2628000) + "me"; - else return Math.round(el / 31557600) + "a"; -} - /* IE/Opera fix, because they need to go learn a book on how to use indexOf with arrays */ if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { @@ -82,9 +71,8 @@ function insert(text) { // IE var caretPos = textarea.caretPos; caretPos.text = - caretPos.text.charAt(caretPos.text.length - 1) == " " - ? text + " " - : text; + caretPos.text.charAt(caretPos.text.length - 1) == + " " ? text + " " : text; } else if (textarea.setSelectionRange) { // Firefox var start = textarea.selectionStart; @@ -106,14 +94,8 @@ function deletePost(e) { var realid = ids.pop(); if (confirm("¿Seguro que deseas borrar el mensaje " + post + "?")) { var script = "/cgi/delete"; - document.location = - script + - "?board=" + - board + - "&password=" + - weabot.password + - "&delete=" + - realid; + document.location = script + "?board=" + board + "&password=" + + weabot.password + "&delete=" + realid; } } @@ -139,10 +121,9 @@ function previewPost(e) { if (main) main.style.display = ""; preview.removeAttribute("style"); - preview.innerHTML = "<em>Cargando...</em>"; + preview.innerText = "Cargando..."; - var text = - "message=" + encodeURIComponent(form.message.value) + "&board=" + board; + var text = "message=" + encodeURIComponent(form.message.value) + "&board=" + board; if (thread) text += "&parentid=" + thread; var xmlhttp = get_xmlhttp(); @@ -151,10 +132,7 @@ function previewPost(e) { if (xmlhttp.readyState == 4) preview.innerHTML = xmlhttp.responseText; }; if (is_ie() || xmlhttp.setRequestHeader) - xmlhttp.setRequestHeader( - "Content-Type", - "application/x-www-form-urlencoded" - ); + xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(text); } @@ -166,31 +144,21 @@ function listSort() { arr.shift(); if (s == "Normal") { arr.sort(function(a, b) { - return ( - parseInt(a.childNodes[1].textContent) - - parseInt(b.childNodes[1].textContent) - ); + return (parseInt(a.childNodes[1].textContent) - parseInt(b.childNodes[1].textContent)); }); } else if (s == "Edad") { arr.sort(function(a, b) { - return ( - b.children[1].firstChild.href.split("/")[5] - - a.children[1].firstChild.href.split("/")[5] - ); + return (b.children[1].firstChild.href.split("/")[5] - a.children[1].firstChild.href.split("/")[5]); }); } else if (s == "Largo") { arr.sort(function(a, b) { - return b.children[2].textContent - a.children[2].textContent; + return (b.children[2].textContent - a.children[2].textContent); }); } else if (s == "Rapidez") { var now = Math.round(Date.now() / 1000); arr.sort(function(a, b) { - return ( - b.children[2].textContent / - (now - b.children[1].firstChild.href.split("/")[5]) - - a.children[2].textContent / - (now - a.children[1].firstChild.href.split("/")[5]) - ); + return (b.children[2].textContent / (now - b.children[1].firstChild.href.split("/")[5]) - + a.children[2].textContent / (now - a.children[1].firstChild.href.split("/")[5])); }); } else if (s == "Aleatorio") { arr.sort(function(a, b) { @@ -296,37 +264,6 @@ document.addEventListener("DOMContentLoaded", function() { } } - var dt = document.getElementsByClassName("date"); - if (screen.width < 720) { - if (head) { - var b = head.getElementsByTagName("a"); - var s = document.createElement("select"); - for (var i = 1; i < b.length; i++) { - var o = document.createElement("option"); - o.value = b[i].href; - o.textContent = b[i].textContent; - if (b[i].className == "cur_brd") o.defaultSelected = true; - s.appendChild(o); - } - s.addEventListener("change", function(e) { - window.location.href = this.value; - }); - head.innerHTML = '<a href="/" target="_top">Bienvenido a Internet</a> | '; - head.appendChild(s); - head.removeAttribute("style"); - document.body.className += " fix"; - var head2 = document.getElementById("thread_nav"); - if (head2) head2.removeChild(head2.childNodes[1]); - } - - for (var i = 0; i < dt.length; i++) { - t = dt[i].textContent; - if (t.includes("ID:")) var id = t.split(" ")[1]; - else id = ""; - dt[i].textContent = "Hace " + timeMob(dt[i].dataset.unix) + " " + id; - } - } - var forms = document.getElementsByTagName("form"); for (var i = 0; i < forms.length; i++) { if (forms[i].id.startsWith("postform")) setInputs(forms[i].id); @@ -369,6 +306,7 @@ document.addEventListener("DOMContentLoaded", function() { if (localStorage.hasOwnProperty("hiddenposts")) hiddenposts = localStorage.getItem("hiddenposts").split("!"); + var dt = document.getElementsByClassName("date"); for (var i = 0; i < dt.length; i++) { if (hiddenposts.includes(board + dt[i].dataset.unix)) { console.log(dt[i].dataset.unix); @@ -377,20 +315,17 @@ document.addEventListener("DOMContentLoaded", function() { dt[i].parentElement.addEventListener("dblclick", togglepost); } }); -document.addEventListener( - "click", - function(e) { - var txt = e.target.textContent; - if (e.target.className == "num") { - e.preventDefault(); - postClick(txt); - return; - } - if (txt == "del") { - e.preventDefault(); - deletePost(e.target); - return; - } - }, - false -); + +document.addEventListener("click", function(e) { + var txt = e.target.textContent; + if (e.target.className == "num") { + e.preventDefault(); + postClick(txt); + return; + } + if (txt == "del") { + e.preventDefault(); + deletePost(e.target); + return; + } +}, false); |