52

Is it possible to filter out Stack Exchange sites from the hot questions list?

4

1 Answer 1

10

Not likely.

But you could using a Greasemonkey script. Not the most complete set of features but it does what you want. Just update the blacklist and whitelist within the script to suit your needs.

// ==UserScript==
// @name           Filter Hot SE questions
// @namespace      http://stackoverflow.com/users/390278
// @include        http://stackoverflow.com/*
// @include        http://*.stackoverflow.com/*
// @include        http://superuser.com/*
// @include        http://*.superuser.com/*
// @include        http://serverfault.com/*
// @include        http://*.serverfault.com/*
// @include        http://stackapps.com/*
// @include        http://*.stackapps.com/*
// @include        http://askubuntu.com/*
// @include        http://*.askubuntu.com/*
// @include        http://*.stackexchange.com/*
// ==/UserScript==

(function() {
    function embedScript(id, main, globalFunctions) {
        var scriptElement = document.createElement("script");
        scriptElement.type = "text/javascript";
        scriptElement.id = id;
        var name, content = "";
        if (globalFunctions) {
            for (name in globalFunctions) {
                if (globalFunctions.hasOwnProperty(name)) {
                    content = content + name + "=(" + globalFunctions[name].toString() + "());\n";
                }
            }
        }
        content = content + "(" + main.toString() + "());";
        scriptElement.textContent = content;
        document.getElementsByTagName("head")[0].appendChild(scriptElement);
        return scriptElement;
    }

    embedScript("filter-hot-se-questions", function () {
        var blacklist = [
            "english.stackexchange.com",
        ];
        var whitelist = [
            "stackoverflow.com",
        ];

        $(".genu").click(function () {
            var retryCount = 0;
            const retryMax = 3;

            function tryFilter() {
                var $query = $("#seContainerHot>.itemBox").filter(function () {
                    var $link = $(this).find(".siteLink");
                    var site = $link.attr("href").match(/:\/\/(?:www\.)?(.[^\/:]+)/)[1];
                    return !$.inArray(site, blacklist) && $.inArray(site, whitelist);
                });

                if ($query.length > 0) {
                    returyCount = 0;
                }

                $query.hide();

                if (retryCount++ < retryMax) {
                    window.setTimeout(tryFilter, 1000);
                }
            }

            window.setTimeout(tryFilter, 1000);
        });
    });
}());
6
  • 1
    Well, isn't the problem with this that you won't get any other hot questions to replace the ones that your greasemonkey script removes. You could end up with a nearly empty hot questions list if you are only interested in a few SE sites.
    – Sam
    Commented May 12, 2011 at 8:47
  • @Sam: Naturally. But that's a StackExchange "feature." It's how most things work here anyway. A fixed amount of content is downloaded and uninteresting items are merely hidden away. e.g., hiding questions with uninteresting tags. It would have to make another request to get more content (something on my todo list once I figure out how to do that). Commented May 12, 2011 at 8:52
  • 1
    Well, wouldn't it make more sense to do the filtering server-side?
    – Sam
    Commented May 12, 2011 at 8:54
  • @Sam: IMHO yes of course. However we can only wish that the SE team does that but they don't. But I don't blame em. With the traffic they have to deal with every day, I can understand why they'd want to offload some of that work. Commented May 12, 2011 at 8:56
  • 2
    there is also the problem that not all users necessarily have control of the pc they are reading from
    – jk.
    Commented Sep 3, 2011 at 10:54
  • There is also the problem that users may not use a Greasemonkey-capable browser. Commented Feb 24, 2014 at 0:42

Not the answer you're looking for? Browse other questions tagged .