Greasy Fork

来自缓存

Greasy Fork is available in English.

天猫淘宝获取套餐链接

淘宝、天猫获取套餐链接

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         天猫淘宝获取套餐链接
// @namespace    [email protected]
// @version      2018.08.26
// @description  淘宝、天猫获取套餐链接
// @author       无法诉说的吟荡
// @include      https://item.taobao.com/*
// @include      https://detail.tmall.com/*
// @grant        unsafeWindow
// ==/UserScript==
function addbutton() { //添加按钮
	var oD_box = document.createElement("div");
	oD_box.id = "oD_box";
	oD_box.style = "position:fixed;top:300px;right:30px;  width:150px; z-index:99999999;"; //按钮位置
	var oD_button = document.createElement("button");
	oD_button.id = "oD_button";
	oD_button.type = "button";
	oD_button.textContent = "获取套餐"; //按钮显示文字
	oD_button.style = "padding:5px 0;position: relative;top:-1px;width:100px;color:#E5511D;border-color:#F0CAB6;background:#FFE4D0;";
	//按钮功能-链接转换
	oD_button.onclick = function() {
		var patt1 = /sellerId=(.*?)&/;
		var patt2 = /collocationId=(.*?)&/;
		if(location.hostname.indexOf("taobao.com")!=-1){
			var tclink1 = document.getElementsByClassName("tb-view")[0].href;
			var id1 = patt1.exec(tclink1)[1];
			var userid1 = patt2.exec(tclink1)[1];
			var mtblink1 = 'https://h5.m.taobao.com/cm/collocation.html?id=' + userid1 + '&userId=' + id1;
			prompt("套餐链接是:", mtblink1);
		} else if (location.hostname.indexOf("tmall.com")!=-1) {
			var tclink2 = document.getElementsByClassName("J_ComboLink")[0].innerHTML;
			var id2 = patt1.exec(tclink2)[1];
			var userid2 = patt2.exec(tclink2)[1];
			var mtblink2 = 'https://h5.m.taobao.com/cm/collocation.html?id=' + userid2 + '&userId=' + id2;
			prompt("套餐链接是:", mtblink2);
		}
	};
	oD_box.appendChild(oD_button);
	document.body.appendChild(oD_box);
}
//显示按钮
(function() {
	addbutton();
})();