Skip to content

Instantly share code, notes, and snippets.

@dmolesUC
Last active July 9, 2019 20:00
Show Gist options
  • Save dmolesUC/5c72950d2bf25d6e036e39b61a443686 to your computer and use it in GitHub Desktop.
Save dmolesUC/5c72950d2bf25d6e036e39b61a443686 to your computer and use it in GitHub Desktop.
Tampermonkey script for hiding certain StackExchange sites from the "Hot Network Questions" section
// ==UserScript==
// @name Hide Hot Network Questions
// @namespace GreaseMonkeyStackOverflow
// @description Hides certain Hot Network Questions on Stack Overflow
// @include http://*.stackexchange.com/*
// @include http://stackoverflow.com/*
// @include http://*.stackoverflow.com/*
// @include http://*.askubuntu.com/*
// @include http://*.mathoverflow.com/*
// @include http://*.serverfault.com/*
// @include http://*.superuser.com/*
// @include https://*.stackexchange.com/*
// @include https://stackoverflow.com/*
// @include https://*.stackoverflow.com/*
// @include https://*.askubuntu.com/*
// @include https://*.mathoverflow.com/*
// @include https://*.serverfault.com/*
// @include https://*.superuser.com/*
// @version 2
// @grant none
// see https://meta.stackexchange.com/questions/225297/filter-hot-network-questions-by-excluding-sites
// ==/UserScript==
console.log("HHNQ: starting");
$.each([
"academia",
"boardgames",
"cogsci",
"codegolf",
"cooking",
"cseducators",
"economics",
"english",
"ethereum",
"history",
"interpersonal",
"law",
"linguistics",
"magento",
"money",
"movies",
"music",
"parenting",
"philosophy",
"poker",
"politics",
"puzzling",
"salesforce",
"skeptics",
"space",
"sports",
"vegetarianism",
"workplace",
"worldbuilding",
"writing"
], function(i, sitename) {
var favicon = $("div.favicon-" + sitename);
if (!favicon) {
console.log("HHNQ: Favicon for " + sitename + " not found");
return;
}
var parent = favicon.closest("li")
if (!parent || parent.length <= 0) {
console.log("HHNQ: Parent for " + sitename + " not found");
return;
}
parent.each(function(index) {
var p = $(this)
console.log("HHNQ: " + sitename + "/" + index + ": Attempting to hide " + p.outerHTML());
p.remove();
});
});
console.log("HHNQ: complete");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment