// ==UserScript== // @name Remove unwanted news // @version 1.3 // @grant none // @namespace news_filtering // @description This script helps you to filter out the news that you don't want to see. This example works for zeit.de, spiegel.de and watson.ch (popular swiss newssite) // @license MIT // @include https://www.watson.ch/* // @match https://www.zeit.de/* // @match https://www.spiegel.de/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @downloadURL none // ==/UserScript== //https://gist.github.com/BrockA/2625891 function recurseEl(father,element) { if(element.childElementCount === 0) { search = /(macron)|(merz)|(elon)|(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() { var href = window.location.host; if (href == "www.zeit.de"){ var selector = ".zon-teaser-standard, .zon-teaser-wide, .zon-teaser-poster" } else if (href == "www.watson.ch"){ var selector = '.region' } else if (href == "www.spiegel.de"){ var selector = "article" } $(selector).each(function(i, obj) { try { recurseEl(obj,obj); } catch (error) { console.error(error); } }); }; var intervalId = window.setInterval(function(){ updateHTML(); }, 2000);