Created
September 1, 2019 00:32
-
-
Save robinsloan/01fcd60be602ed8f7e4a741ce6092bcd to your computer and use it in GitHub Desktop.
Code for a bookmarklet to more quickly delete DMs via the Twitter web interface.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This doesn't work THAT well, but it kinda works... so! | |
// 1. Make a new bookmarklet with the code below as its URL | |
// 2. Go to mobile.twitter.com/messages | |
// 2a. This won't work on the "normal" DM pages, i.e., not the mobile site | |
// 3. Select a thread | |
// 3a. So, you see a list of messages now, right? | |
// 4. Click this bookmarklet :) | |
// 5. repeat as many times as necessary! | |
// 6. I think this probably goes without saying, but this doesn't delete your DMs from the *other* person's account. But it does make them invisible to, e.g., someone who hacks your account. Not that that's ever going to happen. | |
// 6a. It's definitely going to happen | |
javascript:(function(){document.querySelectorAll('div').forEach(function(e) {if (e.innerHTML.match(/\d+:\d\d \w\w$/g)) { console.log(e.innerHTML); e.click(); document.querySelectorAll('[role="button"] span').forEach(function(del) { if (del.innerHTML.match(/^Delete$/g)) { console.log("gotcha!"); del.click(); } } ); } } ); })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment