79599904

Date: 2025-04-30 08:39:10
Score: 5
Natty:
Report link

Thank you all for the advice! Here's the code that ended up working perfectly:

function removeBlockedFromVotingPage() {
    document.querySelectorAll('td').forEach(td => {
      const tr = td.closest('tr');
      if (!tr) return;

      const div = td.querySelector('div');
      const descriptor = safeText(div);
      const text = safeText(td).replace(/\u00A0/g, '');

      if (!div && text === '') {
        tr.remove();
        console.log('[RYM Filter] Removed empty/downvoted row');
      } else if (div && isBlocked(descriptor)) {
        const prev = tr.previousElementSibling;
        const next = tr.nextElementSibling;

        if (prev?.matches('div.descriptora') && isBlank(prev)) prev.remove();
        if (next?.matches('div.descriptora') && isBlank(next)) next.remove();

        tr.remove();
        console.log(`[RYM Filter] Removed descriptor: "${descriptor}"`);
      }
    });

    // Remove leftover green separator blocks
    document.querySelectorAll('div.descriptora, div.descriptord').forEach(div => {
      if (isBlank(div)) {
        div.remove();
        console.log('[RYM Filter] Removed leftover descriptor block');
      }
    });
  }

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • RegEx Blacklisted phrase (3): Thank you all for the advice
  • RegEx Blacklisted phrase (2): downvote
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: aldin