123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
- <title>ESP WiFi</title>
- <script>
- function g(i){return document.getElementById(i);};
- function p(t,l){if(confirm(t)) window.location=l;};
- function E(s){return document.createElement(s)};
- var S="setAttribute",A="appendChild",H="innerHTML",X,wl;
- function scan(){
- if(X) return;
- X=new XMLHttpRequest(),wl=document.getElementById('wl');
- wl[H]="Scanning...";
- X.onreadystatechange=function(){
- if (this.readyState==4&&this.status==200) {
- X=0;
- wl[H]="";
- this.responseText.split("\n").forEach(function (e) {
- let t=e.split(","), s=t.slice(2).join(',');
- var d=E('div'),i=E('a'),c=E('a');
- i[S]('class','s'); c[S]('class','q');
- i.onclick=function(){g('s').value=s;g('p').focus();};
- i[A](document.createTextNode(s));
- c[H]=t[0]+"%"+(parseInt(t[1])?"\uD83D\uDD12":"\u26A0");
- wl[A](i); wl[A](c);
- wl[A](document.createElement('br'));
- });
- }
- };
- X.open("GET","wifi/list",true);
- X.send();
- };
- </script>
- <style>
- input {
- padding:5px;
- font-size:1em;
- width:95%;
- filter:invert(100%);
- }
- body {
- text-align:center;
- font-family:verdana;
- background-color:black;
- color:white;
- }
- a {
- color:#1fa3ec;
- }
- button {
- border:0;
- border-radius:0.3em;
- background-color:#1fa3ec;
- color:#fff;
- line-height:2.4em;
- font-size:1.2em;
- width:100%;
- display:block;
- }
- .q {
- float:right;
- }
- .s {
- display:inline-block;
- width:14em;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- #wl{
- line-height:1.5em;
- }
- </style>
- </head>
- <body>
- <div style='text-align:left;display:inline-block;width:320px;padding:5px'>
- <button onclick="scan()">↻ Scan</button>
- <p id='wl'></p>
- <form method='post' action='/wifi/connect'>
- <input id='s' name='n' length=32 placeholder='SSID'>
- <br>
- <input id='p' name='p' length=64 type='password' placeholder='password'>
- <br>
- <br>
- <button type='submit'>Connect</button>
- </form>
- <br>
- <br>
- <button onclick="p('Start WPS?','/wifi/wps')">WPS Setup</button>
- <br>
- <button onclick="p('Start AP mode?','/wifi/ap')">AP Mode</button>
- <br>
- <button onclick="p('Reboot device?','/wifi/rst')">Reboot</button>
- <br>
- <a href="javascript:history.back()">Back</a> |
- <a href="/">Home</a>
- </div>
- </body>
- </html>
|