mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
restore minification
This commit is contained in:
parent
d759946cc4
commit
1a4d5a73f3
1 changed files with 23 additions and 30 deletions
|
@ -5,6 +5,7 @@ const char EVENTS_HTML_START[] = R"=====(
|
||||||
)=====";
|
)=====";
|
||||||
const char EVENTS_HTML_END[] = R"=====(
|
const char EVENTS_HTML_END[] = R"=====(
|
||||||
</div></div>
|
</div></div>
|
||||||
|
<button onclick='clear()'>Clear all events</button>
|
||||||
<button onclick='home()'>Back to main page</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>
|
<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>
|
<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>
|
||||||
|
@ -63,36 +64,28 @@ String events_processor(const String& var) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Script for displaying event log before it gets minified
|
/* Script for displaying event log before it gets minified
|
||||||
<script>
|
<button onclick="clear()">Clear all events</button>
|
||||||
function showEvent() {
|
<button onclick="home()">Back to main page</button>
|
||||||
var eventLogElement = document.querySelector('.event-log');
|
<style>
|
||||||
// Get the current time on the client side
|
.event:nth-child(even) {
|
||||||
var currentTime = new Date().getTime() / 1000; // Convert milliseconds to seconds
|
background-color: #455a64;
|
||||||
// Loop through the events and update the "Last Event" column
|
|
||||||
var events = document.querySelectorAll('.event');
|
|
||||||
events.forEach(function(event) {
|
|
||||||
var secondsAgoElement = event.querySelector('.sec-ago');
|
|
||||||
var timestampElement = event.querySelector('.timestamp');
|
|
||||||
if (secondsAgoElement && timestampElement) {
|
|
||||||
var secondsAgo = parseInt(secondsAgoElement.innerText, 10);
|
|
||||||
var uptimeTimestamp = parseFloat(timestampElement.innerText); // Parse as float to handle seconds with decimal parts
|
|
||||||
// Calculate the actual system time based on the client-side current time
|
|
||||||
var actualTime = new Date((currentTime - uptimeTimestamp + secondsAgo) * 1000);
|
|
||||||
// Format the date and time
|
|
||||||
var formattedTime = actualTime.toLocaleString();
|
|
||||||
// Update the "Last Event" column with the formatted time
|
|
||||||
secondsAgoElement.innerText = formattedTime;
|
|
||||||
}
|
}
|
||||||
|
.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() {
|
||||||
// Call the showEvent function when the page is loaded
|
window.location.href = "/";
|
||||||
window.onload = function() {
|
}
|
||||||
|
window.onload = function () {
|
||||||
showEvent();
|
showEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
function home() {
|
|
||||||
window.location.href = '/';
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue