x
x
x
x
Only portrait mode is currently supported - please rotate your device.
...
HTML |
---|
<script>
const getMinutesUntilEventStart = (startDate) => {
let nowDate = new Date();
let eventStartDate = new Date(startDate);
let diffMilliseconds = eventStartDate.getTime() - nowDate.getTime();
let diffMinutes = (diffMilliseconds / 60000);
return diffMinutes;
}
const getMinutesUntilEventEnd = (endDate) => {
let nowDate = new Date();
let eventEndDate = new Date(endDate);
let diffMilliseconds = eventEndDate.getTime() - nowDate.getTime();
let diffMinutes = (diffMilliseconds / 60000);
return diffMinutes;
}
window.addEventListener('load', () => {
let upcomingEvents = document.getElementById('scroll-section-1');
let upcomingCards = Array.from(upcomingEvents.getElementsByClassName('eventcard'));
for (let i = 0; i < upcomingCards.length; i++) {
let currCard = upcomingCards[i];
let currCardStart = currCard.dataset.startdate;
let minsTilStart = getMinutesUntilEventStart(currCardStart);
if (minsTilStart <= 0) {
// Check if event is offline
if (currCard.dataset.offline == "true") {
continue;
}
let liveEl = document.createElement("div");
liveEl.classList.add('live-circle');
liveEl.innerText = "LIVE";
currCard.insertAdjacentElement('afterbegin', liveEl);
}
}
});
</script>
<script>
<style>
.live-circle {
font-size: 13px;
padding: 3px 18px;
text-transform: uppercase;
font-weight: bold;
background-color: #cc1f1f;
color: white;
position: absolute;
z-index: 2;
margin: 8px 8px;
box-shadow: 1px 1px 5px #00000054;
}
</style>
<style>
.watch-indicator {
font-size: 12px;
padding: 3px 10px;
text-transform: uppercase;
font-weight: bold;
background-color: #036bc4;
color: white;
position: absolute;
z-index: 2;
margin: 8px 8px;
box-shadow: 1px 1px 5px #00000054;
border-radius: 3px;
display: flex;
justify-content: center;
align-items: center;
}
.watch-indicator-icon {
display: block;
width: 14px !important;
height: 14px !important;
margin-right: 6px;
padding-bottom: 2px;
}
a.imgLinkContainer.eventCardLink {position: unset;}
.eventcard .img-container {
width: 220px !important;
height: 220px !important;
}
.eventcard .text-container {
width: 220px;
}
.eventcard .top {
height: 220px !important;
}
</style> |
OneValley