-
Notifications
You must be signed in to change notification settings - Fork 3
/
util.js
executable file
·47 lines (46 loc) · 973 Bytes
/
util.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
function con(url) {
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
var x = setTimeout(function() {
xhr.abort();
}, 2000);
xhr.send();
ret_data = xhr.responseText;
return xhr.responseText;
} catch(e) {
return "Error";
}
}
function showMesa(mes) {
document.getElementById("data").innerHTML = mes;
alert(mes);
}
function showMes(mes) {
document.getElementById("data").innerHTML = mes;
}
function linklist(data, url) {
var phost = url.split("//");
var phost2 = phost[1].split("/");
var host = "http://" + phost2[0];
var data = con(url);
if (data.indexOf("HREF=\"") != - 1) {
var par = data.split("HREF=\"");
} else {
var par = data.split("href=\"");
}
par.shift();
par.pop();
par.shift();
var links = Array();
for (link in par) {
var par2 = par[link].split('"');
if (par2[0].indexOf("http") != 0) {
var pus = host + "/" + par2[0];
} else {
var pus = par2[0];
}
links.push(pus);
}
return links;
}