Skip to content

Commit

Permalink
add map links
Browse files Browse the repository at this point in the history
  • Loading branch information
ear1grey committed Sep 19, 2024
1 parent 030411e commit 5b7acf2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h4>Friday</h4>
<template id="event-template">
<div class="event">
<h4><span class="time"></span> – <span class="endtime"></span> <span class="title"></span></h4>
<p><span class="building"></span> <span class="room"></span></p>
<p><span class="building"></span> <span class="room"></span> <span class="map hidden"></span></p>
<p class="description"></p>
<p class="link hidden"></p>
</div>
Expand Down
11 changes: 10 additions & 1 deletion docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function populate() {
for (const event of data[level].common.events) {
if (event.not && event.not.includes(plan.code)) continue;
const day = planSect.querySelector(`article[data-day="${event.day}"]`);
console.log('planning: ' + JSON.stringify(event));
// console.log('planning: ' + JSON.stringify(event));
populateEvent(day, event);
}
}
Expand Down Expand Up @@ -172,6 +172,15 @@ function populateEvent(day, event) {
} else {
eventElem.querySelector('.building').textContent = `${event.building} Building`;
eventElem.querySelector('.room').textContent = event.room;
if (event.building) {
// lookup the building url in data.buildings
const [building] = data.buildings.filter( br => br.name == event.building );
const mapElem = eventElem.querySelector('.map');
if (building?.url) {
mapElem.innerHTML = `(<a href="${building.url}">map</a>)`;
mapElem.classList.remove('hidden');
}
}
}

eventElem.dataset.time = event.time;
Expand Down
3 changes: 2 additions & 1 deletion docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ article[data-day]>* {
}

.building,
.room {
.room,
.map {
font-size: 80%;
color: #369;
font-weight: bold;
Expand Down

0 comments on commit 5b7acf2

Please sign in to comment.