Fixed WiFi cgi stuff. Also: cleaned up everything so it compiles without warnings. include/espmissingincludes.h adds the missing protoypes for that.
This commit is contained in:
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
var t=function(a,b){return function(c,d){return a.replace(/#{([^}]*)}/g,function(a,f){return Function("x","with(x)return "+f).call(c,d||b||{})})}},s=function(a,b){return b?{get:function(c){return a[c]&&b.parse(a[c])},set:function(c,d){a[c]=b.stringify(d)}}:{}}(this.localStorage||{},JSON),p=function(a,b,c,d){c=c||document;d=c[b="on"+b];a=c[b]=function(e){d=d&&d(e=e||c.event);return(a=a&&b(e))?b:d};c=this},m=function(a,b,c){b=document;c=b.createElement("p");c.innerHTML=a;for(a=b.createDocumentFragment();b=
|
||||
c.firstChild;)a.appendChild(b);return a},$=function(a,b){a=a.match(/^(\W)?(.*)/);return(b||document)["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2])},j=function(a){for(a=0;a<4;a++)try{return a?new ActiveXObject([,"Msxml2","Msxml3","Microsoft"][a]+".XMLHTTP"):new XMLHttpRequest}catch(b){}};
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head><title>Connecting</title></head>
|
||||
<META HTTP-EQUIV="refresh" CONTENT="3;URL=wifi.tpl">
|
||||
<body>
|
||||
Connecting to AP now...
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,74 @@
|
||||
<html><head><title>WiFi connection</title>
|
||||
<script type="text/javascript" src="140medley.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var xhr=j();
|
||||
var currAp="%currSsid%";
|
||||
|
||||
function createInputForAp(ap) {
|
||||
if (ap.essid=="" && ap.rssi==0) return;
|
||||
var div=document.createElement("div");
|
||||
div.id="apdiv";
|
||||
var input=document.createElement("input");
|
||||
input.type="radio";
|
||||
input.name="essid";
|
||||
input.value=ap.essid;
|
||||
if (currAp==ap.essid) input.checked="1";
|
||||
input.id="opt-"+ap.essid;
|
||||
var label=document.createElement("label");
|
||||
label.htmlFor="opt-"+ap.essid;
|
||||
label.textContent=ap.essid+" (rssi "+ap.rssi+")";
|
||||
div.appendChild(input);
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
|
||||
function getSelectedEssid() {
|
||||
var e=document.forms.wifiform.elements;
|
||||
for (var i=0; i<e.length; i++) {
|
||||
if (e[i].type=="radio" && e[i].checked) return e[i].value;
|
||||
}
|
||||
return currAp;
|
||||
}
|
||||
|
||||
|
||||
function scanAPs() {
|
||||
xhr.open("GET", "wifiscan.cgi");
|
||||
xhr.onreadystatechange=function() {
|
||||
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
|
||||
var data=JSON.parse(xhr.responseText);
|
||||
currAp=getSelectedEssid();
|
||||
if (data.result.inProgress=="0" && data.result.APs.length>1) {
|
||||
$("#aps").innerHTML="";
|
||||
for (var i=0; i<data.result.APs.length; i++) {
|
||||
if (data.result.APs[i].essid=="" && data.result.APs[i].rssi==0) continue;
|
||||
$("#aps").appendChild(createInputForAp(data.result.APs[i]));
|
||||
}
|
||||
window.setTimeout(scanAPs, 20000);
|
||||
} else {
|
||||
window.setTimeout(scanAPs, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
window.onload=function(e) {
|
||||
scanAPs();
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Current WiFi mode: %WiFiMode%
|
||||
</p>
|
||||
<form name="wifiform" action="connect.cgi" method="post">
|
||||
<p>
|
||||
To connect to a WiFi network, please select one of the detected networks...<br>
|
||||
<div id="aps">Scanning...</div>
|
||||
<br>
|
||||
WiFi password, if applicable: <br />
|
||||
<input type="text" name="passwd" val="%WiFiPasswd%"> <br />
|
||||
<input type="submit" name="connect" value="Connect!">
|
||||
</p>
|
||||
Reference in New Issue
Block a user