mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-20 01:36:50 +00:00
refactor: use event listener to listen for page load event
This commit is contained in:
parent
d88e2973da
commit
fad2f33fd6
@ -4,14 +4,14 @@ const dateFormat = new Intl.DateTimeFormat('de-DE', dateFormatOptions);
|
|||||||
const dateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: 'numeric', second: 'numeric' };
|
const dateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: 'numeric', second: 'numeric' };
|
||||||
const dateTimeFormat = new Intl.DateTimeFormat('de-DE', dateTimeFormatOptions);
|
const dateTimeFormat = new Intl.DateTimeFormat('de-DE', dateTimeFormatOptions);
|
||||||
|
|
||||||
window.onload = () => {
|
window.addEventListener('load', () => {
|
||||||
Array.from(document.getElementsByTagName('time')).forEach((timeTag) => {
|
Array.from(document.getElementsByTagName('time')).forEach((timeTag) => {
|
||||||
let date = Date.parse(timeTag.getAttribute('datetime'));
|
let date = Date.parse(timeTag.getAttribute('datetime'));
|
||||||
if (! isNaN(date)) {
|
if (! isNaN(date)) {
|
||||||
timeTag.innerText = dateTimeFormat.format(date);
|
timeTag.innerText = dateTimeFormat.format(date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
function drawPieChart(url, elemId, title, data) {
|
function drawPieChart(url, elemId, title, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
</main>
|
</main>
|
||||||
<script th:src="@{/scripts.js}"></script>
|
<script th:src="@{/scripts.js}"></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload = () => {
|
window.addEventListener('load', () => {
|
||||||
let keyBindings = {
|
let keyBindings = {
|
||||||
'w': 'first-page-link',
|
'w': 'first-page-link',
|
||||||
'a': 'prev-page-link',
|
'a': 'prev-page-link',
|
||||||
@ -66,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user