Created
November 28, 2022 09:15
-
-
Save plotti/168f833a94cbd801c50ac7fc5bf280d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove_news | |
// @version 1 | |
// @grant none | |
// @include https://www.watson.ch/* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js | |
// ==/UserScript== | |
//https://gist.github.com/BrockA/2625891 | |
function recurseEl(father,element) { | |
if(element.childElementCount === 0) { | |
search = /(ukraine)|(selenskyj)|(liveticker)|(influencer)|(fifa)|(messi)|(infantino)|(corona)|(putin)|(bolsonaro)|(trump)|(trumps)|(arabischen)|(arabisch)|(jong)|(musk)|(promis)|(promi)|(katar)|(boateng)|(russland)|(russen)|(nati)|(weltmeister)/ | |
if (element.innerText.toLowerCase().match(search)){ | |
console.log("removing" + element.innerText) | |
element.textContent = ''; | |
father.style.display = "none"; | |
} | |
} else { | |
Array.from(element.children).forEach(child => { | |
recurseEl(father,child); | |
}); | |
} | |
} | |
function updateHTML() | |
{ | |
$('.region').each(function(i, obj) { | |
try { | |
recurseEl(obj,obj); | |
} catch (error) { | |
console.error(error); | |
} | |
}); | |
}; | |
var intervalId = window.setInterval(function(){ | |
updateHTML(); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment