~keith's Web site

Better Twitter CWs

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:

Screenshot of an example Tweet, showing only the text '// test content warning', beside a collapsed drop-down arrow.

(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:

The same Tweet, now displaying its content and interaction buttons below the CW header.

To change the regex patterns used to detect content warnings, or expand certain warnings automatically, you'll have to edit the script.

Downloads

You'll need to install the Tampermonkey browser extension to use this.

v0.4 (Latest)

This version fixes the problem where hashtags stop working, and adds a (janky) settings page.

v0.3

This version includes support for Org-mode markup, and includes a minimal userstyle which makes CW headers larger.

v0.2

This version now ignores URL contents when detecting content warnings.