Geenstijl add remover

Remove adds articles from Geenstijl.nl

目前為 2024-03-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Geenstijl add remover
// @namespace    https://www.geenstijl.nl/
// @version      0.7
// @description  Remove adds articles from Geenstijl.nl
// @author       Rick van der Staaij
// @require      http://code.jquery.com/jquery-latest.min.js
// @include      https://www.geenstijl.nl/*
// @grant        none
// @license MIT
// ==/UserScript==

function removeAddArticles() {
    let cleanCounter = 0;
    $('article').each(function() {
        if ($(this).find(".compost-warn:contains('Ingezonden mededeling')").length > 0) {
            cleanCounter++;
            $(this).remove();
        }
    });
    if (cleanCounter > 0) {
        console.log('[Geenstijl add killer] Removed ' + cleanCounter + ' spam cards.');
    }
}

function removePromoBlocks() {
    console.log('[Geenstijl add killer] Cleaning crap.');
    $('.article-premium-promotion-block, .pgAdWrapper, .become-premium, .modal-float-in, .not-a-pixel, div[data-page="site_index.homepage"], .afctr-wrapper').remove();
}

function clean() {
    removePromoBlocks();
    removeAddArticles();
    setTimeout(function() { removePromoBlocks(); }, 1000);
}

(function() {
    'use strict';

    console.log('[Geenstijl add killer] Killing spam...');
    clean();

    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;

    var observer = new MutationObserver(function(mutations, observer) {
        clean();
    });

    observer.observe(document, {
        subtree: true,
        attributes: true,
    });

    $( document ).ready(function() { clean(); });
    $( window ).on( "load", function() { clean(); });
})();