-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabun.user.js
62 lines (55 loc) · 1.89 KB
/
tabun.user.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
// ==UserScript==
// @name Tabun bot by Ghost
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author Ghost
// @match https://tabun.everypony.ru/
// @downloadURL https://mindofghost.github.io/test/tabun.user.js
// @updateURL https://mindofghost.github.io/test/tabun.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var settings;
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://mindofghost.github.io/test/tabun.setup.json', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function () {
if (xhr.status == 200 || ajax.status == 304) {
settings = JSON.parse(xhr.responseText);
}
else{console.log(xhr)}
};
xhr.send();
var securitykey = document.scripts[2].innerHTML.slice(36,68);
console.log(securitykey);
var params = new FormData();
params.append("security_ls_key", securitykey);
var ajax = new XMLHttpRequest();
var lastid = [];
ajax.onreadystatechange = function() {
if (ajax.readyState == 4) {
if (ajax.status == 200 || ajax.status == 304) {
for (var i = 0; i < settings.length; i++) {
if( ajax.response.search(settings[i]['name']) != -1) {
var point = ajax.response.search(settings[i]['name']);
var cut = ajax.response.slice(point, point+500);
point = cut.search('comment') + 7;
cut = cut.slice(point, point+8);
if (lastid[i] != cut){
ls.vote.vote(cut,this,settings[i]['direction'],'comment');
lastid[i] = cut;
console.log('новый пост обнаружен');
}
}
}
}
}
}
var timerId = setInterval(function() {
ajax.open('POST', '/ajax/stream/comment/');
ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
ajax.send(params);
}, 4000);
})();