From 11c4d8365828e07d5c88910dbd8f8c56185f71c3 Mon Sep 17 00:00:00 2001 From: Joey Date: Fri, 18 Oct 2019 10:49:03 +0200 Subject: [PATCH 1/3] Mirror mirror on the wall, why the rooms were wrong Signed-off-by: Joey --- app.js | 4 ++-- index.html | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app.js b/app.js index 7b9c2f2..d4c92cc 100644 --- a/app.js +++ b/app.js @@ -45,11 +45,11 @@ function roomStatus(room, callback) { const ROOMS = [ 'SI-003', - 'SI-004', 'SI-015', + 'SI-004', 'SI-006', - 'SI-007', 'SI-013', + 'SI-007', 'SI-008', ]; diff --git a/index.html b/index.html index 16a0363..4f80012 100644 --- a/index.html +++ b/index.html @@ -27,18 +27,18 @@ - + - +
From 82f824ee0ee678ab1bcbf87065218ae0b4a79166 Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 30 Oct 2019 14:05:19 +0100 Subject: [PATCH 2/3] Add dark mode Signed-off-by: Joey --- assets/index.css | 79 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/assets/index.css b/assets/index.css index e212fe2..5e013f9 100644 --- a/assets/index.css +++ b/assets/index.css @@ -48,13 +48,13 @@ input[type=range] { } input[type="range"]::-webkit-slider-runnable-track { - background: #bdbdbd; + background: #b1b1bc; border-radius: 2px; height: 4px; } input[type="range"]::-moz-range-track { - background: #bdbdbd; + background: #b1b1bc; height: 4px; } @@ -180,3 +180,78 @@ input[type="range"]::-moz-range-progress { font-weight: 800; text-align: start; } + +/* Dark mode */ + +@media(prefers-color-scheme: dark) { + * { + color: #f9f9fa; + } + + body { + background: #212529; + } + + input[type="range"] { + background-color: #2d3339; + } + + input[type="range"]::-webkit-slider-runnable-track { + background: #7a7a8b; + } + + input[type="range"]::-moz-range-track { + background: #7a7a8b; + } + + input[type="range"]::-webkit-slider-thumb { + background: #f9f9fa; + border: 4px solid #5e5e72; + } + + input[type="range"]::-moz-range-thumb { + background: #f9f9fa; + border: 4px solid #5e5e72; + } + + input[type="range"]::-moz-range-progress { + background: #f9f9fa; + } + + .room { + margin: 0.5rem; + background: #2d3339; + border-radius: 6px; + padding: 0.5rem; + transition: all 0.5s ease; + } + + + .room-free { + background-color: #3FE1B0; + } + + .room-free:hover { + box-shadow: 0 4px 8px #b3ffe333; + } + + .room-in-use { + background-color: #ff6a75; + } + + .room-in-use:hover { + box-shadow: 0 4px 8px #ff6a7533; + } + + .timepicker { + border: #384047 solid 1px; + background-color: #2d3339; + box-shadow: 0 0 0 #00000000; + } + + .schedule { + border: #384047 solid 1px; + background-color: #2d3339; + box-shadow: 0 0 0 #00000000; + } +} From ad768bb389dc1c9c0ac78944e7ac3f30f97a5e94 Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 30 Oct 2019 14:12:31 +0100 Subject: [PATCH 3/3] Consistent formatting Signed-off-by: Joey --- app.js | 80 +++++++++++++++++++++++++-------------------------- index.html | 14 ++++----- manifest.json | 38 ++++++++++++------------ 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/app.js b/app.js index d4c92cc..0e04c24 100644 --- a/app.js +++ b/app.js @@ -8,49 +8,49 @@ const NOW = new Date(); const timeTable = {}; function roomStatus(room, callback) { - return new Promise((resolve, _) => { - const xhr = new XMLHttpRequest(); - xhr.addEventListener('load', () => { - const parser = new DOMParser(); - const doc = parser.parseFromString(xhr.responseText, 'text/html'); - const lessons = - doc.querySelectorAll('table.rsContentTable div.rsAptSimple'); - const parsed = []; + return new Promise((resolve, _) => { + const xhr = new XMLHttpRequest(); + xhr.addEventListener('load', () => { + const parser = new DOMParser(); + const doc = parser.parseFromString(xhr.responseText, 'text/html'); + const lessons = doc.querySelectorAll( + 'table.rsContentTable div.rsAptSimple'); + const parsed = []; - for (let lesson of lessons) { - const time = lesson.querySelector('span[id$=lblOrario]'); - const start = new Date(); - start.setHours(parseInt(time.innerText.substring(1,3))); - start.setMinutes(parseInt(time.innerText.substring(4,6))); - start.setSeconds(0); + for (let lesson of lessons) { + const time = lesson.querySelector('span[id$=lblOrario]'); + const start = new Date(); + start.setHours(parseInt(time.innerText.substring(1,3))); + start.setMinutes(parseInt(time.innerText.substring(4,6))); + start.setSeconds(0); - const end = new Date(); - end.setHours(parseInt(time.innerText.substring(7,9))); - end.setMinutes(parseInt(time.innerText.substring(10,12))); - end.setSeconds(0); + const end = new Date(); + end.setHours(parseInt(time.innerText.substring(7,9))); + end.setMinutes(parseInt(time.innerText.substring(10,12))); + end.setSeconds(0); - parsed.push({ - title: lesson.getAttribute('title'), - start: start, - end: end + parsed.push({ + title: lesson.getAttribute('title'), + start: start, + end: end + }); + } + + resolve(parsed); }); - } - - resolve(parsed); + xhr.open('GET', URL + room); + xhr.send(); }); - xhr.open('GET', URL + room); - xhr.send(); - }); } const ROOMS = [ - 'SI-003', - 'SI-015', - 'SI-004', - 'SI-006', - 'SI-013', - 'SI-007', - 'SI-008', + 'SI-003', + 'SI-015', + 'SI-004', + 'SI-006', + 'SI-013', + 'SI-007', + 'SI-008', ]; const ROOM_LIST = document.querySelector(".times"); @@ -152,10 +152,10 @@ function setupTimeMachine() { setTimePreview(new Date(NOW.getTime() + 600000)); } -(async function() { -for (const room of ROOMS) { - await buildRoomMarkup(room); -} -})() +(async () => { + for (const room of ROOMS) { + await buildRoomMarkup(room); + } +})(); setupTimeMachine(); diff --git a/index.html b/index.html index 4f80012..9860e6a 100644 --- a/index.html +++ b/index.html @@ -74,19 +74,19 @@
diff --git a/manifest.json b/manifest.json index a6379dc..f5b0adf 100644 --- a/manifest.json +++ b/manifest.json @@ -1,21 +1,21 @@ { - "short_name": "USI Rooms", - "name": "USI INF Rooms", - "icons": [ - { - "src": "./assets/images/icon-192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "./assets/images/icon-512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - "start_url": "./index.html", - "background_color": "#fafafa", - "display": "standalone", - "scope": "./", - "theme_color": "#333333" + "short_name": "USI Rooms", + "name": "USI INF Rooms", + "icons": [ + { + "src": "./assets/images/icon-192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "./assets/images/icon-512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": "./index.html", + "background_color": "#fafafa", + "display": "standalone", + "scope": "./", + "theme_color": "#333333" }