Skip to content

Instantly share code, notes, and snippets.

@tucnak
Created February 23, 2022 13:27
Show Gist options
  • Save tucnak/b8046372975c488cf5365995a21c8178 to your computer and use it in GitHub Desktop.
Save tucnak/b8046372975c488cf5365995a21c8178 to your computer and use it in GitHub Desktop.
StopWordle: 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