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.

2014/07/17のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name StackExchange hide closed questions
  3. // @namespace http://ostermiller.org/
  4. // @version 1.02
  5. // @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.
  6. // @include /https?\:\/\/([a-z\.]*\.)?stackexchange\.com\/.*/
  7. // @include /https?\:\/\/([a-z\.]*\.)?askubuntu\.com\/.*/
  8. // @include /https?\:\/\/([a-z\.]*\.)?superuser\.com\/.*/
  9. // @include /https?\:\/\/([a-z\.]*\.)?serverfault\.com\/.*/
  10. // @include /https?\:\/\/([a-z\.]*\.)?stackoverflow\.com\/.*/
  11. // @include /https?\:\/\/([a-z\.]*\.)?answers.onstartups\.com\/.*/
  12. // @grant none
  13. // ==/UserScript==
  14. function closedQuestionVisibility(show){
  15. var numberOfClosed=0;
  16. $('.question-summary').each(function(){
  17. var e = $(this);
  18. var t = e.find('h3 a').text();
  19. if (t.match(/\]$/)){
  20. if(show){
  21. e.show();
  22. } else {
  23. e.hide();
  24. }
  25. numberOfClosed++;
  26. }
  27. });
  28. return numberOfClosed;
  29. }
  30.  
  31. if (/\.com\/(questions)?([\?\#].*)?$/.exec(window.document.location.href)){ // only on pages with questions
  32. var numberHidden=closedQuestionVisibility(false);
  33. if (numberHidden > 0){
  34. $('#mainbar h1').append(" <a href='javascript:;' id='unhideclosedlink'>(" + numberHidden + " hidden closed)</a>");
  35. $('#unhideclosedlink').click(function(){
  36. closedQuestionVisibility(true);
  37. $('#unhideclosedlink').hide();
  38. });
  39. }
  40. }