Hacker News new | ask | show | jobs
by huhtenberg 1247 days ago
It can't be done with uBlock because Twitter randomized pretty much all DOM element class names. You really need to parse the content, then climb up the tree and trim grand/parent nodes to remove all the junk. Used to be much easier few years ago with descriptive class names, but they changed that.

* I'm not the OP, but I made a similar extension.

1 comments

It's a React Native for Web app, so it's kinda like a reverse Tailwind - you write your styles using the usual CSS property names (instead of having to learn new shorthand names for all of them), then it deduplicates everything at build time and generates one-property-per-selector class names.

They've handily left a bunch of data-testid attributes on some of the major elements you need to identify, like the primary column.

Since it's a React app, manually removing stuff from the DOM will either have your changes get blown away the on the next render, or cause issues on the next render. A good trick is to add your own descriptive classes to <body> for the current screen so you can limit the scope of some of the incredibly gnarly CSS selectors you'll need to use to hide things.