Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
3 changed files with 27 additions and 4 deletions
Showing only changes of commit 34eefbd067 - Show all commits

View File

@ -80,6 +80,9 @@
<option>N/A</option> <option>N/A</option>
</select> </select>
</div> </div>
<div id="ip">
Local IP: null
</div>
<div> <div>
<input type="password" id="password" class="" placeholder="Wifi Password" /> <input type="password" id="password" class="" placeholder="Wifi Password" />
</div> </div>

View File

@ -296,11 +296,17 @@ footer > div.selected{
} }
#available.active{ #available.active{
border-color: #20ce45;; border-color: #20ce45;
} }
#password,#wifi{ #ip{
color: #666;
}
#ip span{
color: #20ce45;
}
#password,#wifi,#ip{
display: none; display: none;
} }
#password.active,#wifi.active{ #password.active,#ip.active,#wifi.active{
display: block; display: block;
} }

View File

@ -15,7 +15,8 @@ mobile.ble = {
mobile.wifi = { mobile.wifi = {
current : 'null', current : 'null',
available : [] available : [],
ip : null
}; };
mobile.ble.scan = function () { mobile.ble.scan = function () {
@ -301,6 +302,7 @@ mobile.getWifiSuccess = function (data) {
const elem = document.getElementById('available'); const elem = document.getElementById('available');
const wifi = document.getElementById('wifi'); const wifi = document.getElementById('wifi');
const password = document.getElementById('password'); const password = document.getElementById('password');
const ip = document.getElementById('ip');
let option = document.createElement('option'); let option = document.createElement('option');
let str = bytesToString(data); let str = bytesToString(data);
let res = JSON.parse(str); let res = JSON.parse(str);
@ -341,8 +343,20 @@ mobile.getWifiSuccess = function (data) {
} }
} }
} }
if (typeof res.ip !== 'undefined' && res.ip != null ) {
ip.innerHTML = `Local IP: <span onclick="window.open('http://${res.ip}', '_system', 'location=yes');">${res.ip}</span>`
if (!ip.classList.contains('active')) {
ip.classList.add('active');
}
} else {
ip.innerHTML = 'Local IP: null'
if (ip.classList.contains('active')) {
ip.classList.remove('active');
}
}
mobile.wifi.current = res.current; mobile.wifi.current = res.current;
mobile.wifi.available = res.available; mobile.wifi.available = res.available;
mobile.wifi.ip = res.ip;
}; };
mobile.editWifi = function () { mobile.editWifi = function () {