DT+ paywall hider

Hides all articles that is hidden behind a paywall

目前為 2017-04-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name         DT+ paywall hider
// @namespace    Danielv123
// @version      1.0
// @description  Hides all articles that is hidden behind a paywall
// @author       Danielv123
// @match        https://www.dt.no/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // remove articles on frontpage
    let paidArticles = document.querySelectorAll(".df-skin-paywall");
    for(let i = 0; i < paidArticles.length;i++){
        paidArticles[i].style.display = "none";
    }
    // remove articles on article pages
    // find the + sign and trace article box from parentElements
    // timeout apparently required
    setTimeout(function(){
        paidArticles = document.querySelectorAll(".am-premium-logo--imageoverlay");
        for(let i = 0; i < paidArticles.length;i++){
            paidArticles[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = "none";
        }
    },1000);
})();