Skip to content

Instantly share code, notes, and snippets.

@madranet
Last active July 27, 2021 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madranet/2e7b4e5e04ed7093291fb3dd4c909a8c to your computer and use it in GitHub Desktop.
Save madranet/2e7b4e5e04ed7093291fb3dd4c909a8c to your computer and use it in GitHub Desktop.
console.log("HackerChoose --loaded external JS");
var shitdomains = [
"arstechnica.com",
"bbc.com",
"beyouteous.com",
"bloomberg.com",
"businessweek.com",
"buzzfeednews.com",
"cbsnews.com",
"cnbc.com",
"cnet.com",
"cnn.com",
"edopedia.com",
"engadget.com",
"facebook.com",
"fastcompany.com",
"forbes.com",
"ft.com",
"gigaom.com",
"gizmodo.com",
"hbr.org",
"hollywoodreporter.com",
"huffingtonpost.com",
"iafrikan.com",
"indianexpress.com",
"interestingengineering.com",
"itworld.com",
"latimes.com",
"linkedin.com",
"livescience.com",
"mashable.com",
"medium.com",
"nautil.us",
"nbcnews.com",
"ndtv.com",
"networkworld.com",
"npr.org",
"nydailynews.com",
"nymag.com",
"nypost.com",
"nytimes.com",
"posterous.com",
"readwriteweb.com",
"reuters.com",
"reddit.com",
"slate.com",
"space.com",
"spiegel.de",
"supercluster.com",
"techcrunch.com",
"technologyreview.com",
"theatlantic.com",
"thenation.com",
"thenextweb.com",
"theoatmeal.com",
"theverge.com",
"tomshardware.com",
"tribunemag.co.uk",
"twitter.com",
"venturebeat.com",
"mobile.twitter.com",
"vice.com",
"washingtonpost.com",
"wired.co.uk",
"wired.com",
"wsj.com",
"yahoo.com",
];
//whether to renumber where stories have been removed
var renumber = false;
//site refs live in '<span class="sitestr">shitsite.com</span>'
[...document.querySelectorAll('.sitestr')]
.filter(e=>shitdomains.includes(e.textContent))
.map(e=>e.closest('tr.athing'))
.forEach(e=>{
for (let i=0,ee=e,nee; i<3; i++) {
nee = ee.nextElementSibling;
ee.parentNode.removeChild(ee);
ee = nee;
}
});
if (renumber) {
let snum;
document.querySelectorAll('.rank')
.forEach((e,i)=>{
if (!snum) snum = +e.textContent.match(/\d+/)[0];
e.textContent = (snum++)+'.';
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment