diff --git a/index.js b/app.js similarity index 92% rename from index.js rename to app.js index 823c787..3f60d5a 100644 --- a/index.js +++ b/app.js @@ -1,4 +1,5 @@ // vim: set ts=2 sw=2 et tw=80: +// Real code const URL = 'https://usirooms.maggioni.xyz/schedule.html?name='; const NOW = new Date(); @@ -79,9 +80,9 @@ function colorRoom(roomTitle, node, time = NOW /* QuantumLeap */) { const isFree = currentLecture === void(0); const block = document.getElementById(roomTitle); - block.className = isFree ? - block.className.replace("room-in-use", "") + " room-free" : - block.className.replace("room-free", "") + " room-in-use"; + block.className = block.className.replace(" room-in-use", "") + .replace(" room-free", ""); + block.className += isFree ? " room-free" : " room-in-use"; block.querySelector('p').innerHTML = isFree ? 'Free' : currentLecture.title + "
(" + formatTime(currentLecture.start) + " - " + @@ -125,12 +126,11 @@ function setTimePreview(date = NOW) { function setupTimeMachine() { const slider = document.getElementById('timemachine'); slider.min = 0; - slider.max = 92 - (NOW.getHours() * 4); - - slider.value = slider.min; + // Remaining minutes until 23:59 + slider.max = 1380 - (NOW.getHours() * 60) - NOW.getMinutes() - 1; slider.addEventListener("input", (e) => { - const hours = Math.round(slider.value / 4); + const hours = Math.round(slider.value / 60); const mins = slider.value % 60; let newDate = new Date(); newDate.setHours(newDate.getHours() + hours); diff --git a/assets/index.css b/assets/index.css index 220b46e..e212fe2 100644 --- a/assets/index.css +++ b/assets/index.css @@ -102,7 +102,7 @@ input[type="range"]::-moz-range-progress { .room { margin: 0.5rem; background: #ededf0; - border-radius: 4px; + border-radius: 6px; padding: 0.5rem; transition: all 0.5s ease; } @@ -157,7 +157,7 @@ input[type="range"]::-moz-range-progress { /* Time */ .timepicker { border: #00000033 solid 1px; - border-radius: 4px; + border-radius: 6px; box-shadow: 0 1px 3px #0000001a; display: flex; flex-direction: column; @@ -170,7 +170,7 @@ input[type="range"]::-moz-range-progress { .schedule { border: #00000033 solid 1px; - border-radius: 4px; + border-radius: 6px; box-shadow: 0 1px 3px #0000001a; padding: 1rem; margin: 2rem 5vw; diff --git a/index.html b/index.html index 24efc84..16a0363 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,11 @@

USI INF room availability

+
+

Loading...

+ +
+
@@ -63,11 +68,6 @@
-
-

Loading...

- -
-

Schedule for today

@@ -90,6 +90,6 @@
- +