Skip to content

Instantly share code, notes, and snippets.

@pxeger
Last active February 21, 2022 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pxeger/4aed4baaa87028a2ecc6441a84a1fbc2 to your computer and use it in GitHub Desktop.
Save pxeger/4aed4baaa87028a2ecc6441a84a1fbc2 to your computer and use it in GitHub Desktop.
Userscript to auto-hide job adverts on HackerNews
// ==UserScript==
// @name Remove job adverts from HackerNews
// @namespace _.pxeger.com
// @version 1.1
// @downloadURL https://gist.githubusercontent.com/pxeger/4aed4baaa87028a2ecc6441a84a1fbc2/raw
// @author Patrick Reader <_@pxeger.com>
// @grant none
// @match *://news.ycombinator.com/*
// ==/UserScript==
// licence: GPL v3 (https://www.gnu.org/licenses/gpl-3.0.en.html)
(() => {
if (!document.getElementById("me")) {
// not logged in
return;
}
document.querySelectorAll(".athing").forEach(athing => {
if (athing.querySelector(".votelinks") === null) {
athing.nextSibling.querySelector("a[href^=hide]").click();
}
});
})();
@pxeger
Copy link
Author

pxeger commented Feb 20, 2022

To install, this userscript, install a UserScript Manager such as ViolentMonkey, then click here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment