Greasy Fork

Greasy Fork is available in English.

小米搶11物品

try to take over the world!

// ==UserScript==
// @name         小米搶11物品
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       Lin
// @match        https://event.mi.com/tw/sales2018/super-sales-day
// @include      https://event.mi.com/tw/sales2018/*
// @grant        none
// @require http://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==

(function() {
    'use strict';
    function correct_time(){
        var flag = false;
        var d = new Date();
        var hours = d.getHours();
        var min = d.getMinutes();
        var sec = d.getSeconds();
        if((hours == 12 && min <=1) || ( hours == 11 && min == 59 && sec == 59) ||
           (hours == 15 && min <=1) || ( hours == 14 && min == 59 && sec == 59) ||
           (hours == 18 && min <=1) || ( hours == 17 && min == 59 && sec == 59)){
            flag = true;
        }
        return flag
    }
    function checkForMoniDisplayChange () {
        $('.J_flashBuyBtn').removeAttr("disabled");
        if(correct_time()){
            $('.J_flashBuyBtn').click();
        }
    }
    window.setInterval (checkForMoniDisplayChange, 1);
    alert ={}

})();