StackExchange hide closed questions

Hide closed questions on the home page and in other lists of questions. Put a link showing the number of closed questions that have been hidden that shows the closed questions again.

Stan na 27-07-2017. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name StackExchange hide closed questions
// @namespace http://ostermiller.org/
// @version 1.11
// @description Hide closed questions on the home page and in other lists of questions.   Put a link showing the number of closed questions that have been hidden that shows the closed questions again.
// @include /https?\:\/\/([a-z\.]*\.)?stackexchange\.com\/.*/
// @include /https?\:\/\/([a-z\.]*\.)?askubuntu\.com\/.*/
// @include /https?\:\/\/([a-z\.]*\.)?superuser\.com\/.*/
// @include /https?\:\/\/([a-z\.]*\.)?serverfault\.com\/.*/
// @include /https?\:\/\/([a-z\.]*\.)?stackoverflow\.com\/.*/
// @include /https?\:\/\/([a-z\.]*\.)?answers.onstartups\.com\/.*/
// @grant none
// ==/UserScript==
function closedQuestionVisibility(show){
    var numberOfClosed=0;
    $('.question-summary').each(function(){
        var e = $(this);
        var t = e.find('h3 a').text();
        if (t.match(/\]$/)){
            e.addClass('closed');
            if(show){
                e.show();
            } else {
                e.hide();
            }
            numberOfClosed++;
        }
    });
    return numberOfClosed;
}

function run(){
    if ($('.question-summary').length){  // if it has a list of questions
        var numberHidden=closedQuestionVisibility(false);
        if (numberHidden > 0){
            $('.question-summary:first').parent().prepend(" <a href='#' id='unhideclosedlink'>(" + numberHidden + " hidden closed)</a>");
            $('#unhideclosedlink').click(function(){
                closedQuestionVisibility(true);
                $('#unhideclosedlink').hide();
                return false;
            });
            $('html > head').append("<style>.question-summary.closed .status * { text-decoration: line-through; }</style>");
        }
    }
}

run();

$('.page-numbers').click(function(){
    setTimeout(run, 2000);  
});