-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpopup.js
134 lines (105 loc) · 4.13 KB
/
popup.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
window.onload = () => {
window.location = "https://www.linkedin.com/mynetwork/";
}
const homepage = document.querySelector("#extn-popup-homepage");
const autoRequestpage = document.querySelector("#extn-popup-auto-request");
const autoAcceptPage = document.querySelector("#extn-popup-auto-accept");
const rejectPending = document.querySelector("#extn-popup-auto-reject-pending");
const progress = document.querySelector("#extn-popup-inprogress");
document.querySelector("#go-to-homepage").addEventListener('click', () => {
homepage.classList.remove("hide");
autoRequestpage.classList.add("hide");
autoAcceptPage.classList.add("hide");
rejectPending.classList.add("hide");
progress.classList.add("hide");
})
document.querySelector("#auto-request").addEventListener('click', () => {
homepage.classList.add("hide");
autoRequestpage.classList.remove("hide");
autoAcceptPage.classList.add("hide");
rejectPending.classList.add("hide");
progress.classList.add("hide");
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
"requestType": "redirect", "url": "https://www.linkedin.com/mynetwork/"
})
});
setTimeout(() => {
document.querySelector("#perform-auto-request").removeAttribute("disabled");
}, 10000)
})
document.querySelector("#auto-accept").addEventListener('click', () => {
homepage.classList.add("hide");
autoRequestpage.classList.add("hide");
autoAcceptPage.classList.remove("hide");
rejectPending.classList.add("hide");
progress.classList.add("hide");
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
"requestType": "redirect", "url": "https://www.linkedin.com/mynetwork/" })
});
setTimeout(() => {
document.querySelector("#perform-auto-accept").removeAttribute("disabled");
},10000)
})
document.querySelector("#auto-delete-pending").addEventListener('click', () => {
homepage.classList.add("hide");
autoRequestpage.classList.add("hide");
autoAcceptPage.classList.add("hide");
rejectPending.classList.remove("hide");
progress.classList.add("hide");
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
"requestType": "redirect", "url": "https://www.linkedin.com/mynetwork/invitation-manager/sent/"
})
});
setTimeout(() => {
document.querySelector("#perform-auto-reject-pending").removeAttribute("disabled");
}, 10000)
})
const loading = document.querySelector("#extn-popup-inprogress h3");
var c = Number(0);
var addDOTS = setInterval(() => {
if (c == 3) {
loading.innerHTML = "All Done. Process Initiated";
c = 0;
}
loading.innerHTML += String(".");
c++;
}
, 700);
document.querySelectorAll(".perform").forEach(ele => {
ele.setAttribute("disabled", true);
ele.addEventListener('click',() => {
homepage.classList.add("hide");
autoRequestpage.classList.add("hide");
autoAcceptPage.classList.add("hide");
rejectPending.classList.add("hide");
progress.classList.remove("hide");
})
})
// PERFORM
document.querySelector("#perform-auto-accept").addEventListener('click', () => {
// alert("btn click")
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { "requestType": "acceptConnections"});
});
});
document.querySelector("#perform-auto-request").addEventListener('click', () => {
// alert("btn click")
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { "requestType": "sendConnections", "countCCCC": document.querySelector('#send-number').value} );
});
});
document.querySelector("#perform-auto-reject-pending").addEventListener('click', () => {
// alert("btn click")
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { "requestType": "cancelConnections"});
});
});
document.querySelector("#contact-link").addEventListener('click', () => {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
"requestType": "redirect", "url": "https://www.github.com/abhaygupta08/"})
});
});