Comment Is Hidden

Fra 20.04.2016. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           Comment Is Hidden
// @description:en Remove the Coment Is Free articles (and the whole Opinion section) from the Guardian's front page.
// @namespace      www.ballpointbanana.com
// @include        http://www.theguardian.com/uk
// @version        1
// ==/UserScript==

// Find the Opinion subsection.
var opinion = document.querySelector("section#opinion");
opinion.style = "display:none;"

// Find all the "items" on the Guardian.
var items = document.querySelectorAll("div.fc-item__container");

// Spin through them and hide all the divs containing a link to commentisfree.
for (var ii = 0; ii < items.length; ii++) {
    var thisdiv = items[ii];
    if (thisdiv.querySelector("a").href.indexOf("commentisfree") != -1) {
        thisdiv.style = "display: none;"
    }
}