Skip to content

Instantly share code, notes, and snippets.

@itpcc
Last active February 19, 2024 17:50
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 itpcc/4d7504343586002557d76a64d78c9654 to your computer and use it in GitHub Desktop.
Save itpcc/4d7504343586002557d76a64d78c9654 to your computer and use it in GitHub Desktop.
Mass report Mastodon spam by notification threshold
// 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('Report @')) {
btn.click();
setTimeout(() => {
// document.querySelector('.modal-root .block-modal__action-bar button:nth-child(3)').click();
document.querySelector('.modal-root .report-dialog-modal__container .poll__input[aria-label="It\'s spam"]').click();
document.querySelector('.modal-root .report-dialog-modal__actions button').click();
setTimeout(() => {
for (const rptChk of document.querySelectorAll('.modal-root .report-dialog-modal__statuses input[type="checkbox"]:not([checked])')) {
rptChk.click();
}
// Next
document.querySelector('.modal-root .report-dialog-modal__actions button').click();
setTimeout(() => {
document.querySelector('.modal-root .report-dialog-modal__textarea').value = 'Discord link Spam';
// Submit
document.querySelector('.modal-root .report-dialog-modal__actions button').click();
setTimeout(() => {
for (const btn of document.querySelectorAll('.modal-root .report-dialog-modal button.button-secondary')) {
if (btn.textContent.startsWith('Block')) btn.click()
}
// Done
document.querySelector('.modal-root .report-dialog-modal__actions button').click();
document.querySelector('#mastodon [aria-label="Notifications"]').scrollBy(0, 300);
cb();
}, 500);
}, 50);
}, 50);
}, 200);
}
}
}, 500);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment