|
|
@ -53,13 +53,22 @@ class CountdownBuilder { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function setStyleOptions(weeks: number) { |
|
|
|
if (weeks < 1) { |
|
|
|
document.querySelector("body").style.backgroundImage = "url('bg.jpg')"; |
|
|
|
function setStyleOptions(totaldays: number) { |
|
|
|
const backgroundElement = document.getElementById("background"); |
|
|
|
if (totaldays < 35) { |
|
|
|
backgroundElement.style.backgroundImage = "url('bg.jpg')"; |
|
|
|
let spans = document.querySelectorAll("span"); |
|
|
|
for (let i = 0; i < spans.length; i++) { |
|
|
|
spans[i].style.color = "#dddddd"; |
|
|
|
} |
|
|
|
|
|
|
|
backgroundElement.style.filter = "blur(0px) brightness(100%)"; |
|
|
|
} |
|
|
|
if (totaldays < 35 && totaldays > 7 ) { |
|
|
|
const percentage = (totaldays-7)/(35-7); |
|
|
|
const blur = percentage * 10; //base is 10px
|
|
|
|
const brightness = 100 - Math.floor(percentage * 100); |
|
|
|
backgroundElement.style.filter = "blur(" + blur + "px) brightness(" + brightness + "%)"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -93,7 +102,8 @@ function setNewTime() { |
|
|
|
} |
|
|
|
|
|
|
|
document.getElementById("countdown").innerHTML = new CountdownBuilder(timeRemaining).build(); |
|
|
|
setStyleOptions(timeRemaining.weeks); |
|
|
|
const totaldays = timeRemaining.weeks*7 + timeRemaining.days; |
|
|
|
setStyleOptions(totaldays); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -124,4 +134,4 @@ function isMobile(): boolean { |
|
|
|
return mq.matches; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|