From 18f60364b920e0ff33bc4b8e3135590effeaf173 Mon Sep 17 00:00:00 2001 From: Renard Date: Sun, 29 Mar 2020 18:47:51 -0300 Subject: Prettier para JS --- static/js/aquiencitas.js | 165 +++++++++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 70 deletions(-) (limited to 'static/js/aquiencitas.js') diff --git a/static/js/aquiencitas.js b/static/js/aquiencitas.js index 0cf860f..4284f0a 100644 --- a/static/js/aquiencitas.js +++ b/static/js/aquiencitas.js @@ -4,41 +4,59 @@ var linki; var is_bbs; var plimit = 5; function getPostRange(t, n) { - var posts, replies, s, ss, ee, rev = false; + var posts, + replies, + s, + ss, + ee, + rev = false; posts = []; replies = t.getElementsByClassName("reply"); - s = n.split('-'); + s = n.split("-"); ss = parseInt(s[0]); ee = ss; - if(s.length == 2) ee = parseInt(s[1]); - if(ee ee) break; - if(num >= ss && num <= ee) { - if(rev) posts.unshift(replies[j]); + if (num > ee) break; + if (num >= ss && num <= ee) { + if (rev) posts.unshift(replies[j]); else posts.push(replies[j]); } } return posts; } -function findAncestor (el) { - while ((el = el.parentElement) && !el.className.startsWith("thread") && !el.className.startsWith("cont")); +function findAncestor(el) { + while ( + (el = el.parentElement) && + !el.className.startsWith("thread") && + !el.className.startsWith("cont") + ); return el; } function getPostDivs(e) { - if(is_bbs) { + if (is_bbs) { divs = []; t = findAncestor(e); - s = e.getAttribute('href').split('/'); - r = s[s.length-1]; - rs = r.split(','); + s = e.getAttribute("href").split("/"); + r = s[s.length - 1]; + rs = r.split(","); linki = 0; - for(i=0;i maxWidth) { width = maxWidth; } - - for(i=0;i>")) continue; - - if(localStorage.getItem("shobon_preview") != "false") { - q.addEventListener('mouseover', who_are_you_quoting, false); - q.addEventListener('mouseout', remove_quote_preview, false); + if (q.textContent.length < 3 || !q.textContent.startsWith(">>")) continue; + + if (localStorage.getItem("shobon_preview") != "false") { + q.addEventListener("mouseover", who_are_you_quoting, false); + q.addEventListener("mouseout", remove_quote_preview, false); } - - if(localStorage.getItem("shobon_backlink") != "false") { + + if (localStorage.getItem("shobon_backlink") != "false") { fill_links(q); } } } -/* if (document.body.className === "threadpage") { + /* if (document.body.className === "threadpage") { for (x = 0; x < replies.length; x++) { var q = replies[x].getElementsByTagName("a"); for(var j=0;j