Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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",
"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.css('display', 'none');
p.css('visibility', 'hidden');
p.css('height', '0');
});
});
console.log("HHNQ: complete");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.