Skip to content

Commit fe3eb55

Browse files
committed
index.html: Refactor event handling for reboot and help links
Author: kozmoz
1 parent 61212ea commit fe3eb55

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

SmartEVSE-3/data/index.html

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,8 @@ <h1 id="serialnr" class="h5 mb-0 text-white-800">SmartEVSE-</h1>
11721172

11731173
event.preventDefault();
11741174
}
1175-
function reboot() {
1175+
function reboot(event) {
1176+
event?.preventDefault();
11761177
let httpStatus;
11771178
fetch("/reboot")
11781179
.then(response => {
@@ -1196,12 +1197,6 @@ <h1 id="serialnr" class="h5 mb-0 text-white-800">SmartEVSE-</h1>
11961197
document.querySelector('#errorMsg').innerText = `Error: ${error}`;
11971198
});
11981199
}
1199-
function update() {
1200-
window.location.href = "/update";
1201-
}
1202-
function rawData() {
1203-
window.location.href = "/settings";
1204-
}
12051200

12061201
function gotoDoc(event) {
12071202
const version = $('#version').data('version') || '';
@@ -1303,10 +1298,10 @@ <h1 id="serialnr" class="h5 mb-0 text-white-800">SmartEVSE-</h1>
13031298
Actions:
13041299
</div>
13051300
<div class="col form-inline">
1306-
<a class="ui-btn ui-shadow ui-corner-all" href="/reboot" data-ajax="false" title="Reboot your device">Reboot</a>
1301+
<a class="ui-btn ui-shadow ui-corner-all" href="/reboot" onclick="reboot(event)" data-ajax="false" title="Reboot your device">Reboot</a>
13071302
<a class="ui-btn ui-shadow ui-corner-all" href="/update" data-ajax="false" title="Update your firmware">Update</a>
13081303
<a class="ui-btn ui-shadow ui-corner-all" href="/settings" data-ajax="false" title="Display your settings in JSON format">Raw Data</a>
1309-
<a class="ui-btn ui-shadow ui-corner-all" href="#" onclick="gotoDoc()" title="Show the online documentation">Help</a>
1304+
<a class="ui-btn ui-shadow ui-corner-all" href="#" onclick="gotoDoc(event)" title="Show the online documentation">Help</a>
13101305
</div>
13111306
</div>
13121307
<div class="row no-gutters align-items-center">

0 commit comments

Comments
 (0)