Comment Is Hidden

Remove the Comment Is Free articles (and the whole Opinion section) from the Guardian's front page.

  1. // ==UserScript==
  2. // @name Comment Is Hidden
  3. // @description:en Remove the Comment Is Free articles (and the whole Opinion section) from the Guardian's front page.
  4. // @namespace www.ballpointbanana.com
  5. // @include http://www.theguardian.com/uk
  6. // @version 1
  7. // @description Remove the Comment Is Free articles (and the whole Opinion section) from the Guardian's front page.
  8. // ==/UserScript==
  9.  
  10. // Find the Opinion subsection.
  11. var opinion = document.querySelector("section#opinion");
  12. opinion.style = "display:none;"
  13.  
  14. // Find all the "items" on the Guardian.
  15. var items = document.querySelectorAll("div.fc-item__container");
  16.  
  17. // Spin through them and hide all the divs containing a link to commentisfree.
  18. for (var ii = 0; ii < items.length; ii++) {
  19. var thisdiv = items[ii];
  20. if (thisdiv.querySelector("a").href.indexOf("commentisfree") != -1) {
  21. thisdiv.style = "display: none;"
  22. }
  23. }