5 <title>HTTP (Hurry, Time To Perth!)
</title>
6 <link rel=
"preconnect" href=
"https://fonts.gstatic.com">
7 <link href=
"https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&display=swap" rel=
"stylesheet">
8 <script src=
"js/countdown.min.js"></script>
16 font-family: 'Open Sans Condensed', sans-serif;
20 place-items: center left;
21 background-size: cover;
22 background-position-y:
60%;
23 background-position-x:
50%;
63 <div id=
"timer"></div>
64 <audio autoplay loop controls
id=
"audio">
65 <source id=
"audio/1.mp4" src=
"" type=
"audio/webm" />
68 <button onclick=
"document.getElementById('audio').play()">Play
</button>
69 <button onclick=
"document.getElementById('audio').pause()">Pause
</button>
71 <video autoplay muted loop
id=
"video">
72 <source src=
"video/1.mp4" type=
"video/mp4">
76 var timerElement = document.getElementById(
"timer");
77 var units = ['weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'];
80 var vidElement = document.getElementById('video');
81 var activeVideo = Math.floor((Math.random() *
4) +
1);
82 vidElement.src =
"video/" + activeVideo +
".mp4";
84 var audioElement = document.getElementById('audio');
85 var activeAudio = Math.floor((Math.random() *
2) +
1);
86 audioElement.src =
"audio/" + activeAudio +
".webm";
88 function pad(n, width, z) {
91 return n.length
>= width ? n : new Array(width - n.length +
1).join(z) + n;
94 function formatUnit(timespan, unit) {
95 var padding = {'weeks':
1, 'days':
1, 'hours':
1, 'minutes':
1, 'seconds':
2, 'milliseconds':
3};
96 var unitDisplay = (timespan[unit]
> 1 || timespan[unit] ==
0) ? unit : unit.slice(
0, -
1);
98 .slice(
0, units.indexOf(unit) +
1)
99 .reduce((c,v) =
> c + timespan[v],
0)
> 0 ? '
<div class=
"chunk"><span class=
"num">' + pad(timespan[unit], padding[unit]) + '
</span><span class =
"unit">' + unitDisplay + '
</span></div>' : '';
103 var timespan = countdown(null, new Date('January
4,
2021 03:
47:
00'), countdown.ALL);
104 var text = timespan.value <
0 ? '
<span class=
"num">Welcome to Perth!
</span>' : units.reduce((c, v) =
> c + formatUnit(timespan, v),
"");
105 timerElement.innerHTML = text;
106 setTimeout(tick, delay);
109 setTimeout(tick, delay);