-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdetect.js
166 lines (140 loc) · 3.2 KB
/
detect.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Use AJAX to detect LAN connection
function isWLclient(){ //detect login client is by wireless or wired
if(wireless.length > 0){
for(var i=0; i < wireless.length; i++){
if(wireless[i][0].toUpperCase() == login_mac_str().toUpperCase())
return true; //wireless
}
}
return false; //wired
}
var http_request2 = false;
function makeRequest_lan(url) {
http_request2 = new XMLHttpRequest();
if (http_request2 && http_request2.overrideMimeType)
http_request2.overrideMimeType('text/xml');
else
return false;
http_request2.onreadystatechange = alertContents_lan;
http_request2.open('GET', url, true);
http_request2.send(null);
}
var xmlDoc_ie2;
function makeRequest_ie_lan(file)
{
xmlDoc_ie2 = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc_ie2.async = false;
if (xmlDoc_ie2.readyState==4)
{
xmlDoc_ie2.load(file);
refresh_laninfo(xmlDoc_ie2);
}
}
function alertContents_lan()
{
if (http_request2 != null && http_request2.readyState != null && http_request2.readyState == 4)
{
if (http_request2.status != null && http_request2.status == 200)
{
var xmldoc_mz2 = http_request2.responseXML;
refresh_laninfo(xmldoc_mz2);
}
}
}
var msecs;
var timerID = null;
var timerRunning = false;
var timeout = 1000;
var delay = 5000;
var stopFlag_lan = 0;
function resetTimer(){
if(stopFlag_lan == 1){
stopFlag_lan = 0;
InitializeTimer2();
}
}
function InitializeTimer2()
{
msecs = timeout;
StopTheClock2();
StartTheTimer2();
}
function StopTheClock2()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function StartTheTimer2()
{
if (msecs==0)
{
StopTheClock2();
if(stopFlag_lan==1)
return;
updateLAN();
msecs = timeout;
StartTheTimer2();
}
else
{
//self.status = msecs;
msecs = msecs - 1000;
timerRunning = true;
timerID = setTimeout("StartTheTimer2();", delay);
}
}
var forward_page = "";
var page_flag = "";
function detectLANstatus(forward_page, page_flag)
{
this.forward_page = forward_page;
this.page_flag = page_flag;
updateLAN();
InitializeTimer2();
}
function updateLAN()
{
var ie = window.ActiveXObject;
if (ie)
makeRequest_ie_lan('/WPS_info.asp');
else
makeRequest_lan('/WPS_info.asp');
}
function refresh_laninfo(xmldoc)
{
var wpss=xmldoc.getElementsByTagName("wps");
if (wpss!=null && wpss[0]!=null)
{
if($("drword")){
$("drword").innerHTML = "<#DrSurf_sweet_advise2#><br/><br/>";
}
stopFlag_lan = 1;
if(page_flag == "detectWAN"){
send_for_detectWAN();
}
else if(document.forms[0].current_page.value == "/QIS_wizard.htm"){
setTimeout("gotoFinish('"+forward_page+"', '"+page_flag+"');", 1000);
}
else if(forward_page.length > 0){
setTimeout("location.href = '"+forward_page+"';", 1000);
}
}
}
function send_for_detectWAN(){
document.redirectForm.action = "detectWAN.asp";
document.redirectForm.target = "contentM";
document.redirectForm.submit();
}
function reply_of_detectWAN(result){
document.redirectForm.action = "QIS_wizard.htm";
document.redirectForm.target = "";
if(result == 1){
document.redirectForm.flag.value = "remind";
}
else{
document.redirectForm.flag.value = "auto_way_static";
document.redirectForm.prev_page.value = "start_apply.htm";
}
document.redirectForm.submit();
}