-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
70 lines (51 loc) · 1.59 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var sleep = function(time) {
var startTime = new Date().getTime() + time*1000;
while(new Date().getTime() < startTime) {}
};
var find_and_click = function(item_id) {
console.log("start")
i = 0;
while(i<10) {
i++
if(document.getElementById(item_id))
{
document.getElementById(item_id).click()
break;
}
console.log("loop")
// sleep(1);
}
console.log("stop")
}
window.onload = doIt;
// document.ready = doIt;
function doIt() {
// $(document).ready(function () {
console.log("onload")
if ( document.getElementById("addToCartSubmit") != null && document.getElementById("notInStock") == null )
{
console.log("buy")
//1.放入购物袋
find_and_click("addToCartSubmit")
window.location.href="https://secure.louisvuitton.cn/zhs-cn/cart"
// //2.打开购物袋
// find_and_click("header-shoppingBag")
// //3.立即结账
// find_and_click("viewTaxesAndDetails")
// //4.提交
// find_and_click("proceedToCheckoutButton")
// //5.提交
// find_and_click("globalSubmit")
// //6.打钩
// find_and_click("acceptTerms")
// //7.提交订单
// find_and_click("globalSubmit")
}else{
// window.onload = function(){console.log("ready")};
console.log("reload")
// sleep(30);
location.reload(true);
}
// }
// );
}