Skip to content

Instantly share code, notes, and snippets.

@skiant
Created November 9, 2017 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skiant/1bbd1e5c39eec8825afe29dc3d875613 to your computer and use it in GitHub Desktop.
Save skiant/1bbd1e5c39eec8825afe29dc3d875613 to your computer and use it in GitHub Desktop.
Automatic CW in Mastodon
const composeBox = document.querySelector('.compose-form__autosuggest-wrapper textarea');
const cwButton = document.querySelector('[aria-controls="cw-spoiler-input"]')
function autoCW(event) {
if (!event.relatedTarget) {
cwButton.click();
}
}
composeBox.addEventListener('focus', autoCW);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment