Skip to content

Instantly share code, notes, and snippets.

@butelo
Last active July 8, 2023 10:40
Show Gist options
  • Save butelo/b2d6e338567ecac17a2723edeb5efd83 to your computer and use it in GitHub Desktop.
Save butelo/b2d6e338567ecac17a2723edeb5efd83 to your computer and use it in GitHub Desktop.
remove comments from users of marca with tampermonkey
// ==UserScript==
// @name marcablocker
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.marca.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=marca.com
// @grant none
// ==/UserScript==
(function() {
var blockedUsers =["Atletibiza", "Messi10y10liga", " indignado-atletico", "Mahou_5_Estrellas", "albeixon"];
const collection = document.getElementsByClassName("nombre_usuario");
for(var i=collection.length - 1; i>=0; i--) {
if (blockedUsers.includes(collection[i].innerHTML)){
collection[i].parentNode.parentNode.remove()
}
}
const observer = new MutationObserver((mutationsList) => {
const commentscollection = document.getElementsByClassName("nombre_usuario");
for(var i=commentscollection.length - 1; i>=0; i--) {
if (blockedUsers.includes(commentscollection[i].innerHTML)){
commentscollection[i].parentNode.parentNode.remove()
}
}
} )
observer.observe(
document.getElementById("comentarios_interior"),
{childList: true, subtree: true}
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment