From cae2ea613d15457e5ed5026f3b06d2c2b021ae7b Mon Sep 17 00:00:00 2001 From: Señor X Date: Wed, 3 Apr 2019 22:34:06 -0300 Subject: Hacer click en una ID ahora ennegrece todas las IDs similares --- static/css/txt/bbs.css | 2 +- static/js/shobon.js | 55 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/static/css/txt/bbs.css b/static/css/txt/bbs.css index 477309a..26b4d0a 100644 --- a/static/css/txt/bbs.css +++ b/static/css/txt/bbs.css @@ -17,7 +17,7 @@ input[type=submit]:active,input[type=button]:active,button:active{border-style:i .spoil{background:#000;color:#000}.spoil:hover{color:#fff} code{font-size:14px} pre{line-height:125%;margin:0;white-space:pre-wrap} -#main_nav .cur_brd,#cur_stl,.locked{font-weight:bold} +#main_nav .cur_brd,#cur_stl,.locked,.sel{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:0 2.5% 1em} diff --git a/static/js/shobon.js b/static/js/shobon.js index 86faa53..02d3c71 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -5,7 +5,8 @@ var hide_id = new Set(); var shobon_ver = "v0.4+"; function shobon() { - console.log("Running shobon " + shobon_ver); + if(localStorage.getItem("shobon_on") == "false") return; + else console.log("Running shobon " + shobon_ver); boardName = document.getElementsByName("board")[0].value; var inThread = document.getElementsByTagName("body")[0].className == "threadpage"; @@ -22,17 +23,12 @@ function shobon() { box.appendChild(slnk); } - if(localStorage.getItem("shobon_on") == "false") { - console.log("Shutting down Shobon"); - return; - } - if (localStorage.getItem("shobon_usefilters") != "false") { loadFilters(); } var threadList = document.getElementsByClassName("thread"); - for (var i = 0; i < threadList.length; i++) { + for (var i=0; i 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.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); } @@ -251,7 +247,7 @@ function shobonSettings(e) { p.appendChild(createCheckbox("shobon_on", "Activar extensión", true)); p.appendChild(createCheckbox("shobon_navbar", "Fijar barra superior", false)); p.appendChild(createCheckbox("shobon_ids", "Colorear IDs", true)); - p.appendChild(createCheckbox("shobon_embedimg", "Incluir imágenes miniatura", 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)); @@ -365,6 +361,7 @@ function checkBlackList(reply) { } } +var currentSel = null; function paintIds(reply) { var dateId = reply.getElementsByClassName("date")[0]; if (dateId.innerText.includes("ID:")) { @@ -373,7 +370,27 @@ function paintIds(reply) { var idColor = toHex(userId).substring(0, 6); var reverseColor = invertColor(idColor); var lastChar = userId.substring(userId.length-1, userId.length); - dateId.innerHTML = postDate + "ID:" + userId + ""; + dateId.innerHTML = postDate + "ID:" + userId + ""; + dateId.getElementsByClassName("uid")[0].addEventListener("click", markId, false) + } +} + +function markId(e) { + var uid = this.innerText.slice(0,-1).replace(":","_"); + var sel = document.getElementsByClassName("sel"); + var len = sel.length; + for (i=0; i