Greasy Fork

Etsy - Remove Promoted Ads

Remove the promoted ads that clutter the search results on Etsy.

目前为 2022-03-18 提交的版本。查看 最新版本

// ==UserScript==
// @name         Etsy - Remove Promoted Ads
// @author       RandomUsername404
// @namespace    https://greasyfork.org/en/users/105361-randomusername404
// @version      1.3
// @description  Remove the promoted ads that clutter the search results on Etsy.
// @run-at       document-start
// @include      https://www.etsy.com/*/search?q=*
// @include      https://www.etsy.com/search?q=*
// @grant        none
// @icon         https://www.etsy.com/images/favicon.ico
// @license MIT
// ==/UserScript==

var promoted = ["Annonce de", "Publicité d'", "Anzeige des", "Ad from", "Ad by", "Anuncio de", "Annuncio dal negozio", "Annuncio di", "ショップ", "Etsy セラーによる広告", "Advertentie van", "Reklama ze sklepu", "Reklama sprzedawcy", "Anúncio de", "Реклама от"];

window.onload = function() {
    var elements = document.querySelectorAll('.wt-screen-reader-only');
    Array.prototype.forEach.call(elements, function(el, i) {

        for(var count=0; count < promoted.length; count++) {
            var style = window.getComputedStyle(el), display=style.getPropertyValue('display');
            if(el.innerHTML.includes(promoted[count]) && display != 'none') {
                var item = el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                item.parentNode.removeChild(item);
            }
        }
    });
}