Amazon - hide sponsored item in search result

I'm cheap!

目前为 2022-10-31 提交的版本。查看 最新版本

// ==UserScript==
// @name         Amazon - hide sponsored item in search result
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  I'm cheap!
// @author       You
// @license      MIT
// @match        https://*.amazon.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=amazon.com
// @grant        none
// @require http://code.jquery.com/jquery-3.5.1.min.js
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */


(function() {
    'use strict';
    setInterval(function () {
        const sponsoredContents = $('div.AdHolder.s-result-item.s-asin');
        if(sponsoredContents.length > 0) {
            $.each(sponsoredContents, function(index, item){
                if($(this).text().indexOf('Sponsored') > -1) {
                    const color = $(this).css('background-color');
                    const s = $(this).find('span.a-color-secondary');
                    const sHover = $(this).find('span.s-label-popover-hover');
                    if(s && color !== 'rgb(128, 128, 128)') {
                        s.removeClass('a-color-secondary');
                        s.css({ 'color': 'red', 'font-size': '200%' });
                    }
                    if(sHover && color !== 'rgb(128, 128, 128)') {
                        sHover.removeClass('a-color-base');
                        sHover.css({ 'color': 'red', 'font-size': '120%' });
                    }

                    if(s || sHover){
                        // $(this).parent().parent().parent().css({ 'background-color': 'grey'});
                        $(this).css({ 'background-color': 'grey'});
                    }

                }
            });
        }
        else {
            console.log('no sponsored contents on this page...');
        }
    }, 2500);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址