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.

2022-01-25 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name StackExchange hide closed questions
// @namespace http://ostermiller.org/
// @version 1.13
// @license MIT 
// @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|askubuntu|superuser|serverfault|stackoverflow|answers\.onstartups)\.com\/.*/
// @exclude *://chat.stackoverflow.com/*
// @exclude *://chat.stackexchange.com/*
// @exclude *://chat.*.stackexchange.com/*
// @exclude *://api.*.stackexchange.com/*
// @exclude *://data.stackexchange.com/*
// @grant unsafeWindow
// ==/UserScript==
(function() {
	'use strict'
    var $ = unsafeWindow.jQuery

    function closedQuestionVisibility(show){

        var numberOfClosed=0;
        $('.question-summary, .s-post-summary').each(function(){
            var e = $(this)
            var t = e.find('h3 a, .s-post-summary--content-title a').text()
            if (t.match(/ \[(migrated|closed|duplicate)\]$/)){
                e.addClass('closed').toggle(show)
                numberOfClosed++
            }
        });
        return numberOfClosed
    }

    function run(){
        if ($('.question-summary, .s-post-summary').length){ // if it has a list of questions
            var numberHidden=closedQuestionVisibility(false)
            if (numberHidden > 0){
                $('#mainbar h1').after(" <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 *, .s-post-summary.closed .s-post-summary--stats * { text-decoration: line-through; }</style>")
            }
        }
    }

    run()

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