Originally Posted by Silver/
Sir konmehn ...

There's a block button. But look up my post history - the greasemonkey script I wrote is 100 times better, I'm quite proud of it. Just add my name to array I provided there, squire - it's getting a bit too surreal...


// ==UserScript==
// @name Larian Forums Blacklist
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==

const BLACK_LIST = [
'hated person'
];

const USER_REMOVED_TEXT = 'bye bye';

const findUserMatch = (userName) => {
const matchedUser = BLACK_LIST.find(u => u === userName);

return matchedUser;
}

const isThreadPage = () => {
return $('.author-content').length > 0;
}

const searchAndRemoveUser = () => {
const users = $('.username');

users.each(function() {
const user = $(this);

if (findUserMatch(user.text())) {
user.parents('.t_outer').remove();
}
});
}

const searchAndRemoveQuotes = () => {
const quotes = $('.ubbcode-header');

if (quotes.length > 0) {
quotes.each(function() {
const quote = $(this);
const quotedUser = quote.text().split(' ')[3] || null;

if (findUserMatch(quotedUser)) {
quote.parents('.ubbcode-block').remove();
}
});
}
}

const searchLinksAndRemoveUser = () => {
$('a').each(function() {
const link = $(this);

if (findUserMatch(link.text().trim())) {
link.text(USER_REMOVED_TEXT);
}
});
}

const searchAuthoredByAndRemoveUser = () => {
$('.small').each(function() {
const authoredBy = $(this);
const authoredByUser = authoredBy.text().split(' ')[1] || null;

if (findUserMatch(authoredByUser)) {
authoredBy.text(USER_REMOVED_TEXT);
}
});
}

const cleanseThreadPage = () => {
searchAndRemoveUser();
searchAndRemoveQuotes();
searchLinksAndRemoveUser();
}

const cleanseGeneralPages = () => {
searchLinksAndRemoveUser();
searchAuthoredByAndRemoveUser();
}

const blackListUsers = () => {
(isThreadPage()) ? cleanseThreadPage() : cleanseGeneralPages();
}

blackListUsers();



It's a very good script - very good...

Last edited by konmehn; 19/02/23 02:40 AM.