Greasy Fork

Greasy Fork is available in English.

京东试用

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         京东试用
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include       *//*.jd.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //试用地址:https://sale.jd.com/act/Oxp4vLQCaDl.html
var count = 0;
//获取我要试用按钮数组
if(location.hostname == "sale.jd.com")
{
	var shiList = $(".goods-price-info>.goods-btn");
	if(shiList.length > 0)
	{
		console.log("准备打开链接");
		for(var i = 0; i < shiList.length; i++)
		{
			shiList[i].click();
		}
	}
	console.log("链接已经全部打开");
}

//try.jd.com,判断是否在这个页面
if(location.hostname == "try.jd.com")
{
	console.log("进入了试用页面");

	setInterval(function()
	{
		//申请试用按钮
		if($(".btn-wrap>.app-btn.btn-application").length != 0)
		{
			console.log("准备申请试用");
			$(".btn-wrap>.app-btn.btn-application").click();
		}

		//判断是否申请成功,不等于0说明可以关闭了。
		if($(".ui-dialog-content").length == 1)
		{
			alert("试用申请成功,准备关闭网页");
			window.close();
		}
		if ( count >= 10 )
		{
			window.location.reload();
		}
	}, 5000);
}
})();