This is a quick, rough Tampermonkey script which detects content warnings on Twitter and turns them into collapsible drawers, like how they behave on Mastodon.
When a Tweet contains text that appears to be a content warning, the script will
hide the content behind a
<details> element and display only
the warning itself:
(I have custom userstyles applied, so this will look slightly different on your browser.)
Clicking on the content warning or the arrow beside it will show the Tweet's content and allow you to interact with it:
To change the regex patterns used to detect content warnings, or expand certain warnings automatically, you'll have to edit the script.
You'll need to install the Tampermonkey browser extension to use this.
This version fixes the problem where hashtags stop working, and adds a (janky) settings page.
This version includes support for Org-mode markup, and includes a minimal userstyle which makes CW headers larger.
This version now ignores URL contents when detecting content warnings.