-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSender.js
More file actions
64 lines (52 loc) · 1.87 KB
/
Sender.js
File metadata and controls
64 lines (52 loc) · 1.87 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
/*
**Created by detime001**
*/
let myLocaltion = location.href;
myLocaltion = myLocaltion.replace('/viewform', '/formResponse');
console.log(myLocaltion);
/*@@@@@@@@-Promo Code-@@@@@@@@*/
let scriptSearch = document.getElementsByTagName('script')[4];
let patPromo = /\[\"\w+\"\]/gi; /*pattern for search promo code from script*/
let txts = scriptSearch.firstChild;
let promoCodes = txts.textContent.toString().match(patPromo)[0].replace(/\[|\"|\]/gi, '');
console.log('Промокод найден: ' + promoCodes);
/*@@@@@@@@-Promo Code-@@@@@@@@*/
/*@@@@@@@@-Search for input fields-@@@@@@@@*/
let entryNames = document.getElementsByTagName('input');
let inputLogins = entryNames[1].name;
let inputPromoCodes = entryNames[0].name;
console.log('Поле для ника: ' + inputLogins, 'Поле для промо: ' + inputPromoCodes);
/*@@@@@@@@-Search for input fields-@@@@@@@@*/
let loginList = [
'MyLogin'
];
let count = 0; /*dispatch count*/
let lens = loginList.length; /*number of names*/
let xhr1 = new XMLHttpRequest();
let pattern = /\/\w+.$/gi;
function f() {
let data1 = inputPromoCodes + '=' + promoCodes + '&' + inputLogins + '=' + encodeURI(loginList[count]);
console.log(count + '===========================================')
console.log(decodeURI(data1));
xhr1.open('POST', myLocaltion, true);
xhr1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr1.send(data1);
xhr1.onload = function() {
let myStatus = xhr1.responseURL.match(pattern)[0];
if (myStatus == '/formResponse') {
console.log('Отправлено ststus: ' + myStatus);
count++;
if (count < lens) {
f();
}
}
else if (myStatus == '/closedform') {
console.log('Не отправлено status: ' + myStatus);
}
else {
console.log('Неизвестный адрес');
console.log(myStatus);
}
}
}
f();