mirror of
https://github.com/tmdinosaurcenter/kiosk-guestbook.git
synced 2025-04-10 14:11:28 -06:00
adding public folder
This commit is contained in:
parent
98870d51f1
commit
626fa3d4a6
26
public/script.js
Normal file
26
public/script.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
async function fetchApproved() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/approved');
|
||||||
|
const data = await response.json();
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching approved data:', error);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateTicker() {
|
||||||
|
const approvedData = await fetchApproved();
|
||||||
|
const tickerContent = approvedData
|
||||||
|
.map(entry => `${entry.name} (${entry.location}): ${entry.comment}`)
|
||||||
|
.join(' – ');
|
||||||
|
|
||||||
|
const tickerElement = document.getElementById('ticker-content');
|
||||||
|
tickerElement.textContent = tickerContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch on load
|
||||||
|
updateTicker();
|
||||||
|
|
||||||
|
// Refresh every 30 seconds (adjust as needed)
|
||||||
|
setInterval(updateTicker, 30000);
|
40
public/syle.css
Normal file
40
public/syle.css
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/* Basic layout */
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: sans-serif;
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ticker styles */
|
||||||
|
#ticker-container {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #333;
|
||||||
|
color: #fff;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ticker-content {
|
||||||
|
white-space: nowrap;
|
||||||
|
animation: ticker 20s linear infinite;
|
||||||
|
padding-left: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ticker {
|
||||||
|
0% {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user