Greasy Fork

Etsy - Sponsored Products remover

Removes the sponsored products/banners/suggested searches/etc from Etsy.

目前为 2023-04-28 提交的版本。查看 最新版本

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

new MutationObserver(function(mutationList, observer) {
    // Remove "organic" listings
    document.querySelectorAll('[data-search-results-region] > ul > li').forEach(item => {
        if (item.querySelector('[data-appears-component-name="search2_organic_listings_group"]') === null) item.remove();
    });

    // Remove most loved
    document.querySelectorAll('[data-top-rated-narrowing-intent-search]').forEach(function(element) {
        element.style.display = 'none';
    });

    // Remove "Ad by Etsy seller" results
    document.querySelectorAll('.v2-listing-card__info').forEach(function(element) {
        if (!element.innerText.includes(' by Etsy seller')) {
            return;
        }

        const parent = element.closest('li.wt-list-unstyled');
        if(parent) parent.remove();
    });

    // Remove "Ad by Etsy seller" results on a product page
    document.querySelectorAll('[class*="listing_page_ad_row-"]').forEach(function(element) {
        const parent = element.closest('li.v2-listing-card');
        if(parent) parent.remove();
    });
}).observe(document.body, {childList: true, subtree: true});