From f7baf0c69606d49c6be86d3f27bc88d9d58cd4ba Mon Sep 17 00:00:00 2001 From: junk Date: Sun, 28 Mar 2021 07:51:40 -0300 Subject: Mejor forma de ocultar posts --- static/js/aquiencitas.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'static/js/aquiencitas.js') diff --git a/static/js/aquiencitas.js b/static/js/aquiencitas.js index 4284f0a..93f5323 100644 --- a/static/js/aquiencitas.js +++ b/static/js/aquiencitas.js @@ -54,13 +54,13 @@ function getPostDivs(e) { return divs; } else { ele = document.getElementById( - "reply" + e.getAttribute("href").split("#")[1] + "p" + e.getAttribute("href").split("#")[1] ); return [ele]; } } function get_pid(e) { - return is_bbs ? e.dataset.n : e.id.substr(5); + return is_bbs ? e.dataset.n : e.id.substr(1); } function fill_links(e) { var divs = getPostDivs(e); @@ -144,12 +144,9 @@ function quotePreview() { if (localStorage.getItem("shobon_on") == "false") { return; } - if ( - localStorage.getItem("shobon_preview") == "false" && - localStorage.getItem("shobon_backlink") == "false" - ) { - return; - } + var showprev = localStorage.getItem("shobon_preview"); + var showlink = localStorage.getItem("shobon_backlink"); + if (showprev == "false" && showlink == "false") return; var i, q, replies, quotes; @@ -160,10 +157,10 @@ function quotePreview() { if (is_bbs) replies = document.getElementsByClassName("msg"); else replies = document.getElementsByTagName("blockquote"); - urls = window.location.pathname.split("/"); - cur_url = urls[0] + "/" + urls[1] + "/" + urls[2] + "/" + urls[3]; + var urls = window.location.pathname.split("/"); + cur_url = "/" + ((urls[2]) ? urls[1] + "/" + urls[2] + "/" + urls[3] : urls[1]); - for (x = 0; x < replies.length; x++) { + for (var x = 0; x < replies.length; x++) { quotes = replies[x].getElementsByTagName("a"); linklist = {}; @@ -171,12 +168,12 @@ function quotePreview() { q = quotes[i]; if (q.textContent.length < 3 || !q.textContent.startsWith(">>")) continue; - if (localStorage.getItem("shobon_preview") != "false") { + if (showprev != "false") { q.addEventListener("mouseover", who_are_you_quoting, false); q.addEventListener("mouseout", remove_quote_preview, false); } - if (localStorage.getItem("shobon_backlink") != "false") { + if (showlink != "false") { fill_links(q); } } -- cgit v1.2.1-18-gbd029