-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleaderId.js
More file actions
73 lines (63 loc) · 3.18 KB
/
leaderId.js
File metadata and controls
73 lines (63 loc) · 3.18 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
//Надо быть залогиненым само собой, с заполненными данными, которые запрашиваются при записи на сам Акселератор
//Запускать скрипт надо со страницы https://leader-id.ru/events/496769, то есть записи на Акселератор
var regex = new RegExp('^https://leader-id\\.ru/events/49\\d{4}$');
var links = document.querySelectorAll('.app-editor-paragraph a[href]');
let index = 0;
let intervalId;
function openNextLink() {
if (index < links.length) {
let link = links[index];
if (link.href) {
var newTab = window.open(link.href);
newTab.onload = function() {
var applyButton = newTab.document.querySelector('button[data-qa="eventRequestBtn"]');
if (applyButton) {
applyButton.click();
setTimeout(function() {
var confirmButton = Array.from(newTab.document.querySelectorAll('button')).find(function(btn) {
return btn.innerText.trim() === 'Подтвердить корректность введенных данных';
});
if (confirmButton) {
confirmButton.click();
setTimeout(function() {
var nextButton = Array.from(newTab.document.querySelectorAll('button')).find(function(btn) {
return btn.innerText.trim() === 'Далее';
});
if (nextButton) {
nextButton.click();
setTimeout(function() {
var finalButton = Array.from(newTab.document.querySelectorAll('button')).find(function(btn) {
return btn.innerText.trim() === 'Завершить регистрацию';
});
if (finalButton) {
finalButton.click();
setTimeout(function() {
newTab.close();
}, 1000);
}
else{
newTab.close();
}
}, 1000);
}
else{
newTab.close();
}
}, 1000);
}
else{
newTab.close();
}
}, 1000);
}
else{
newTab.close();
}
};
}
index++;
} else {
clearInterval(intervalId);
}
}
intervalId = setInterval(openNextLink, 8000);