hide hot network questions

adds a toggle button to hide/show hot network questions on stackexchange sites

  1. // ==UserScript==
  2. // @name hide hot network questions
  3. // @namespace hasanyavuz.ozderya.net
  4. // @description adds a toggle button to hide/show hot network questions on stackexchange sites
  5. // @include *.stackexchange.com/*
  6. // @include *stackoverflow.com/*
  7. // @include *mathoverflow.net/*
  8. // @include *serverfault.com/*
  9. // @include *stackapps.com/*
  10. // @include *superuser.com/*
  11. // @include *askubuntu.com/*
  12. // @version 2
  13. // @grant none
  14. // @require https://code.jquery.com/jquery-3.2.1.slim.min.js
  15. // ==/UserScript==
  16.  
  17. // hide initially
  18. qlist = $("#hot-network-questions :gt(1)").css("visibility", "hidden");;
  19.  
  20. // setup a button to hide/show
  21. hsbtn = $("<a>SHOW</a>").css({"font-size":"50%",
  22. "border-width" : "1px",
  23. "border-style" : "solid",
  24. "padding" : "1px",
  25. "display" : "inline",
  26. "margin-left" : "0.5em"});
  27.  
  28. hsbtn.insertAfter($("#hot-network-questions h4 a"));
  29.  
  30. hsbtn.click(function(){
  31. if (qlist.css("visibility") == "hidden")
  32. {
  33. qlist.css("visibility", "");
  34. hsbtn.html("HIDE");
  35. }
  36. else
  37. {
  38. qlist.css("visibility", "hidden");
  39. hsbtn.html("SHOW");
  40. }
  41. });