simpledemo.html: Finished work! everything works now.

This commit is contained in:
BlueFox 2024-03-26 19:48:34 +01:00
parent 3677b8aff8
commit eb694c683d
Signed by: BlueFox
GPG Key ID: 327233DA85435270

View File

@ -435,7 +435,7 @@
= document.getElementById('wifiChange_ssidInput').value;
newPSK = document.getElementById('wifiChange_pskInput').value;
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
</button>
</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
that you wanted to build a device always playing some startup sound, or so.</p>
<div class='form-check form-switch'>
<input onclick="this.value ? console.log('Toggeled on') : console.log('Toggeled off');" class='form-check-input'
type='checkbox' role='switch' id='restoreStateSwitch' " +
configuration.getBool(PREFERENCES_KEY_RESTORE_OLD_STATE,
true) ? "checked" : String() + " >
<input onclick="http = new XMLHttpRequest();http.open('GET', 'http://' + document.cookie +
'/api/v1/system/restore_state/' + (this.checked ? 'on' : 'off'));http.send();updateStrings();"
class='form-check-input' type='checkbox' role='switch' id='updatedLabel_RESTORESTATE_switch'>
<label class='form-check-label' for='restoreStateSwitch'>Restore last saved state</label>
</div>
<div class='form-check form-switch'>
<input onclick="this.value ? console.log('Toggeled on') : console.log('Toggeled off');" class='form-check-input'
type='checkbox' role='switch' id='restorePlayingSwitch' " +
configuration.getBool(PREFERENCES_KEY_RESTORE_PLAYING,
true) ? "checked" : String() + " >
<input onclick="http = new XMLHttpRequest();http.open('GET', 'http://' + document.cookie +
'/api/v1/system/restore_playing/' + (this.checked ? 'on' : 'off'));http.send();updateStrings();"
class='form-check-input' type='checkbox' role='switch' id='updatedLabel_RESTOREPLAYING_switch'>
<label class='form-check-label' for='restorePlayingSwitch'>Also restore last playing state</label>
</div>
</div>
@ -556,7 +554,9 @@
frnameLabel2 = document.getElementById('updatedLabel_FRNAME_table');
frnameLabel3 = document.getElementById('updatedLabel_FRNAME_oldinputtext');
restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table')
restoreStateSwitch1 = document.getElementById('updatedLabel_RESTORESTATE_switch')
restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
restorePlayingStateSwitch1 = document.getElementById('updatedLabel_RESTOREPLAYING_switch')
wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
apSsidLabel1 = document.getElementById('updatedLabel_APSSID_table');
apSsidLabel2 = document.getElementById('updatedLabel_APSSID_code');
@ -639,8 +639,9 @@
var restoreStateRequest = new XMLHttpRequest();
restoreStateRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var restoreStateString = JSON.parse(this.responseText).restore_state;
restoreStateLabel1.innerHTML = restoreStateString ? "yes" : "no";
var restoreStateValue = JSON.parse(this.responseText).restore_state;
restoreStateLabel1.innerHTML = restoreStateValue ? "yes" : "no";
restoreStateSwitch1.checked = restoreStateValue;
}
}
restoreStateRequest.open("GET", apiBase + restoreStateApiEndpoint, true);
@ -649,8 +650,9 @@
var restorePlayingRequest = new XMLHttpRequest();
restorePlayingRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var restorePlayingString = JSON.parse(this.responseText).restore_playing;
restorePlayingStateLabel1.innerHTML = restorePlayingString ? "yes" : "no";
var restorePlayingValue = JSON.parse(this.responseText).restore_playing;
restorePlayingStateLabel1.innerHTML = restorePlayingValue ? "yes" : "no";
restorePlayingStateSwitch1.checked = restorePlayingValue;
}
}
restorePlayingRequest.open("GET", apiBase + restorePlayingStateApiEndpoint, true);