Created
February 19, 2024 08:45
-
-
Save rachasakr/9765bd00df82fc5b1a3a73d808019cc8 to your computer and use it in GitHub Desktop.
Mass report Mastodon spam by notification threshold
This file contains hidden or 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
| // Paste the following script in the web's console. | |
| // CHANGE BEFORE RUN! USe AT YOUR OWN RISK! | |
| const fromDate = new Date('2024-02-01T07:00:00.000Z'); // February 1st, 2024 | |
| const toDate = new Date('2024-02-14T07:00:00.000Z'); // February 14th, 2024 | |
| for (const targetNoti of document.querySelectorAll('#mastodon [aria-label="Notifications"] .status')) { | |
| const postTime = new Date(targetNoti.querySelector('.status__info time').getAttribute('datetime')); | |
| if (postTime < fromDate || postTime > toDate) continue; | |
| targetNoti.querySelector('.status__action-bar .status__action-bar__dropdown button').click(); | |
| await new Promise ((cb) => { | |
| setTimeout(() => { | |
| for (const btn of document.querySelectorAll('.dropdown-menu .dropdown-menu__item a')) { | |
| if (btn.textContent.startsWith('Block @')) { | |
| btn.click(); | |
| setTimeout(() => { | |
| document.querySelector('.modal-root .block-modal__action-bar button:nth-child(3)').click(); | |
| document.querySelector('#mastodon [aria-label="Notifications"]').scrollBy(0, 300); | |
| cb(); | |
| }, 200); | |
| } | |
| } | |
| }, 500); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment