Greasy Fork is available in English.

京东购物车显示自营

f?ck jd

// ==UserScript==
// @name         京东购物车显示自营
// @namespace    http://tampermonkey.net/
// @version      2024-03-17
// @description  f?ck jd
// @author       7nc
// @match        https://cart.jd.com/cart_index
// @icon         https://www.google.com/s2/favicons?sz=64&domain=jd.com
// @grant        GM_addStyle
// @run-at       document-end
// ==/UserScript==

(function() {
    // Your code here...


    function handleSelf(){
        var shopList = document.getElementsByClassName("shop-name")
        for(let i = 0; i<shopList.length; i++){

            var shopName = shopList[i]
            var shopId = shopName.dataset.vendorid

            if(shopId && shopId.indexOf("1000")>-1){
                //console.log(shopId+" is ok")
                var selfIcon = document.createElement("em");
                selfIcon.setAttribute("style", "padding: 2px;margin-right: 2px;text-align: center;color: #fff;background: #e4393c;");
                selfIcon.innerText = "自营";
                shopName.insertBefore(selfIcon,shopName.firstChild);
            }
        }
    }

    var existCondition = setInterval(function() {
        if (document.getElementsByClassName("shop-name").length) {
            console.log("ready to shit!");
            clearInterval(existCondition);
            handleSelf()
        }
    }, 500);
})();