Last active
February 24, 2022 11:38
-
-
Save tucnak/746b115d497c5f53b3a064001c61dd45 to your computer and use it in GitHub Desktop.
Hide all mentions of Wordle from Hacker News feeds
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 Stop Wordle! | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Hide all mentions of Wordle from Hacker News feeds! | |
// @author https://github.com/tucnak | |
// @match https://news.ycombinator.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=ycombinator.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let feed = document.querySelectorAll('.itemlist tr'); | |
for (var i = 0; i < feed.length; i++) { | |
if (!feed[i].classList.contains('athing') || !/(W|w)ordle/.test(feed[i].textContent)) { | |
continue; | |
} | |
feed[i].hidden = true; | |
if (i+1 < feed.length) { | |
feed[i+1].hidden = true; | |
} | |
if (i+2 < feed.length && feed[i+2].classList.contains('spacer')) { | |
feed[i+2].hidden = true; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment