-
//Userscript that hides the "falgs" that matches the entry below
-
//This is a fork of a userscript from https://github.com/MaresOnMyFace/flag-hider
-
//Apart from EQG Flags, Ive included TFH Flags, as well G5 Flags
-
//This is a more tame script that aims to just hide the flags
-
// if you desire a more scorched earth approach use https://ponepaste.org/4869 (Flag Filter for 4ChanX)
-
//Friendship is Magic
-
// ==UserScript==
-
// @name flag hider2
-
// @version 6
-
// @grant none
-
// @author (You)
-
// @match *://boards.4channel.org/mlp*
-
// @run-at document-start
-
// ==/UserScript==
-
-
var bad_flag_classes =
-
[
-
"bfl-eqs",
-
"bfl-eqt",
-
"bfl-son",
-
"bfl-ada",
-
"bfl-ab",
-
"bfl-eqa",
-
"bfl-eqf",
-
"bfl-eqp",
-
"bfl-eqr",
-
"bfl-eqi",
-
"bfl-era",
-
"bfl-tp",
-
"bfl-tfv",
-
"bfl-tft",
-
"bfl-tfs",
-
"bfl-tfp",
-
"bfl-tfo",
-
"bfl-tfa",
-
"bfl-ss",
-
"bfl-pp",
-
"bfl-iz",
-
"bfl-ht",
-
"bfl-zs",
-
"bfl-spt",
-
];
-
-
function checkAndDeleteAll() {
-
bad_flag_classes.map(evil => document.getElementsByClassName(evil)).forEach(function(els) {while (els.length>0) {els[0].remove()};});
-
}
-
function checkAndDeleteSingle(n) {
-
if (bad_flag_classes.some(function(evil) {return n.classList.contains(evil);})) {
-
n.remove();
-
}
-
}
-
-
function installMutationObserver(root) {
-
if (!("MutationObserver" in window)) {
-
window.MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver;
-
}
-
var observer = new MutationObserver(function (mutations) {
-
mutations.forEach(function(m) {
-
m.addedNodes.forEach(function(n){
-
if(n.tagName == "SPAN") {
-
checkAndDeleteSingle(n);
-
}
-
});
-
});
-
});
-
observer.observe(root, {childList: true, subtree: true, attributes: true});
-
}
-
function installStupidObserver(dbUtilsProm,root) {
-
if (!("MutationObserver" in window)) {
-
window.MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver;
-
}
-
var observer = new MutationObserver(function (mutations) {
-
mutations.forEach(function(m) {
-
m.addedNodes.forEach(function(n){if(n.tagName == "DIV") {
-
n.querySelectorAll("span").forEach(function(node) {checkAndDeleteSingle(node);});
-
}
-
});
-
});
-
});
-
observer.observe(document, {childList: true, subtree: true, attributes: true});
-
}
-
-
//dom parser
-
checkAndDeleteAll();
-
//4chan x
-
installMutationObserver(document);
-
//4chan native
-
window.setTimeout(function() { installStupidObserver(); }, 100);
253 2.77 KB 88
Flag Hider (4ChanX)
By AnonPPPCreated: 2021-07-16 21:31:33
Updated: 2021-10-01 15:08:14
Expiry: Never
by AnonPPP
by AnonPPP
by AnonPPP
by AnonPPP
by AnonPPP