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/js/shobon.js | 55 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'static/js') 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