天猫捡漏助手 By Tony

天猫U选自动刷新工具,自动提醒,By www.abibio.xin

As of 2019-03-15. See the latest version.

// ==UserScript==
// @name         天猫捡漏助手 By Tony
// @namespace    http://www.abmbio.xin/
// @version      1.0
// @description  天猫U选自动刷新工具,自动提醒,By www.abibio.xin
// @author       Tony
// @include      https://detail.tmall.com/item.htm?*
// @include      https://buy.tmall.com/order/confirm_order.htm?*
// @grant        none
// @icon         https://www.abmbio.xin/favicon.ico
// ==/UserScript==

(function() {
    'use strict';
    var script = document.createElement('script');
    script.src = "https://www.abmbio.xin/default/js/jQuery-2.2.0.min.js";
    document.getElementsByTagName('head')[0].appendChild(script);

    if(window.location.host == "detail.tmall.com"){
        setTimeout(function(){
            var dotimer = setInterval(function(){
                if(document.readyState == 'complete'){
                    console.log("%c Tony Blog %c","background:#f26522; color:#ffffff","","https://www.abmbio.xin");
                    console.log("%c  温馨提示    %c","background:#f26522; color:#ffffff","","页面加载完毕");
                    dothat();
                    clearInterval(dotimer);
                }else{
                    console.log("%c  温馨提示    %c","background:#000; color:#ffffff","","等待网页加载完全。。。");
                }
            },2000);

        },1000);

    }else if(window.location.host == "buy.tmall.com"){
        var dotimer = setInterval(function(){
            if(document.readyState == 'complete'){
                console.log("%c Tony Blog %c","background:#f26522; color:#ffffff","","https://www.abmbio.xin");
                console.log("%c  温馨提示    %c","background:#f26522; color:#ffffff","","页面加载完毕");
                $('.order-submitOrder a').click();
                clearInterval(dotimer);
            }else{
                console.log("%c  温馨提示    %c","background:#000; color:#ffffff","","等待网页加载完全。。。");
            }
        },200);
    }

    function dothat(){
        if($('.tb-action>span').text() == "还有机会"){
            location.reload();
        }else{
            document.getElementById('J_LinkBuy').click();
            console.log("%c  温馨提示    %c","background:#000; color:#ffffff","","搞到了,搞到了。。。");
            document.getElementById('tonyauto').src = "http://data.huiyi8.com/2017/gha/03/17/1702.mp3";
        }
    }

})();