diff options
-rw-r--r-- | includes/fragments/dashboard.inc | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/includes/fragments/dashboard.inc b/includes/fragments/dashboard.inc index 2a6d905..1e053e6 100644 --- a/includes/fragments/dashboard.inc +++ b/includes/fragments/dashboard.inc @@ -61,49 +61,6 @@ global $use2023UI; ?>!</span> </h2> - <script> - let greeting = "Hi"; - - switch (new Date().getHours()) { - case 22: - case 23: - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - greeting = "Good night"; - break; - - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - greeting = "Good morning"; - break; - - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - greeting = "Good afternoon"; - break; - - case 18: - case 19: - case 20: - case 21: - greeting = "Good evening"; - break; - } - - document.getElementById("greeting").innerText = greeting; - </script> <div id="schedules" style="margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 20px;"> <div> @@ -129,6 +86,8 @@ global $use2023UI; <b>Raindrops System</b><br> <h3 id="live-time-raindrops">--:--</h3> </div> + + <hr style="display: none;" class="schedules-separator"> </div> <div> @@ -161,7 +120,7 @@ global $use2023UI; hour12: false })).format(new Date()); - document.getElementById("live-time-raindrops").innerText = time1; + document.getElementById("live-time-raindrops").innerText = time1.replace("24:", "00:"); document.getElementById("live-time-raindrops-outer").style.backgroundPositionY = getDayPercentage(time1) + "%"; let time4 = (new Intl.DateTimeFormat('en-US', { @@ -171,7 +130,7 @@ global $use2023UI; hour12: false })).format(new Date()); - document.getElementById("live-time-moonwind").innerText = time4; + document.getElementById("live-time-moonwind").innerText = time4.replace("24:", "00:"); document.getElementById("live-time-moonwind-outer").style.backgroundPositionY = getDayPercentage(time4) + "%"; let time2 = (new Intl.DateTimeFormat('en-US', { @@ -181,7 +140,7 @@ global $use2023UI; hour12: false })).format(new Date()); - document.getElementById("live-time-cloudburst").innerText = time2; + document.getElementById("live-time-cloudburst").innerText = time2.replace("24:", "00:"); document.getElementById("live-time-cloudburst-outer").style.backgroundPositionY = getDayPercentage(time2) + "%"; let time3 = (new Intl.DateTimeFormat('en-US', { @@ -191,8 +150,50 @@ global $use2023UI; hour12: false })).format(new Date()); - document.getElementById("live-time-other").innerText = time3; + document.getElementById("live-time-other").innerText = time3.replace("24:", "00:"); document.getElementById("live-time-other-outer").style.backgroundPositionY = getDayPercentage(time3) + "%"; + + let greeting = "Hi"; + + switch (new Date().getHours()) { + case 22: + case 23: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + greeting = "Good night"; + break; + + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + greeting = "Good morning"; + break; + + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + greeting = "Good afternoon"; + break; + + case 18: + case 19: + case 20: + case 21: + greeting = "Good evening"; + break; + } + + document.getElementById("greeting").innerText = greeting; } updateTime(); |