in js/abuse.js [159:214]
function fixup_urls(splicer) {
if (typeof splicer == 'object') {
return splicer;
//splicer = splicer.innerText;
}
/* Array holding text and links */
let i, m, t, textbits, url, urls;
textbits = [];
/* Find the first link, if any */
i = splicer.search(blockrule_re);
urls = 0;
/* While we have more links, ... */
while (i !== -1) {
urls++;
/* Only parse the first 250 URLs... srsly */
if (urls > 250) {
break;
}
/* Text preceding the link? add it to textbits frst */
if (i > 0) {
t = splicer.substring(0, i);
textbits.push(t);
splicer = splicer.substring(i);
}
/* Find the URL and cut it out as a link */
m = splicer.match(blockrule_re);
if (m) {
url = `#${m[1]}`;
i = m[1].length;
t = splicer.substring(0, i);
const linkel = document.createElement('a');
linkel.href = url;
linkel.innerText = m[1];
linkel.className = 'blockrule';
// show the accordion item
linkel.addEventListener('click', () => {
document.getElementById(`collapse_${m[1]}`).className="accordion-collapse collapse show";
document.getElementById(`cb_${m[1]}`).className="accordion-button";
})
textbits.push(linkel);
splicer = splicer.substring(i);
}
/* Find the next link */
i = splicer.search(blockrule_re);
}
/* push the remaining text into textbits */
textbits.push(splicer);
return textbits;
}