-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetVpsInfo.html
101 lines (86 loc) · 3.42 KB
/
getVpsInfo.html
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
window.onload = function () { loadXMLDoc(); }
function tsToTime(time = +new Date()) { // from:https://segmentfault.com/a/1190000015992232
var date = new Date(time + 8 * 3600 * 1000);
return date.toJSON().substr(0, 19).replace('T', ' ');
}
function loadXMLDoc() {
var xmlhttp;
if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
xmlhttp = new XMLHttpRequest();
}
else {
// IE6, IE5 浏览器执行代码
// xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
alert("求求你换个正常的浏览器吧");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
jsonObj = JSON.parse(xmlhttp.responseText);
// document.getElementById("myTipText").innerHTML=xmlhttp.responseText;
var num = jsonObj.length;
document.getElementById("myTipText").innerHTML = "当前共有" + num + "个节点"
var table = document.getElementById("table");
for (var i = 0; i < num; i++) {
var row = table.insertRow(table.rows.length);
var c1 = row.insertCell(0);
c1.innerHTML = jsonObj[i].title;
var c2 = row.insertCell(1);
c2.innerHTML = jsonObj[i].ip;
var c3 = row.insertCell(2);
c3.innerHTML = jsonObj[i].ssCount;
var c4 = row.insertCell(3);
c4.innerHTML = jsonObj[i].ssIpMsg;
var c5 = row.insertCell(4);
c5.innerHTML = tsToTime(jsonObj[i].updateTs);
var c6 = row.insertCell(5);
c6.innerHTML = jsonObj[i].isAlive;
var c7 = row.insertCell(6);
c7.innerHTML = jsonObj[i].password;
}
}
}
xmlhttp.open("GET", "getVpsInfo.json", true);
xmlhttp.send();
}
</script>
</head>
<body>
<div class="wrapper">
<a id="myTipText"></a>
<!-- Trigger -->
<button id="sslinks" class="btn" data-clipboard-text="No links Copied.">
Copy to clipboard
</button>
</div>
<table id="table" border="1" cellspacing="0" cellpadding="0">
<tr>
<th>title</th>
<th>ip</th>
<th>ssCount</th>
<th>ssIpMsg</th>
<th>updateTs</th>
<th>isAlive</th>
<th>password</th>
</tr>
</table>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
var clipboard = new ClipboardJS('.btn');
clipboard.on('success', function(e) {
console.log(e);
alert("Copy success");
});
clipboard.on('error', function(e) {
console.log(e);
alert("Copy error");
});
</script>
</body>
</html>