Created
April 6, 2021 08:53
-
-
Save AlexChesters/3119b803b73f27984cbcc57e97068d4a to your computer and use it in GitHub Desktop.
hides all discussions on Hacker News
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 No More HN Discussions | |
// @version 0.0.1 | |
// @grant none | |
// @include https://news.ycombinator.com/* | |
// ==/UserScript== | |
// hide all comments | |
const allTableLinks = document.querySelectorAll('td.subtext > a') | |
for (let i = 0; i < allTableLinks.length; i++) { | |
if (allTableLinks[i].href.includes('item?id=')) { | |
allTableLinks[i].style.display = 'none' | |
} | |
} | |
// hide all Ask HN posts | |
const allPostTitles = document.querySelectorAll('.storylink') | |
for (let i = 0; i < allPostTitles.length; i++) { | |
if (allPostTitles[i].innerText.includes('Ask HN')) { | |
allPostTitles[i].style.display = 'none' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment