Remove the promoted ads that clutter the search results on Etsy.
< Opiniones de Etsy - Remove Promoted Ads
Ahhh this saved me, thank you! For those of you who don't know where to edit the script, just cut and paste this for the userscript:
window.onload = function() {
var elements = document.querySelectorAll('span.z-index-1');
Array.prototype.forEach.call(elements, function(el, i) {
var item = el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
item.parentNode.removeChild(item);
});
}
Thank you guys for the heads-up, and sorry I didn't check my GreasyFork sooner! The script has now been updated.
They appear to have changed the site again so this isn't working.
They have indeed.
Sorry it took me two months to notice. It is now fixed.
The site changed again, and the code doesn't work. Here's an updated version of the function that does.
Changes:
parentNode
to get rid of the "More like this" link.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);
}
}
});
}
Thanks for the heads-up, I'm updating it right away!
If you have uBlock Origin, adding this line to your filters works for me (as of time of posting at least!),
etsy.com##ol > li:not(:has(p.wt-screen-reader-only[aria-hidden])):style(display:none !important)
Although all the listings contain the 'Ad from Etsy seller' text in the html, and they both have it repeated with the wt-screen-reader-only
class, for the screen reader version, the ones that aren't actually ads also have aria-hidden="true"
whereas the real ads don't (this makes sense from an accessibility perspective).
I'm not certain why I needed the :style(...)
operator part (since that's what it should be doing by default), but perhaps there's a filter somewhere exempting etsy, and specifying :style(...)
overcomes this?
Uses outdated selector
Etsy has removed the ad selector to make this more difficult. The selector is now random. For now, it seems other listings don't have an absolute floating span, so I've changed the script to use "span.z-index-1" instead and it works as expected. A better selector could probably be used.