forked from wmarshall484/nps_hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti-start.js
More file actions
63 lines (49 loc) · 1.57 KB
/
Copy pathmulti-start.js
File metadata and controls
63 lines (49 loc) · 1.57 KB
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
// ==UserScript==
// @name camp start date
// @version 1
// @grant none
// ==/UserScript==
// @run-at document-idle
window.addEventListener('load', function() {
hasClicked = false
counter = 0
START_DATE_ARRAY = [
"Aug 27, 2021",
"Aug 28, 2021",
]
// modify if next week
GO_FORWARD_LIMIT = 1
goForwardCount = 0
go_forward = document.querySelectorAll(`[aria-label*="Go Forward 5 Days"]`)
// if (goForwardCount < GO_FORWARD_LIMIT) {
// setTimeout(() => {}, 21)
// goForwardCount += 1
// }
// go_forward[0].click()
while (counter < 11 && !hasClicked) {
setTimeout(() => {
START_DATE_ARRAY.forEach((startDate) => {
try {
start_selector = document.querySelectorAll(`[aria-label*="${startDate}"]`)
available_elements = Array.from(start_selector).filter((el) => {
// aria-label is element 1 in node
return el.attributes[1].value.includes('available')
})
if (available_elements[0] && !hasClicked) {
hasClicked = true
available_elements.length > 0 && available_elements[0].click()
console.log('clicked first')
setTimeout(() => {}, 50)
}
// click add to cart
availability_selector = document.getElementsByClassName('availability-page-book-now-button-tracker')
availability_selector[0] && availability_selector[0].click()
console.log('Mischief managed')
} catch (err) {
console.error(err)
}
})
}, 2000)
counter += 1
}
}, false);