JavaSciprt 脚本

  1 var nIntervId;
  2 var count = 1;
  3 var goDate;
  4 function go() {
  5 console.log("正在帮你抢购 * 刷新" + count + "次");
  6 //console.log("host:" + window.location.hostname);
  7 count++; 
  8 if (Date.now() >= new Date("2019-11-10 01:45:59")) {
  9 console.log("开始抢购" + Date.now());
 10 
 11 // 抢购
 12 if ($(parent.frames[0].document).find("#choose-btn-ko").length == 1) {
 13 console.log("(++++++++++++抢购");
 14 var sku = window.location.pathname.replace(/[^0-9]/ig, "");
 15 var ref = "//cart.jd.com/gate.action?pid=" + sku + "&pcount=1&ptype=1";
 16 console.log("https:" + ref);
 17 //5089237
 18 $(parent.frames[0].document).find("#choose-btn-ko").attr("href", ref);// 
 19 parent.frames[0].document.getElementById("choose-btn-ko").click();
 20 return;
 21 }
 22 
 23 //预约抢购
 24 if ($(parent.frames[0].document).find("#btn-reservation").length == 1) {
 25 console.log("(++++++++++++正在预约抢购");
 26 
 27 parent.frames[0].document.getElementById("btn-reservation").click();
 28 return;
 29 }
 30 
 31 //秒杀 
 32 if ($(parent.frames[0].document).find("#InitCartUrl").length == 1) {
 33 console.log("(++++++++++++正在秒杀");
 34 parent.frames[0].document.getElementById("InitCartUrl").click();
 35 return;
 36 }
 37 
 38 //去购物车结算
 39 if ($(parent.frames[0].document).find("#GotoShoppingCart").length == 1) {
 40 console.log("(++++++++++++正在去购物车结算");
 41 parent.frames[0].document.getElementById("GotoShoppingCart").click();
 42 }
 43 
 44 //去结算 
 45 if ($(parent.frames[0].document).find(".submit-btn").length == 1) {
 46 console.log("(++++++++++++正在去结算");
 47 
 48 //只提交我抢购的商品
 49 //var sku = window.location.pathname.replace(/[^0-9]/ig, ""); 
 50 
 51 //$("#toggle-checkboxes_up").trigger("click");
 52 //全不选择
 53 //parent.frames[0].document.getElementById("toggle-checkboxes_up").click();
 54 
 55 //$(parent.frames[0].document).find('input:checkbox').attr("checked",false);
 56 //$(parent.frames[0].document).find("input:checkbox[value^='"+sku+"']").trigger("click");
 57 
 58 //$(parent.frames[0].document).find("input:checkbox[value^='"+sku+"']").attr("checked",true);
 59 
 60 parent.frames[0].document.getElementsByClassName("submit-btn")[0].click();
 61 }
 62 //提交订单order-submit
 63 if ($(parent.frames[0].document).find("#order-submit").length == 1) {
 64 console.log("(++++++++++++正在提交订单");
 65 //$(parent.frames[0].document).find(".payment-item item-selected online-payment")
 66 
 67 //在线支付
 68 parent.frames[0].document.getElementById("order-submit").click();
 69 }
 70 }
 71 }
 72 function rewrite(current) {
 73 fr4me = '<frameset cols=\'*\'>\n<frame src=\'' + current + '\'/>';
 74 fr4me += '</frameset>';
 75 with (document) { write(fr4me); void (close()) };
 76 }
 77 
 78 
 79 //注入sql
 80 rewrite(window.location.href);
 81 
 82 //这里需要注意的是,prompt有两个参数,前面是提示的话,后面是当对话框出来后,在对话框里的默认值
 83 var d = prompt("请输入抢购开始时间", "2019-11-10 01:45:59");
 84 //如果返回的有内容
 85 if (d) {
 86 try {
 87 goDate = new Date(d);
 88 console.log("设定时间成功:" + goDate);
 89 
 90 alert("监控期间,请保持标签页在最前面");
 91 //go(); 0.25秒执行一次
 92 nIntervId = setInterval("go()", 250);
 93 }
 94 catch (e) {
 95 alert("时间格式不正确,请使用yyyy-MM-dd hh:mm:ss格式,精确到秒, 请重试");
 96 }
 97 }
 98 else {
 99 alert("请抢购时间, 请重重试");
100 
101 }
102 
103 
104 /*
105 clearInterval(nIntervId);//停止监控
106 */

 

posted @ 2020-08-28 13:45  一直傲娇的鲨鱼  阅读(357)  评论(0编辑  收藏  举报