Amazon Sponsored Products / Ad block

Blocks sponsored search results on amazon.com, amazon.co.uk and amazon.de and some banner ads

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Amazon Sponsored Products / Ad block
// @version      0.2
// @author       Michael with some help from the internet
// @description  Blocks sponsored search results on amazon.com, amazon.co.uk and amazon.de and some banner ads
// @include      *://www.amazon.de/*
// @include      *://www.amazon.com/*
// @include      *://www.amazon.co.uk/*
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// @run-at document-end
// @namespace https://greasyfork.org/users/163754
// ==/UserScript==

$ = jQuery.noConflict(true);
var pageContentchanged = false;
$('body').bind("DOMSubtreeModified", function() {
    pageContentchanged = true;
});
setInterval(removeSponsoredAds, 200);
console.log("amazon-sponsored-items-blocker loaded");

function removeSponsoredAds() {
    if (pageContentchanged) {
        var count = 0;
        $('.celwidget').each(function(i, obj) {
            if ($(this).find(".s-sponsored-info-icon").length > 0) {
                //console.log("Object " + i + " contains an ad");
                //$(this).css('background-color', 'red');
                (this).remove();
                count++;
            }
        });
        console.log("amazon-sponsored-items-blocker: " + count + " ads removed!");
        $(".slot__ad").hide();
        $(".slot__feedback").hide();
        $("[id*='ape_']").hide();
        $("[id*='sponsored']").hide();
        $("[id*='sp_']").hide();
        $("[id*='advertising']").hide();
        pageContentchanged = false;
    }

}