-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnybot.js
74 lines (68 loc) · 1.62 KB
/
nybot.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
var xmlhttp = false ;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
try {
xmlhttp = new XMLHttpRequest ();
}
catch (e) {
xmlhttp = false
}
}
function myXMLHttpRequest (){
var xmlhttplocal;
try {
xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")
}
catch (e) {
try {
xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")
}
catch (E) {
xmlhttplocal = false;
}
}
if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
try {
var xmlhttplocal = new XMLHttpRequest ();
}
catch (e) {
var xmlhttplocal = false;
}
}
return (xmlhttplocal);
}
var mnmxml = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;
var i=0;
var ii = 0;
function nybot_update(){
url = "nybot.php";
target2 = document.getElementById ('content');
ii = i++;
var content = "i=" + ii ;
mnmxml = new myXMLHttpRequest ();
if (mnmxml) {
mnmxml.open ("POST", url, true);
mnmxml.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
mnmxml.send (content);
errormatch = new RegExp ("^ERROR:");
target2 = document.getElementById ('content');
mnmxml.onreadystatechange = function () {
if (mnmxml.readyState == 4) {
mnmString = mnmxml.responseText;
if (mnmString.match (errormatch)) {
mnmString = mnmString.substring (6, mnmString.length);
target = document.getElementById ('content');
target2.innerHTML = mnmString;
} else {
target = document.getElementById ('content');
target2.innerHTML = mnmString;
}
}
}
}
setTimeout('nybot_update()', 10000);
}