Last active
November 25, 2020 16:52
-
-
Save wolframkriesing/94e57a423c6758989282257b45055479 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
| const stopWords = ['corona', 'pandemie', 'trump', 'biden']; | |
| const cleanArticles = () => { | |
| const articles = document.querySelectorAll('article'); | |
| const toRemove = new Set(); | |
| articles.forEach(a => { | |
| stopWords.map(word => { | |
| if (a.textContent.toLowerCase().includes(word)) { | |
| toRemove.add(a); | |
| } | |
| }); | |
| }); | |
| toRemove.forEach(a => a.style.opacity = .1); // make them less opaque | |
| //toRemove.forEach(a => a.remove); // remove them | |
| console.log(`cleaned ${toRemove.size} articles`); | |
| }; | |
| cleanArticles(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment