mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Add feature to clear events
This commit is contained in:
parent
1a4d5a73f3
commit
a2efc21642
4 changed files with 38 additions and 6 deletions
|
@ -5,10 +5,9 @@ const char EVENTS_HTML_START[] = R"=====(
|
|||
)=====";
|
||||
const char EVENTS_HTML_END[] = R"=====(
|
||||
</div></div>
|
||||
<button onclick='clear()'>Clear all events</button>
|
||||
<button onclick='home()'>Back to main page</button>
|
||||
<style>.event:nth-child(even){background-color:#455a64}.event:nth-child(odd){background-color:#394b52}</style>
|
||||
<script>function showEvent(){document.querySelectorAll(".event").forEach(function(e){var n=e.querySelector(".sec-ago");n&&(n.innerText=new Date(Date.now()-((+n.innerText.split(';')[0])*4294967296+ +n.innerText.split(';')[1])).toLocaleString());})}function home(){window.location.href="/"}window.onload=function(){showEvent()}</script>
|
||||
<button onclick="askClear()">Clear all events</button>
|
||||
<button onclick="home()">Back to main page</button>
|
||||
<style>.event:nth-child(even){background-color:#455a64}.event:nth-child(odd){background-color:#394b52}</style><script>function showEvent(){document.querySelectorAll(".event").forEach(function(e){var n=e.querySelector(".sec-ago");n&&(n.innerText=new Date(Date.now()-(4294967296*+n.innerText.split(";")[0]+ +n.innerText.split(";")[1])).toLocaleString())})}function askClear(){window.confirm("Are you sure you want to clear all events?")&&(window.location.href="/clearevents")}function home(){window.location.href="/"}window.onload=function(){showEvent()}</script>
|
||||
)=====";
|
||||
|
||||
static std::vector<EventData> order_events;
|
||||
|
@ -64,7 +63,7 @@ String events_processor(const String& var) {
|
|||
}
|
||||
|
||||
/* Script for displaying event log before it gets minified
|
||||
<button onclick="clear()">Clear all events</button>
|
||||
<button onclick="askClear()">Clear all events</button>
|
||||
<button onclick="home()">Back to main page</button>
|
||||
<style>
|
||||
.event:nth-child(even) {
|
||||
|
@ -81,6 +80,11 @@ String events_processor(const String& var) {
|
|||
n && (n.innerText = new Date(Date.now() - (+n.innerText.split(";")[0] * 4294967296 + +n.innerText.split(";")[1])).toLocaleString());
|
||||
});
|
||||
}
|
||||
function askClear() {
|
||||
if (window.confirm('Are you sure you want to clear all events?')) {
|
||||
window.location.href = '/clearevents';
|
||||
}
|
||||
}
|
||||
function home() {
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue