Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name HN
- // @description Hacker News User Script
- // @match *://news.ycombinator.com/*
- // ==/UserScript==
- const domainblacklist = [
- "bbc.com",
- "twitter.com",
- "economist.com",
- "npr.org",
- "eff.org",
- "businessinsider.com",
- "theguardian.com",
- "engadget.com",
- "reuters.com",
- "buzzfeednews.com",
- "wsj.com",
- "newyorker.com",
- "wikipedia.org",
- "thehill.com",
- "arstechnica.com",
- "washingtonpost.com",
- "cnn.com",
- "nytimes.com",
- "axios.com",
- "bbc.co.uk",
- "mercurynews.com",
- "nih.gov"
- ]
- function matchesBlacklist(href) {
- for (let bl of domainblacklist) {
- if (href.indexOf(bl) >= 0) return true;
- }
- return false;
- }
- function removePost(anchor) {
- const tr = anchor?.parentNode?.parentNode?.parentNode;
- console.log("removing:", anchor, tr)
- const nsibling = tr?.nextElementSibling
- const psibling = tr?.previousElementSibling
- if (tr) {tr.parentNode.removeChild(tr)}
- if (nsibling) {nsibling.parentNode.removeChild(nsibling)}
- if (psibling) {psibling.parentNode.removeChild(psibling)}
- }
- for (let itm of document.querySelectorAll(".itemlist tr .sitebit a") || []) {
- if (matchesBlacklist(itm.getAttribute("href") || "")) removePost(itm);
- }
Advertisement
Add Comment
Please, Sign In to add comment