3 ms·
function modifyElements(pSel, cSel, rxStr) { const regex = new RegExp(rxStr, 'i'); const pEls = document.querySelectorAll(pSel); pEls.fo
by cabbageears 2y 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);