go_JD_union

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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();