// ==UserScript== // @name Etsy.com - Mute Deceptive Search Result Ads // @author snarp // @version 0.3 // @description Hides the difficult-to-identify ads in Etsy search results. // @run-at document-idle // @include https://www.etsy.com/*/search?q=* // @include https://www.etsy.com/search?q=* // @grant none // @icon https://www.etsy.com/images/favicon.ico // @namespace https://greasyfork.org/users/766248 // @downloadURL https://update.greasyfork.cloud/scripts/425684/Etsycom%20-%20Mute%20Deceptive%20Search%20Result%20Ads.user.js // @updateURL https://update.greasyfork.cloud/scripts/425684/Etsycom%20-%20Mute%20Deceptive%20Search%20Result%20Ads.meta.js // ==/UserScript== (function() { 'use strict'; // By default, turns ads down to 10% opacity. // To entirely remove them, uncomment the `ad.remove();` line. function muteItem(item) { item.style.opacity = 0.1; // item.remove(); } // As of 2021-04-28, all legitimate Etsy search result links contain the // CSS class 'organic-impression'. function muteAllAds() { var listings = document.querySelectorAll('div[data-search-results-region] ul li'); for (const listing of listings) { let link = listing.querySelector('a[data-listing-id]'); if (!link.classList.contains('organic-impression')) { muteItem(listing); } } document.removeEventListener('scroll', muteAllAds, true); } muteAllAds(); // And in case it doesn't fire successfully on idle: document.addEventListener('scroll', muteAllAds, true); })();