|
|
|
|
|
by cabbageears
783 days ago
|
|
function modifyElements(pSel, cSel, rxStr) {
const regex = new RegExp(rxStr, 'i');
const pEls = document.querySelectorAll(pSel);
pEls.forEach(pEl => {
const fEl = pEl.querySelector(cSel);
if (fEl && regex.test(fEl.textContent)) {
pEl.style.display = 'none';
}
});
}
let rx = /(hi are u lonely|want (an )?ai gf?)/i;
modifyElements(".athing.comtr", ".comment", rx);
People can add onto the regex as needed, I guess. I haven't seen enough of the comments to be more specific since that seemed to get them. :-/ |
|