refactor: remove usa countdown timer
Some checks failed
.NET / Build & Test (push) Failing after 1m20s
Some checks failed
.NET / Build & Test (push) Failing after 1m20s
This commit is contained in:
parent
90f6d34af9
commit
9dc12ba3b3
@ -112,20 +112,6 @@
|
||||
|
||||
<div style="margin:50px 0;"></div>
|
||||
|
||||
@if (!doAprilFools && DateTimeOffset.UtcNow < new DateTime(2024, 03, 08))
|
||||
{
|
||||
<div id="usa-countdown" class="container">
|
||||
<div class="row">
|
||||
<div class="col-3 usa-countdown-element" id="usa-countdown-days">00</div>
|
||||
<div class="col-3 usa-countdown-element" id="usa-countdown-hours">00</div>
|
||||
<div class="col-3 usa-countdown-element" id="usa-countdown-minutes">00</div>
|
||||
<div class="col-3 usa-countdown-element" id="usa-countdown-seconds">00</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div style="margin:50px 0;"></div>
|
||||
|
||||
<div class="container">
|
||||
@if (doAprilFools)
|
||||
{
|
||||
|
27
src/ts/UI.ts
27
src/ts/UI.ts
@ -82,33 +82,6 @@ class UI {
|
||||
UI.updateProjectCards(element);
|
||||
}
|
||||
|
||||
public static updateUsaCountdown(element?: Element){
|
||||
element = element || document.getElementById("usa-countdown");
|
||||
|
||||
const daysElement = element.querySelector("#usa-countdown-days");
|
||||
const hoursElement = element.querySelector("#usa-countdown-hours");
|
||||
const minutesElement = element.querySelector("#usa-countdown-minutes");
|
||||
const secondsElement = element.querySelector("#usa-countdown-seconds");
|
||||
|
||||
const start = new Date().getTime();
|
||||
const end = Date.UTC(2024, 2, 7, 13, 20);
|
||||
const diff = end - start;
|
||||
let days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
||||
let hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
let minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
|
||||
let seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
||||
|
||||
if (days < 0) days = 0
|
||||
if (hours < 0) hours = 0;
|
||||
if (minutes < 0) minutes = 0;
|
||||
if (seconds < 0) seconds = 0;
|
||||
|
||||
daysElement.innerHTML = days.toString().padStart(2, '0');
|
||||
hoursElement.innerHTML = hours.toString().padStart(2, '0');
|
||||
minutesElement.innerHTML = minutes.toString().padStart(2, '0');
|
||||
secondsElement.innerHTML = seconds.toString().padStart(2, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Bootstrap tooltips to all elements with a title attribute.
|
||||
* @param element The element to search for elements with a title attribute in.
|
||||
|
@ -98,13 +98,6 @@ declare const Prism: any;
|
||||
|
||||
UI.updateUI();
|
||||
|
||||
const usaCountdown = document.getElementById("usa-countdown");
|
||||
if (usaCountdown) {
|
||||
usaCountdown.addEventListener("click", () => window.location.href = "/blog/2024/02/19/the-american");
|
||||
UI.updateUsaCountdown(usaCountdown);
|
||||
setInterval(() => UI.updateUsaCountdown(usaCountdown), 1000);
|
||||
}
|
||||
|
||||
let avatarType = 0;
|
||||
const headshot = document.getElementById("index-headshot") as HTMLImageElement;
|
||||
if (headshot) {
|
||||
|
Loading…
Reference in New Issue
Block a user