-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
84 lines (74 loc) · 1.83 KB
/
index.html
File metadata and controls
84 lines (74 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A Gift for You 💖</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #fbc2eb, #a6c1ee);
font-family: Arial, sans-serif;
}
.card {
background: white;
padding: 20px;
border-radius: 16px;
width: 90%;
max-width: 500px;
text-align: center;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
iframe {
width: 100%;
height: 260px;
border-radius: 12px;
}
.quote {
margin-top: 15px;
font-size: 1.2em;
color: #444;
}
</style>
</head>
<body>
<div class="card">
<iframe id="video" src="" frameborder="0" allowfullscreen></iframe>
<div class="quote" id="quote"></div>
</div>
<script>
const CSV_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vRsDHW2Ynsan5uuUrCsdy-Cj_9nE5XzTxHiqTRIpTuX1K2uYSX_0oAFh2Qk7nxKZH-OYhswmQPw5PYy/pub?gid=0&single=true&output=csv";
function parseCSV(text) {
return text.trim().split("\n").slice(1).map(row => {
const cols = row.split(",");
return {
date: cols[0],
video: cols[1],
quote: cols.slice(2).join(",")
};
});
}
fetch(CSV_URL)
.then(res => res.text())
.then(text => {
const data = parseCSV(text);
const today = new Date().toISOString().split("T")[0];
const match = data.find(d => d.date === today);
if (match) {
document.getElementById("video").src = match.video;
document.getElementById("quote").innerText = match.quote;
} else {
document.getElementById("quote").innerText =
"No gift scheduled for today 💙";
}
})
.catch(() => {
document.getElementById("quote").innerText =
"Unable to load today's gift 💔";
});
</script>
</body>
</html>