diff --git a/public/assets/index--Q5o5huW.js b/public/assets/index--Q5o5huW.js index a7c0aa5..7a48915 100644 --- a/public/assets/index--Q5o5huW.js +++ b/public/assets/index--Q5o5huW.js @@ -1 +1 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function o(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(n){if(n.ep)return;n.ep=!0;const s=o(n);fetch(n.href,s)}})();function D(t,e,o){e.sort((i,d)=>new Date(i.start.dateTime)-new Date(d.start.dateTime));const r=document.createElement("div");r.className="resource-wrapper";const n=document.createElement("div");switch(n.className="title-row",t.split("@")[0]){case"s-er-1431-00":n.innerHTML="ER 1431-00 Open Space";break;case"s-er-1431-03":n.innerHTML="ER 1431-03 Visualization Lab";break;case"s-er-1431-33":n.innerHTML="ER 1431-33 Ideation Room";break;case"s-er-1431-37":n.innerHTML="ER 1431-37 Multipurpose Room";break;case"s-er-1431-39":n.innerHTML="ER 1431-39 Conference Room";break}r.appendChild(n);const s=document.createElement("div");if(s.className="event-row",e.forEach((i,d)=>{if(d<3){const c=document.createElement("div");c.className="flex-cell";const L=i.subject.length>18?i.subject.substring(0,18)+"...":i.subject,M=!i.location.displayName||i.organizer.emailAddress.address===t?"Walk-Up":i.organizer.emailAddress.name,H=p(i.start.dateTime+"Z"),S=p(i.end.dateTime+"Z");if(new Date(i.end.dateTime)>new Date){const g=document.createElement("div");g.textContent=L;const m=document.createElement("div");m.textContent=M,m.className="organizer";const u=document.createElement("div");u.className="time-range",u.innerHTML=`${H} - ${S}`,c.appendChild(g),c.appendChild(m),c.appendChild(u),s.appendChild(c)}}}),s.children.length===0){const i=document.createElement("div");i.className="flex-cell",i.textContent="No upcoming meetings at this time",s.appendChild(i)}r.appendChild(s),o.appendChild(r)}function p(t){const e=new Date(t),o=e.getHours(),r=e.getMinutes().toString().padStart(2,"0");return`${o}:${r}`}async function E(){console.log("fetching events");const e=await(await fetch("/api/events")).json(),o=document.getElementById("resources-container");o.innerHTML="",Object.keys(e).forEach(n=>{D(n,e[n],o)})}function T(t){let e=p(new Date);t||(e=e.replace(":"," ")),document.getElementById("time").innerHTML=e}function v(t){const e=document.getElementById(t),o=e.textContent.length;o<=83?e.style.fontSize="5em":o<=166?e.style.fontSize="4em":e.style.fontSize="3em"}async function C(){try{const t=await fetch("/api/quotes");if(t.ok){const e=await t.json();if(e&&e.quote&&e.author)document.getElementById("quote").innerHTML=`${e.quote}`,v("quote"),document.getElementById("author").innerHTML=`${e.author}`;else throw new Error("Invalid quote data received")}else console.error("Server responded with status:",t.status),w()}catch(t){console.error("An error occurred:",t),w()}}function w(){document.getElementById("quote").innerHTML="Wishing you an utmost wonderful day!",v("quote"),document.getElementById("author").innerHTML="Next-Generation Cities Institute"}async function b(){const e=await(await fetch("/api/weather")).json();if(e.cod===200){const o=e.main.temp,r=e.weather[0].description,s=`https://openweathermap.org/img/wn/${e.weather[0].icon}.png`;document.getElementById("weather-icon-container").innerHTML=`Weather Icon`,document.getElementById("temperature").innerHTML=`${o}°`,document.getElementById("description").innerHTML=`${r}`}else document.getElementById("weather").innerText="Weather data unavailable"}async function N(){try{const t=await fetch("/api/slideshow");if(!t.ok)throw new Error("Failed to fetch slideshow images");const e=await t.json();I(e)}catch(t){console.error("Error fetching slideshow images:",t)}}function k(t){const e=document.createElement("img");e.src=`${t}`,e.className="slideshow-img",e.style.width="100%",e.style.maxHeight="100vh",e.style.objectFit="cover";const o=t.split("/").pop().split(".")[0];return e.alt=o,e.title=o,e}let h=0;function I(t){if(t.length===0){console.log("No images found for the slideshow.");return}const e=document.getElementById("slideshow");e.innerHTML="";const o=k(t[h]);e.appendChild(o),setTimeout(()=>{o.style.opacity="1"},100),setTimeout(()=>{for(;e.children.length>1;)e.removeChild(e.firstChild)},100),h=(h+1)%t.length,setTimeout(()=>I(t),3e4)}const f=document.getElementById("welcome-message"),B=document.querySelector("#welcome-message img"),y=["#00ADEF","#912338","#e5a712","#db0272","#8cc63e","#573996"],x=["black","white","black","white","black","white"];let a=0;function $(){f.classList.add("visible"),f.style.backgroundColor=y[a],B.src=x[a]==="white"?"ngci-logo-white-wide.svg":"ngci-logo-black.png",a=(a+1)%y.length}function q(){f.classList.remove("visible")}setInterval(function(){$(),setTimeout(q,3e4)},6e5);C();setInterval(C,60*60*1e3*24);b();setInterval(b,5*60*1e3);let l=!0;T(l);setInterval(()=>{T(l),l=!l},1e3);N();E();setInterval(E,3*60*1e3); +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function o(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(n){if(n.ep)return;n.ep=!0;const s=o(n);fetch(n.href,s)}})();function D(t,e,o){e.sort((i,d)=>new Date(i.start.dateTime)-new Date(d.start.dateTime));const r=document.createElement("div");r.className="resource-wrapper";const n=document.createElement("div");switch(n.className="title-row",t.split("@")[0]){case"s-er-1431-00":n.innerHTML="ER 1431-00 Open Space";break;case"s-er-1431-03":n.innerHTML="ER 1431-03 Visualization Lab";break;case"s-er-1431-33":n.innerHTML="ER 1431-33 Ideation Room";break;case"s-er-1431-37":n.innerHTML="ER 1431-37 Multipurpose Room";break;case"s-er-1431-39":n.innerHTML="ER 1431-39 Conference Room";break}r.appendChild(n);const s=document.createElement("div");if(s.className="event-row",e.forEach((i,d)=>{if(d<3){const c=document.createElement("div");c.className="flex-cell";const L=i.subject.length>18?i.subject.substring(0,18)+"...":i.subject,M=!i.location.displayName||i.organizer.emailAddress.address===t?"Walk-Up":i.organizer.emailAddress.name,H=p(i.start.dateTime+"Z"),S=p(i.end.dateTime+"Z");if(new Date(i.end.dateTime)>new Date){const g=document.createElement("div");g.textContent=L;const m=document.createElement("div");m.textContent=M,m.className="organizer";const u=document.createElement("div");u.className="time-range",u.innerHTML=`${H} - ${S}`,c.appendChild(g),c.appendChild(m),c.appendChild(u),s.appendChild(c)}}}),s.children.length===0){const i=document.createElement("div");i.className="flex-cell",i.textContent="No upcoming meetings at this time",s.appendChild(i)}r.appendChild(s),o.appendChild(r)}function p(t){const e=new Date(t),o=e.getHours(),r=e.getMinutes().toString().padStart(2,"0");return`${o}:${r}`}async function E(){console.log("fetching events");const e=await(await fetch("api/events")).json(),o=document.getElementById("resources-container");o.innerHTML="",Object.keys(e).forEach(n=>{D(n,e[n],o)})}function T(t){let e=p(new Date);t||(e=e.replace(":"," ")),document.getElementById("time").innerHTML=e}function v(t){const e=document.getElementById(t),o=e.textContent.length;o<=83?e.style.fontSize="5em":o<=166?e.style.fontSize="4em":e.style.fontSize="3em"}async function C(){try{const t=await fetch("api/quotes");if(t.ok){const e=await t.json();if(e&&e.quote&&e.author)document.getElementById("quote").innerHTML=`${e.quote}`,v("quote"),document.getElementById("author").innerHTML=`${e.author}`;else throw new Error("Invalid quote data received")}else console.error("Server responded with status:",t.status),w()}catch(t){console.error("An error occurred:",t),w()}}function w(){document.getElementById("quote").innerHTML="Wishing you an utmost wonderful day!",v("quote"),document.getElementById("author").innerHTML="Next-Generation Cities Institute"}async function b(){const e=await(await fetch("api/weather")).json();if(e.cod===200){const o=e.main.temp,r=e.weather[0].description,s=`https://openweathermap.org/img/wn/${e.weather[0].icon}.png`;document.getElementById("weather-icon-container").innerHTML=`Weather Icon`,document.getElementById("temperature").innerHTML=`${o}°`,document.getElementById("description").innerHTML=`${r}`}else document.getElementById("weather").innerText="Weather data unavailable"}async function N(){try{const t=await fetch("api/slideshow");if(!t.ok)throw new Error("Failed to fetch slideshow images");const e=await t.json();I(e)}catch(t){console.error("Error fetching slideshow images:",t)}}function k(t){const e=document.createElement("img");e.src=`${t}`,e.className="slideshow-img",e.style.width="100%",e.style.maxHeight="100vh",e.style.objectFit="cover";const o=t.split("/").pop().split(".")[0];return e.alt=o,e.title=o,e}let h=0;function I(t){if(t.length===0){console.log("No images found for the slideshow.");return}const e=document.getElementById("slideshow");e.innerHTML="";const o=k(t[h]);e.appendChild(o),setTimeout(()=>{o.style.opacity="1"},100),setTimeout(()=>{for(;e.children.length>1;)e.removeChild(e.firstChild)},100),h=(h+1)%t.length,setTimeout(()=>I(t),3e4)}const f=document.getElementById("welcome-message"),B=document.querySelector("#welcome-message img"),y=["#00ADEF","#912338","#e5a712","#db0272","#8cc63e","#573996"],x=["black","white","black","white","black","white"];let a=0;function $(){f.classList.add("visible"),f.style.backgroundColor=y[a],B.src=x[a]==="white"?"ngci-logo-white-wide.svg":"ngci-logo-black.png",a=(a+1)%y.length}function q(){f.classList.remove("visible")}setInterval(function(){$(),setTimeout(q,3e4)},6e5);C();setInterval(C,60*60*1e3*24);b();setInterval(b,5*60*1e3);let l=!0;T(l);setInterval(()=>{T(l),l=!l},1e3);N();E();setInterval(E,3*60*1e3); diff --git a/public/index.html b/public/index.html index d80b60d..2f2ca8a 100644 --- a/public/index.html +++ b/public/index.html @@ -6,8 +6,8 @@ NGCI Daily Schedule - - + + diff --git a/server.js b/server.js index 66c533f..72a1aaf 100644 --- a/server.js +++ b/server.js @@ -136,7 +136,7 @@ app.get('/api/slideshow', (req, res) => { const imagePaths = files .filter(file => /\.(jpg|jpeg|png|gif)$/i.test(file)) - .map(file => `/slideshow/${file}`); + .map(file => `slideshow/${file}`); res.json(imagePaths); });