Greasy Fork

蝦皮廣告封鎖器

蝦皮搜尋結果的前幾個商品廣告封鎖

目前为 2021-12-24 提交的版本。查看 最新版本

// ==UserScript==
// @name         蝦皮廣告封鎖器
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description 蝦皮搜尋結果的前幾個商品廣告封鎖
// @author       fmnijk
// @match        https://shopee.tw/*
// @icon         https://www.google.com/s2/favicons?domain=shopee.tw
// @grant        none
// @license MIT
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    // 定时器
    setIntervalX(() => {
        $(".col-xs-2-4.shopee-search-item-result__item").each(function() {
             if ($(this).text().indexOf("廣告") != -1){
                    $(this).hide();
             }
        });
    }, 100, 10)
})();

function setIntervalX(callback, delay, repetitions) {
    var x = 0;
    var intervalID = window.setInterval(function () {

        callback();

        if (++x === repetitions) {
            window.clearInterval(intervalID);
        }
    }, delay);
}