Greasy Fork

Marktplaats - Sponsored Products remover

Removes the terrible sponsored products/banners/suggested searches/etc from Marktplaats.nl.

目前为 2022-12-16 提交的版本。查看 最新版本

// ==UserScript==
// @name        Marktplaats - Sponsored Products remover
// @namespace   https://greasyfork.org/en/users/2755-robotoilinc
// @author      RobotOilInc
// @version     0.1.1
// @license     MIT
// @description Removes the terrible sponsored products/banners/suggested searches/etc from Marktplaats.nl.
// @match       http*://www.marktplaats.nl/q/*
// @icon        https://i.imgur.com/NLIZEzb.png
// @run-at      document-body
// ==/UserScript==

new MutationObserver(function(mutationList, observer) {
    // Remove "Topadvertentie" results
    document.querySelectorAll('.hz-Listing-priority').forEach(function(element) {
        if (!element.innerText.includes('Topadvertentie')) {
            return;
        }

        const parent = element.closest('li.hz-Listing');
        if(parent) parent.hide();
    });

    // Remove all the banners
    document.querySelectorAll('.hz-Banner').forEach(function(element) {
        element.hide();
    });

    // Remove adsence
    document.querySelectorAll('#adsense-container').forEach(function(element) {
        element.hide();
    });

    // Remove suggested searches
    document.querySelectorAll('.hz-SuggestedSearches-container').forEach(function(element) {
        element.hide();
    });

    // Remove listings
    document.querySelectorAll('.hz-Listings__container--cas').forEach(function(element) {
        element.hide();
    });
}).observe(document.body, { childList: true, subtree: true });