Hide Negatively Voted Posts

Hides questions with a score of less than 0 from the front page

  1. // ==UserScript==
  2. // @name Hide Negatively Voted Posts
  3. // @author Cameron Bernhardt (AstroCB)
  4. // @version 2.0.0
  5. // @namespace https://github.com/AstroCB
  6. // @description Hides questions with a score of less than 0 from the front page
  7. // @include http://*.stackexchange.com/
  8. // @include http://stackoverflow.com/
  9. // @include http://meta.stackoverflow.com/
  10. // @include http://serverfault.com/
  11. // @include http://meta.serverfault.com/
  12. // @include http://superuser.com/
  13. // @include http://meta.superuser.com/
  14. // @include http://askubuntu.com/
  15. // @include http://meta.askubuntu.com/
  16. // @include http://stackapps.com/
  17. // ==/UserScript==
  18.  
  19. document.getElementsByTagName("head")[0].appendChild(show);
  20. var votes = document.getElementsByClassName("votes");
  21. var questions = document.getElementsByClassName("question-summary narrow");
  22.  
  23. var counts = [];
  24. for (var i = 0; i < votes.length; i++) {
  25. counts[i] = votes[i].children[0].children[0].innerHTML;
  26. }
  27.  
  28. for (var i = 0; i < counts.length; i++) {
  29. if (parseInt(counts[i]) < 0) {
  30. questions[i].hidden = "hidden";
  31. }
  32. }