Skip to content

Instantly share code, notes, and snippets.

@tucnak
Last active February 24, 2022 11:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tucnak/746b115d497c5f53b3a064001c61dd45 to your computer and use it in GitHub Desktop.
Save tucnak/746b115d497c5f53b3a064001c61dd45 to your computer and use it in GitHub Desktop.
Hide all mentions of Wordle from Hacker News feeds
// ==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