Skip to content

Commit

Permalink
update background logic and kiosk var names
Browse files Browse the repository at this point in the history
  • Loading branch information
14ROVI committed Dec 21, 2022
1 parent b3647cb commit db25446
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,20 @@ function displayEvent(event) {
let locationElement = document.getElementById("location");

const kioskDefault = {
background: event.attributes.banner ? "https://cssbristol.co.uk/assets/images/contrib/events/" + event.attributes.banner : "default_background.png",
short_description: event.body.substring(0, 150) + "..." || "",
kiosk_title: event.attributes.title || "",
title: event.attributes.title || "",
background: event.attributes.banner ? "https://cssbristol.co.uk/assets/images/contrib/events/" + event.attributes.banner : undefined,
description: event.body.substring(0, 150) + "..." || "",
show_sponsors: true,
show_date: true
}
let kioskOptions = {...event.attributes.kiosk, ...kioskDefault};

if (kioskOptions.background === undefined) {
kioskOptions.background = "default_background.png";
} else if (!kioskOptions.background.startsWith("http")) {
kioskOptions.background = "https://cssbristol.co.uk/assets/images/contrib/events/" + kioskOptions.background;
}

body.style.backgroundImage = `url(${kioskOptions.background}), url(default_background.png)`;

sponsorsContainer.innerHTML = "";
Expand All @@ -148,7 +154,7 @@ function displayEvent(event) {
}
}

eventTitleElement.innerText = kioskOptions.kiosk_title;
eventTitleElement.innerText = kioskOptions.title;

let timeToStart = event.attributes.date - now;
if (timeToStart < 0) {
Expand Down Expand Up @@ -187,7 +193,7 @@ function displayEvent(event) {

locationElement.innerText = event.attributes.location;

descriptionElement.innerText = kioskOptions.short_description;
descriptionElement.innerText = kioskOptions.description;

let url = "https://cssbristol.co.uk/events/" + event.name.replace(".md", "");
QRCodeElement.innerHTML = "";
Expand Down

0 comments on commit db25446

Please sign in to comment.