Greasy Fork

Greasy Fork is available in English.

京东只选自营

检测京东搜索关键词,自动添加 【自营】,顺便去掉各种返利追踪等尾巴

当前为 2018-06-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         京东只选自营
// @description  检测京东搜索关键词,自动添加 【自营】,顺便去掉各种返利追踪等尾巴
// @namespace    http://greasyfork.icu/zh-CN/scripts/369241
// @version      0.4
// @author       lqzh
// @copyright    lqzh
// @include      http*://search.jd.com/Search?keyword=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var key = getUrlParam('keyword');
    if (!key.includes("自营")){
        window.location.href= "https://search.jd.com/Search?keyword=" +key +"%20自营" + "&enc=utf-8";
    }
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r != null) {
            return decodeURI(r[2]);
        }
        return null;
    }
})();