go_JD_union

自动跳转到商品相应的京东联盟,自己的返利自己赚!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         go_JD_union
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动跳转到商品相应的京东联盟,自己的返利自己赚!
// @include http*://item.jd.com/*
// @grant        none
// @license MIT
// ==/UserScript==

// Your code here...
//debugger;
function run(){
	var searchPrefix="https://union.jd.com/proManager/index?pageNo=1&keywords=";
	var link=location.href;
    var realLink=getRealLink(link);
    //alert(realLink);
    var targetLink=searchPrefix+encodeURIComponent(realLink);
	var block;
    //block=document.querySelector("#summary-weight");
    block=document.querySelector("#choose-btns");
	var br=document.createElement('br');
	var mamaLink=document.createElement('a');
	mamaLink.href=targetLink;
	mamaLink.target='_blank';
	mamaLink.innerText='go_JD_union';
	block.appendChild(mamaLink);


}

function getRealLink(longLink){
	var n=longLink.indexOf('?');
    if (n==-1){
        return longLink;
    }
return longLink.substr(0,n);

}


run();