3 ms·
fwiw, node.closest(selector) lets you query up the tree for the first parent that matches. for (const node of document.querySelectorAll('[aria-label="Verif
by hombre_fatal 6y ago
fwiw, node.closest(selector) lets you query up the tree for the first parent that matches.
for (const node of document.querySelectorAll('[aria-label="Verified account"]')) {
node.closest('[role="article"]').remove()
}
Doesn't get the most top-level wrapper, but it also works well with retweets. Doesn't work with verified replies though (removes the verified tweet reply but not the other person's tweet), too lazy to look.
- ihuman 6y agoI converted your code into a uBlock Origin filter. For replies, it also only removes the verified reply. I tried to get it to work, but I think that might be impossible with just CSS selectors. twitter.com##[role="article"]:has([aria-label="Verified account"])
- sergeykish 6y agouBlock Origin supports XPath ##:xpath(//*[@role="article"][descendant::*[@aria-label="Verified account"]]) Unfortunately no document.queryXPathAll but is easy to shim [2]. It is great technology, sadly not known. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/:has https://developer.mozilla.org/en-US/docs/Web/CSS/:has [2] http://sergeykish.com/web-api-element-prototype-queryxpathall http://sergeykish.com/web-api-element-prototype-queryxpathal...