-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscript.js
More file actions
73 lines (72 loc) · 2.09 KB
/
Copy pathscript.js
File metadata and controls
73 lines (72 loc) · 2.09 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
64
65
66
67
68
69
70
71
72
73
var maxInvites = 0;
var connectButton = "search-result__action-button search-result__actions--primary artdeco-button artdeco-button--default artdeco-button--2 artdeco-button--secondary";
var sendButton = "ml1 artdeco-button artdeco-button--3 artdeco-button--primary ember-view";
var nextButton = "artdeco-pagination__button artdeco-pagination__button--next artdeco-button artdeco-button--muted artdeco-button--icon-right artdeco-button--1 artdeco-button--tertiary ember-view";
var outOfInvitesButton = "artdeco-button ip-fuse-limit-alert__primary-action artdeco-button--2 artdeco-button--primary ember-view";
var els = document.getElementsByClassName(connectButton);
var index = 0;
var send = false;
var newPage = false;
var reload = false;
var timer = 0;
var counter = 0;
var invites = 0;
var interval = setInterval(function () {
counter++;
if (counter >= timer) {
counter = 0;
if (newPage) {
els = document.getElementsByClassName(connectButton);
if (els.length < 2)
{
console.log("Waiting for content..");
}
else
{
index = 0;
send = false;
newPage = false;
timer = 1;
}
}
else if (reload) {
reload = false;
location.reload();
}
else if (send && document.getElementsByClassName(sendButton)[0]) {
send = false;
document.getElementsByClassName(sendButton)[0].click();
invites++;
timer = 1;
}
else {
if (index < els.length) {
if (els[index] !== undefined) {
els[index].click();
}
send = true;
index++;
timer = 1;
} else {
console.log("We've sent " + invites + " so far!");
if (maxInvites != 0 && maxInvites >= invites) {
console.log("Finished sending invites");
clearInterval(interval);
}
else if (document.getElementsByClassName(nextButton)[0]) {
newPage = true;
timer = 20;
document.getElementsByClassName(nextButton)[0].click();
console.log("Next page");
}
else if (document.getElementsByClassName(outOfInvitesButton)[0]) {
console.log("Search limit reached");
clearInterval(interval);
}
else {
console.log("Unknown error");
}
}
}
}
}, 100);