Created
March 23, 2023 13:00
-
-
Save surprisetalk/462789361723211fcda71e13fa08bbc0 to your computer and use it in GitHub Desktop.
Userscript to hide any HackerNews story with "GPT" in its title.
This file contains 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 HackerNews GPT-Free Feed | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hides any Hacker News story with "GPT" in its title. | |
// @author Taylor Troesh | |
// @include https://news.ycombinator.com/* | |
// @grant none | |
// ==/UserScript== | |
[...document.getElementsByClassName("athing")].forEach(function(x) { | |
if(x.getElementsByClassName("titleline")[0].innerText.match(/gpt/i)) { | |
x.hidden = true; | |
x.nextElementSibling.hidden = true; | |
x.nextElementSibling.nextElementSibling = true; | |
} | |
}); |
equivalent uBlock filter:
news.ycombinator.com##.athing:has(.titleline:has-text(/GPT/i))
news.ycombinator.com##.athing:has(.titleline:has-text(/GPT/i)) + tr
news.ycombinator.com##.athing:has(.titleline:has-text(/GPT/i)) + tr + tr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slightly shorter, using
querySelectorAll
andquerySelector
also, is the last one supposed to have
hidden
too? so maybe