Last active
November 3, 2019 17:01
-
-
Save hogart/1cf6c01e32002788332e1bf89baba14d to your computer and use it in GitHub Desktop.
date-time widget with nice blinking minutes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::StoryInit | |
<<set | |
$gameDate = Date("2019-07-14T07:00Z"); | |
>> | |
<<set | |
window.GameDays = [ | |
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" | |
]; | |
>> | |
::StoryCaption | |
<<dateTime>> | |
::widget-dateTime [widget] | |
<<widget "dateTime">>\ | |
<div class="dateTime">\ | |
<<= GameDays[$gameDate.getUTCDay()]>> | |
<<= padZero($gameDate.getUTCHours())>><span class="blinky">:</span><<= padZero($gameDate.getUTCMinutes())>>\ | |
</div> | |
<</widget>> | |
::Script [script] | |
window.padZero = function padZero(number) { | |
return number.toString().padStart(2, "0"); | |
} | |
::Style [stylesheet] | |
@keyframes blinky { | |
0% { opacity: 1; } | |
25% { opacity: 0; } | |
50% { opacity: 0; } | |
75% { opacity: 1; } | |
} | |
.blinky { | |
animation: blinky 2s infinite; | |
} | |
.dateTime { | |
font-weight: bold; | |
} | |
.dateTime:first-line { | |
font-size: 120%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment