jd only

只显示京东自营商品

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

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

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         jd only
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  只显示京东自营商品
// @author       heroin
// @match        https://list.jd.com/list.html*
// @match        https://search.jd.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var list = document.getElementsByClassName("gl-warp clearfix")[0].children;
    var i = 0;
    for(i; i<list.length;i++){
        var item = list[i];
        var jd = item.children[0];
        var j = jd.children.length - 1;
        for (j;j>-1;j--){
            var subItem = jd.children[j];
            console.log( i +" ===========");
            if(subItem.className.indexOf("p-icons") > -1){
                if(subItem.children.length > 0){
                    var title = subItem.children[0].innerText;
                    console.log(title);

                    if('自营' != title){
                        item.style='display:none';
                    }
                }else{
                    item.style='display:none';
                    console.log("no p-icons");
                }
                break;
            }
        }

    }

})();