Skip to content

Instantly share code, notes, and snippets.

@plotti
Created November 28, 2022 09:15
Show Gist options
  • Save plotti/168f833a94cbd801c50ac7fc5bf280d3 to your computer and use it in GitHub Desktop.
Save plotti/168f833a94cbd801c50ac7fc5bf280d3 to your computer and use it in GitHub Desktop.
// ==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