diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/app.js b/app.js
index 4a52f3a..ed87c1e 100644
--- a/app.js
+++ b/app.js
@@ -30,12 +30,37 @@ function roomStatus(room, callback) {
end.setSeconds(0);
parsed.push({
- title: lesson.getAttribute('title'),
+ title: lesson.getAttribute('title').trim(),
start: start,
end: end
});
}
+ let start = new Date();
+ start.setHours(0);
+ start.setMinutes(0);
+ start.setSeconds(0);
+
+ let s = start;
+
+ let end = new Date();
+ end.setHours(23);
+ end.setMinutes(59);
+ end.setSeconds(0);
+
+ const holes = [];
+ for (let i = 0; i <= parsed.length; i++) {
+ const time = i == parsed.length ? end : parsed[i].start;
+ if (time > s) {
+ holes.push({title: "Unassigned", start: s, end: time});
+ }
+ if (time != end) {
+ s = parsed[i].end;
+ }
+ }
+
+ parsed.push(...holes);
+
resolve(parsed);
});
xhr.open('GET', URL + room);
@@ -77,16 +102,22 @@ function colorRoom(roomTitle, node, time = NOW /* QuantumLeap */) {
return
}
- const currentLecture = data.filter(d => d.start < time && d.end > time)[0];
- const isFree = currentLecture === void(0);
+ const currentLecture = data.filter(d => d.start < time && d.end > time)[0] || null;
+ const isFree = !!currentLecture && !!currentLecture.title &&
+ currentLecture.title === "Overflow";
+ console.log(roomTitle, isFree);
const block = document.getElementById(roomTitle);
- block.className = block.className.replace(" room-in-use", "")
- .replace(" room-free", "");
- block.className += isFree ? " room-free" : " room-in-use";
+ block.className = block.className
+ .replace(" room-in-use", "")
+ .replace(" room-free", "")
+ .replace(" room-unassigned", "");
+ block.className += isFree ? " room-free" :
+ currentLecture.title === "Unassigned" ? " room-unassigned" : " room-in-use";
- block.querySelector('p').innerHTML = isFree ? 'Free' :
- currentLecture.title + "
(" + formatTime(currentLecture.start) + " - " +
+ block.querySelector('p').innerHTML = isFree ? 'Free (overflow)' :
+ (currentLecture ? currentLecture.title : "Unassigned") +
+ "
(" + formatTime(currentLecture.start) + " - " +
formatTime(currentLecture.end) + ")";
}
@@ -99,6 +130,7 @@ async function buildRoomMarkup(roomTitle) {
const list = room.querySelector('.list');
for (const d of data) {
+ if (d.title === "Unassigned" || d.title === "Overflow") continue;
const slot = document.importNode(SLOT_TEMPLATE.content, true);
const title = slot.querySelector('.title');
title.innerHTML = d.title;
diff --git a/assets/index.css b/assets/index.css
index 1681145..c05f48e 100644
--- a/assets/index.css
+++ b/assets/index.css
@@ -169,7 +169,7 @@ input[type="range"]::-moz-range-progress {
/* Schedule */
-.schedule {
+.schedule, .warning {
border: #00000033 solid 1px;
border-radius: 6px;
box-shadow: 0 1px 3px #0000001a;
@@ -229,13 +229,21 @@ input[type="range"]::-moz-range-progress {
.room-free {
- background-color: #3FE1B0;
+ background-color: #3fe1b0;
}
.room-free:hover {
box-shadow: 0 4px 8px #b3ffe333;
}
+ .room-unassigned {
+ background-color: #fe8a4f;
+ }
+
+ .room-unassigned:hover {
+ box-shadow: 0 4px 8px #b3fe8a4f;
+ }
+
.room-in-use {
background-color: #ff6a75;
}
@@ -250,7 +258,7 @@ input[type="range"]::-moz-range-progress {
box-shadow: 0 0 0 #00000000;
}
- .schedule {
+ .schedule, .warning {
border: #384047 solid 1px;
background-color: #2d3339;
box-shadow: 0 0 0 #00000000;
diff --git a/index.html b/index.html
index fae207f..d7fdd70 100644
--- a/index.html
+++ b/index.html
@@ -90,6 +90,14 @@
+