|
10 | 10 | <div class="heading">STORINATOR</div> |
11 | 11 |
|
12 | 12 | <button |
13 | | - id="powerLed" |
| 13 | + id="powerStatus" |
14 | 14 | type="button" |
15 | 15 | class="button" |
16 | 16 | disabled |
17 | | - style="color: #b413ff" |
| 17 | + style="height: 5%; font-size: 2vh; color: #b413ff" |
18 | 18 | > |
19 | 19 | NO CONNECTION |
20 | 20 | </button> |
|
122 | 122 | requestStatus(REQ_POWER_STATUS) |
123 | 123 | }, 3000) |
124 | 124 |
|
125 | | - function togglePowerLedColor(state) { |
126 | | - const powerLed = document.getElementById('powerLed') |
| 125 | + function togglePowerStatus(state) { |
| 126 | + const powerStatus = document.getElementById('powerStatus') |
127 | 127 | if (state == 'on') { |
128 | | - powerLed.textContent = 'POWER LED' |
129 | | - powerLed.style.color = '#27e670' |
| 128 | + powerStatus.textContent = 'POWERED ON' |
| 129 | + powerStatus.style.color = '#27e670' |
130 | 130 | } else if (state == 'off') { |
131 | | - powerLed.textContent = 'POWER LED' |
132 | | - powerLed.style.color = '#eb1e8f' |
| 131 | + powerStatus.textContent = 'POWERED OFF' |
| 132 | + powerStatus.style.color = '#eb1e8f' |
133 | 133 | } else { |
134 | | - powerLed.style.color = '#b413ff' |
135 | | - powerLed.textContent = 'NO CONNECTION' |
| 134 | + powerStatus.style.color = '#b413ff' |
| 135 | + powerStatus.textContent = 'NO CONNECTION' |
136 | 136 | } |
137 | 137 | } |
138 | 138 |
|
|
160 | 160 | typeof this.response === 'string' |
161 | 161 | ) { |
162 | 162 | if (this.response.toString().includes(REQ_POWER_STATUS + ':on')) |
163 | | - togglePowerLedColor('on') |
164 | | - else togglePowerLedColor('off') |
| 163 | + togglePowerStatus('on') |
| 164 | + else togglePowerStatus('off') |
165 | 165 | } else if (this.readyState == 4) { |
166 | | - togglePowerLedColor('nocon') |
| 166 | + togglePowerStatus('nocon') |
167 | 167 | console.log('No connection to server.') |
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
171 | 171 | xhttp.onerror = function () { |
172 | | - togglePowerLedColor('nocon') |
| 172 | + togglePowerStatus('nocon') |
173 | 173 | console.log('No connection to server.') |
174 | 174 | } |
175 | 175 | xhttp.open('GET', request, true) |
|
0 commit comments