simpledemo.html: Finished work! everything works now.
This commit is contained in:
parent
3677b8aff8
commit
eb694c683d
@ -435,7 +435,7 @@
|
|||||||
= document.getElementById('wifiChange_ssidInput').value;
|
= document.getElementById('wifiChange_ssidInput').value;
|
||||||
newPSK = document.getElementById('wifiChange_pskInput').value;
|
newPSK = document.getElementById('wifiChange_pskInput').value;
|
||||||
http = new XMLHttpRequest();http.open('GET',
|
http = new XMLHttpRequest();http.open('GET',
|
||||||
'http://' + document.cookie + '/api/v1/system/wifi/change?ssid='+newSSID+'&psk='+newPSK);http.send();">
|
'http://' + document.cookie + '/api/v1/system/wifi/change?ssid='+newSSID+'&psk='+newPSK);http.send();updateStrings();">
|
||||||
Change
|
Change
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -458,17 +458,15 @@
|
|||||||
<p>Restoring the old/last state can be toggeled on or off over the API. Doing so can have many reasons, one could be
|
<p>Restoring the old/last state can be toggeled on or off over the API. Doing so can have many reasons, one could be
|
||||||
that you wanted to build a device always playing some startup sound, or so.</p>
|
that you wanted to build a device always playing some startup sound, or so.</p>
|
||||||
<div class='form-check form-switch'>
|
<div class='form-check form-switch'>
|
||||||
<input onclick="this.value ? console.log('Toggeled on') : console.log('Toggeled off');" class='form-check-input'
|
<input onclick="http = new XMLHttpRequest();http.open('GET', 'http://' + document.cookie +
|
||||||
type='checkbox' role='switch' id='restoreStateSwitch' " +
|
'/api/v1/system/restore_state/' + (this.checked ? 'on' : 'off'));http.send();updateStrings();"
|
||||||
configuration.getBool(PREFERENCES_KEY_RESTORE_OLD_STATE,
|
class='form-check-input' type='checkbox' role='switch' id='updatedLabel_RESTORESTATE_switch'>
|
||||||
true) ? "checked" : String() + " >
|
|
||||||
<label class='form-check-label' for='restoreStateSwitch'>Restore last saved state</label>
|
<label class='form-check-label' for='restoreStateSwitch'>Restore last saved state</label>
|
||||||
</div>
|
</div>
|
||||||
<div class='form-check form-switch'>
|
<div class='form-check form-switch'>
|
||||||
<input onclick="this.value ? console.log('Toggeled on') : console.log('Toggeled off');" class='form-check-input'
|
<input onclick="http = new XMLHttpRequest();http.open('GET', 'http://' + document.cookie +
|
||||||
type='checkbox' role='switch' id='restorePlayingSwitch' " +
|
'/api/v1/system/restore_playing/' + (this.checked ? 'on' : 'off'));http.send();updateStrings();"
|
||||||
configuration.getBool(PREFERENCES_KEY_RESTORE_PLAYING,
|
class='form-check-input' type='checkbox' role='switch' id='updatedLabel_RESTOREPLAYING_switch'>
|
||||||
true) ? "checked" : String() + " >
|
|
||||||
<label class='form-check-label' for='restorePlayingSwitch'>Also restore last playing state</label>
|
<label class='form-check-label' for='restorePlayingSwitch'>Also restore last playing state</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -556,7 +554,9 @@
|
|||||||
frnameLabel2 = document.getElementById('updatedLabel_FRNAME_table');
|
frnameLabel2 = document.getElementById('updatedLabel_FRNAME_table');
|
||||||
frnameLabel3 = document.getElementById('updatedLabel_FRNAME_oldinputtext');
|
frnameLabel3 = document.getElementById('updatedLabel_FRNAME_oldinputtext');
|
||||||
restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table')
|
restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table')
|
||||||
|
restoreStateSwitch1 = document.getElementById('updatedLabel_RESTORESTATE_switch')
|
||||||
restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
|
restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
|
||||||
|
restorePlayingStateSwitch1 = document.getElementById('updatedLabel_RESTOREPLAYING_switch')
|
||||||
wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
|
wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
|
||||||
apSsidLabel1 = document.getElementById('updatedLabel_APSSID_table');
|
apSsidLabel1 = document.getElementById('updatedLabel_APSSID_table');
|
||||||
apSsidLabel2 = document.getElementById('updatedLabel_APSSID_code');
|
apSsidLabel2 = document.getElementById('updatedLabel_APSSID_code');
|
||||||
@ -639,8 +639,9 @@
|
|||||||
var restoreStateRequest = new XMLHttpRequest();
|
var restoreStateRequest = new XMLHttpRequest();
|
||||||
restoreStateRequest.onreadystatechange = function() {
|
restoreStateRequest.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
var restoreStateString = JSON.parse(this.responseText).restore_state;
|
var restoreStateValue = JSON.parse(this.responseText).restore_state;
|
||||||
restoreStateLabel1.innerHTML = restoreStateString ? "yes" : "no";
|
restoreStateLabel1.innerHTML = restoreStateValue ? "yes" : "no";
|
||||||
|
restoreStateSwitch1.checked = restoreStateValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restoreStateRequest.open("GET", apiBase + restoreStateApiEndpoint, true);
|
restoreStateRequest.open("GET", apiBase + restoreStateApiEndpoint, true);
|
||||||
@ -649,8 +650,9 @@
|
|||||||
var restorePlayingRequest = new XMLHttpRequest();
|
var restorePlayingRequest = new XMLHttpRequest();
|
||||||
restorePlayingRequest.onreadystatechange = function() {
|
restorePlayingRequest.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
var restorePlayingString = JSON.parse(this.responseText).restore_playing;
|
var restorePlayingValue = JSON.parse(this.responseText).restore_playing;
|
||||||
restorePlayingStateLabel1.innerHTML = restorePlayingString ? "yes" : "no";
|
restorePlayingStateLabel1.innerHTML = restorePlayingValue ? "yes" : "no";
|
||||||
|
restorePlayingStateSwitch1.checked = restorePlayingValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restorePlayingRequest.open("GET", apiBase + restorePlayingStateApiEndpoint, true);
|
restorePlayingRequest.open("GET", apiBase + restorePlayingStateApiEndpoint, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user