Ignore Thread script
Dec 16, 2019 9:19:19 GMT 10
Post by Deleted on Dec 16, 2019 9:19:19 GMT 10
Sick of hearing about divisive New Zealand politics? Well I've made the plug-in for you!
It requires the Firefox/Chrome add-on Greasemonkey (it could work with Tapermonkey but I have not tested it). Once installed, click on its icon, and click on "New User Script". Erase what's already there and paste this instead:
Instructions:
This is a beta, so please report any problems you may find
Warning: You might see the Ask Slowpoke thread pop up in inappropriate places. This is not a virus nor a viral marketing scheme nor a sneaky way to boost the views on my Ask thread (), but a placeholder because otherwise it would be too obvious a thread was being ignored.
To-do list
It requires the Firefox/Chrome add-on Greasemonkey (it could work with Tapermonkey but I have not tested it). Once installed, click on its icon, and click on "New User Script". Erase what's already there and paste this instead:
// ==UserScript==
// @name Block Popedia Threads
// @version 1
// @grant none
// @include http://popedia.boards.net
// ==/UserScript==
let threads = [35, 2795];
/*
Threads are found using IDs and classes. For the thread #1211, the thread ID or class might be "thread-1211".
*/
console.log("Warren 2020!");
window.onload = function() {
for (var i = 0; i < threads.length; i++) {
let threadID = "thread-" + threads[i];
let threadRow = document.querySelector("#" + threadID);
if (threadRow) {
threadRow.style.display = "none";
} else {
threadClasses = document.querySelectorAll("." + threadID);
threadClasses.forEach((thread) => {
// Under the "Recent Posts" page, the containing table has a class of 'post'.
let recent_post = findAncestorWithClass(thread, "post");
if (recent_post) {
recent_post.style.display = "none";
} else {
let threadTitle = document.createTextNode("Ask Slowpoke!");
let threadUrl = "http://popedia.boards.net/threads/recent/1211"
let threadClassList = ["js-thread__title-link", "thread-link", "thread-1211", "board-86"];
thread.text = "";
thread.appendChild(threadTitle);
thread.setAttribute("href", threadUrl);
while (thread.classList.length) {
thread.classList.forEach(className => thread.classList.remove(className));
} // removes all classes
thread.classList.add(...threadClassList);
}
});
}
}
};
function findAncestorWithClass(element, className) {
while (element.parentNode.parentNode) {
let parent = element.parentNode;
if (parent.classList.contains(className))
return parent;
element = parent;
}
return null;
}
Instructions:
- Find the thread you want to ignore, and get its thread ID.
- For example, the thread "New Zealand politics" has the URL popedia.boards.net/thread/234/new-zealand-politics, the ID in this case is "234".
- In the line of the code that says "let threads = [...", add the thread ID you want to ignore. Separate the IDs by commas.
- Initially, the threads "Donald Trump's presidency" and "Joe Biden vs. Trump" are ignored, this is just to show you how it should be formatted. You can remove those or add more as you please.
This is a beta, so please report any problems you may find
Warning: You might see the Ask Slowpoke thread pop up in inappropriate places. This is not a virus nor a viral marketing scheme nor a sneaky way to boost the views on my Ask thread (), but a placeholder because otherwise it would be too obvious a thread was being ignored.
To-do list
- Show an "X" next to each thread for easy ignorning.
- Create a 'control panel' to easily add or remove threads from the ignore list.
- Hide the thread in notifications.
SharksFan99 likes this