var nIntervId; var count = 1; var goDate; function go() { console.log("正在幫你搶購 * 刷新" + count + "次"); //console.log("host:" + window.location.hostname); count++; if (Date.now() >= new Date("2019-11-10 01:45:59")) { console.log("開始搶購" + Date.now()); // 搶購 if ($(parent.frames[0].document).find("#choose-btn-ko").length == 1) { console.log("(++++++++++++搶購"); var sku = window.location.pathname.replace(/[^0-9]/ig, ""); var ref = "//cart.jd.com/gate.action?pid=" + sku + "&pcount=1&ptype=1"; console.log("https:" + ref); //5089237 $(parent.frames[0].document).find("#choose-btn-ko").attr("href", ref);// parent.frames[0].document.getElementById("choose-btn-ko").click(); return; } //預約搶購 if ($(parent.frames[0].document).find("#btn-reservation").length == 1) { console.log("(++++++++++++正在預約搶購"); parent.frames[0].document.getElementById("btn-reservation").click(); return; } //秒殺 if ($(parent.frames[0].document).find("#InitCartUrl").length == 1) { console.log("(++++++++++++正在秒殺"); parent.frames[0].document.getElementById("InitCartUrl").click(); return; } //去購物車結算 if ($(parent.frames[0].document).find("#GotoShoppingCart").length == 1) { console.log("(++++++++++++正在去購物車結算"); parent.frames[0].document.getElementById("GotoShoppingCart").click(); } //去結算 if ($(parent.frames[0].document).find(".submit-btn").length == 1) { console.log("(++++++++++++正在去結算"); //只提交我搶購的商品 //var sku = window.location.pathname.replace(/[^0-9]/ig, ""); //$("#toggle-checkboxes_up").trigger("click"); //全不選擇 //parent.frames[0].document.getElementById("toggle-checkboxes_up").click(); //$(parent.frames[0].document).find('input:checkbox').attr("checked",false); //$(parent.frames[0].document).find("input:checkbox[value^='"+sku+"']").trigger("click"); //$(parent.frames[0].document).find("input:checkbox[value^='"+sku+"']").attr("checked",true); parent.frames[0].document.getElementsByClassName("submit-btn")[0].click(); } //提交訂單order-submit if ($(parent.frames[0].document).find("#order-submit").length == 1) { console.log("(++++++++++++正在提交訂單"); //$(parent.frames[0].document).find(".payment-item item-selected online-payment") //在線支付 parent.frames[0].document.getElementById("order-submit").click(); } } } function rewrite(current) { fr4me = '<frameset cols=\'*\'>\n<frame src=\'' + current + '\'/>'; fr4me += '</frameset>'; with (document) { write(fr4me); void (close()) }; } //注入sql rewrite(window.location.href); //這里需要注意的是,prompt有兩個參數,前面是提示的話,后面是當對話框出來后,在對話框里的默認值 var d = prompt("請輸入搶購開始時間", "2021-12-04 16:00:00"); //如果返回的有內容 if (d) { try { goDate = new Date(d); console.log("設定時間成功:" + goDate); alert("監控期間,請保持標簽頁在最前面"); //go(); 0.25秒執行一次 nIntervId = setInterval("go()", 250); } catch (e) { alert("時間格式不正確,請使用yyyy-MM-dd hh:mm:ss格式,精確到秒, 請重試"); } } else { alert("請搶購時間, 請重重試"); } /* clearInterval(nIntervId);//停止監控 */
