Simplify daily spam cleaning on Hive
There are some things I do almost daily on Hive Workshop, one of them is deleting advertisements posted by bots. When registering on the site, you are in a trial period which means your posts need approval. This makes it so no user ever experiences spam. No user except for the staff. We get A LOT of spam. It looks like this:
All spammers post their link in the thread title. An easy tell that this is spam.
Now, I could just make a script that ticks the 'Delete' button on all of these posts in moderation, but I tend to click the username and hit the 'Spam' button which deletes the account and all content posted by it:
But this is tedious and sometimes I have to go through 30-40 posts.
As a programmer I like to write scripts to simplify daily tasks, but I am also quite hesitant because I know this time is not always well spent. I figured the simplest way to script my way out of this was to write the following and save it as a bookmarklet:
javascript: void (() => {
const spamCleanerUrls = {};
$('.pageContent .xenForm fieldset').each((i, fieldset) => {
const input = $(fieldset)
.find('input[type=text][name^="queue[thread]"]')
.get()[0];
const anchor = $(fieldset)
.find('a.username')
.get()[0];
if (input && input.value.startsWith('http') && anchor) {
/**
* Convert https://www.hiveworkshop.com/members/lucilstarr.279977/
* To https://www.hiveworkshop.com/spam-cleaner/lucilstarr.279977/
*/
const url = anchor.href.replace('/members/', '/spam-cleaner/');
spamCleanerUrls[url] = true;
}
});
Object.keys(spamCleanerUrls).map(link => window.open(link));
})();
Which scans all the posts in the Moderation Queue and opens a tab with the Spam Cleaner for every post with a title starting with http
. I can then click the 'Clean Up' button with the mouse and close the tab with cmd+w in rapid succession without much thinking or interaction.
This will definitely save me some time. This is a lot of help as it saves me a lot of clicks and saves me from going through each item and judging whether it is spam.
Your move, spam bots.