Skip to content

Instantly share code, notes, and snippets.

@AlexChesters
Created April 6, 2021 08:53
Show Gist options
  • Save AlexChesters/3119b803b73f27984cbcc57e97068d4a to your computer and use it in GitHub Desktop.
Save AlexChesters/3119b803b73f27984cbcc57e97068d4a to your computer and use it in GitHub Desktop.
hides all discussions on Hacker News
// ==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