Spaces:
Running
Running
Update index.html
Browse files- index.html +22 -7
index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link rel="preconnect" href="https://db.onlinewebfonts.com" crossorigin>
|
| 12 |
-
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400;1,500&family=Great+Vibes&display=swap" rel="stylesheet">
|
| 13 |
|
| 14 |
<style>
|
| 15 |
@font-face {
|
|
@@ -36,6 +36,7 @@
|
|
| 36 |
--coral: #D08A7A;
|
| 37 |
--coral-deep: #B8705F;
|
| 38 |
--rose: #EDD3CD;
|
|
|
|
| 39 |
--cream: #F3EFE9;
|
| 40 |
--paper: #FFFDF8;
|
| 41 |
--ink: rgba(37, 75, 107, .82);
|
|
@@ -395,7 +396,7 @@
|
|
| 395 |
font-family: var(--font-serif);
|
| 396 |
font-style: italic;
|
| 397 |
font-size: clamp(20px, 5vw, 28px);
|
| 398 |
-
font-weight:
|
| 399 |
letter-spacing: .005em;
|
| 400 |
}
|
| 401 |
|
|
@@ -501,8 +502,9 @@
|
|
| 501 |
|
| 502 |
.companions-title {
|
| 503 |
margin: 0 0 9px;
|
|
|
|
| 504 |
font-size: clamp(16px, 4vw, 20px);
|
| 505 |
-
font-weight:
|
| 506 |
line-height: 1.35;
|
| 507 |
}
|
| 508 |
|
|
@@ -515,7 +517,7 @@
|
|
| 515 |
.companions-list li {
|
| 516 |
margin: 5px 0;
|
| 517 |
font-size: clamp(16px, 4vw, 20px);
|
| 518 |
-
font-weight:
|
| 519 |
line-height: 1.38;
|
| 520 |
letter-spacing: .003em;
|
| 521 |
}
|
|
@@ -526,7 +528,7 @@
|
|
| 526 |
font-family: var(--font-serif);
|
| 527 |
font-style: italic;
|
| 528 |
font-size: clamp(16px, 4vw, 20px);
|
| 529 |
-
font-weight:
|
| 530 |
line-height: 1.35;
|
| 531 |
}
|
| 532 |
|
|
@@ -671,7 +673,7 @@
|
|
| 671 |
</div>
|
| 672 |
|
| 673 |
<div class="companions reveal-step step-5" id="companions">
|
| 674 |
-
<p class="companions-title">
|
| 675 |
<ul class="companions-list" id="companionsList"></ul>
|
| 676 |
<p class="cheers">Brinda, sorridi e goditi la serata!</p>
|
| 677 |
</div>
|
|
@@ -775,11 +777,13 @@
|
|
| 775 |
|
| 776 |
row.push(cell.trim());
|
| 777 |
if (row.some(Boolean)) rows.push(row);
|
|
|
|
| 778 |
return rows;
|
| 779 |
}
|
| 780 |
|
| 781 |
function tableFromCSV(csvText) {
|
| 782 |
const rows = parseCSV(csvText);
|
|
|
|
| 783 |
const headerIndex = rows.findIndex(row =>
|
| 784 |
normalizeName(row[0]) === "nome cognome" &&
|
| 785 |
normalizeName(row[1]) === "nome del tavolo"
|
|
@@ -801,6 +805,7 @@
|
|
| 801 |
try {
|
| 802 |
const response = await fetch(DATA_URL, { cache: "no-store" });
|
| 803 |
if (!response.ok) throw new Error("Lista non disponibile");
|
|
|
|
| 804 |
guests = tableFromCSV(await response.text());
|
| 805 |
els.status.textContent = "Lista invitati pronta.";
|
| 806 |
} catch (error) {
|
|
@@ -819,6 +824,7 @@
|
|
| 819 |
if (exact) return exact;
|
| 820 |
|
| 821 |
const partials = guests.filter(guest => guest.key.includes(key) || key.includes(guest.key));
|
|
|
|
| 822 |
return partials.length === 1 ? partials[0] : null;
|
| 823 |
}
|
| 824 |
|
|
@@ -866,6 +872,7 @@
|
|
| 866 |
|
| 867 |
function showMessage(text) {
|
| 868 |
els.message.classList.remove("show");
|
|
|
|
| 869 |
window.setTimeout(() => {
|
| 870 |
els.message.innerHTML = `<div class="message-card">${escapeHTML(text)}</div>`;
|
| 871 |
els.message.classList.add("show");
|
|
@@ -876,6 +883,7 @@
|
|
| 876 |
clearTimeout(hideTimer);
|
| 877 |
|
| 878 |
els.hello.textContent = `Ciao, ${firstName(guest.fullName)}`;
|
|
|
|
| 879 |
renderTableName(guest);
|
| 880 |
renderCompanions(guest);
|
| 881 |
|
|
@@ -890,6 +898,7 @@
|
|
| 890 |
els.reveal.classList.remove("show");
|
| 891 |
els.reveal.setAttribute("aria-hidden", "true");
|
| 892 |
document.body.classList.remove("reveal-open");
|
|
|
|
| 893 |
stopConfetti();
|
| 894 |
|
| 895 |
hideTimer = window.setTimeout(() => {
|
|
@@ -910,6 +919,7 @@
|
|
| 910 |
|
| 911 |
if (!guestsLoaded) {
|
| 912 |
showMessage("Sto caricando la lista invitati... riprova tra un secondo.");
|
|
|
|
| 913 |
if (!guestsLoadingPromise) guestsLoadingPromise = loadGuests();
|
| 914 |
await guestsLoadingPromise;
|
| 915 |
}
|
|
@@ -930,7 +940,6 @@
|
|
| 930 |
}
|
| 931 |
|
| 932 |
els.discover.addEventListener("click", discoverTable);
|
| 933 |
-
|
| 934 |
els.again.addEventListener("click", hideReveal);
|
| 935 |
|
| 936 |
els.input.addEventListener("keydown", event => {
|
|
@@ -942,14 +951,17 @@
|
|
| 942 |
});
|
| 943 |
|
| 944 |
/* ============= petali ============= */
|
|
|
|
| 945 |
const ctx = els.canvas.getContext("2d");
|
| 946 |
let petals = [];
|
| 947 |
let rafId = null;
|
| 948 |
|
| 949 |
function resizeCanvas() {
|
| 950 |
const ratio = Math.min(window.devicePixelRatio || 1, 2);
|
|
|
|
| 951 |
els.canvas.width = Math.floor(window.innerWidth * ratio);
|
| 952 |
els.canvas.height = Math.floor(window.innerHeight * ratio);
|
|
|
|
| 953 |
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
| 954 |
}
|
| 955 |
|
|
@@ -977,13 +989,16 @@
|
|
| 977 |
}));
|
| 978 |
|
| 979 |
if (rafId) cancelAnimationFrame(rafId);
|
|
|
|
| 980 |
animatePetals();
|
| 981 |
}
|
| 982 |
|
| 983 |
function stopConfetti() {
|
| 984 |
if (rafId) cancelAnimationFrame(rafId);
|
|
|
|
| 985 |
rafId = null;
|
| 986 |
petals = [];
|
|
|
|
| 987 |
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
| 988 |
}
|
| 989 |
|
|
|
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link rel="preconnect" href="https://db.onlinewebfonts.com" crossorigin>
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Great+Vibes&display=swap" rel="stylesheet">
|
| 13 |
|
| 14 |
<style>
|
| 15 |
@font-face {
|
|
|
|
| 36 |
--coral: #D08A7A;
|
| 37 |
--coral-deep: #B8705F;
|
| 38 |
--rose: #EDD3CD;
|
| 39 |
+
--pink-title: #D88EA2;
|
| 40 |
--cream: #F3EFE9;
|
| 41 |
--paper: #FFFDF8;
|
| 42 |
--ink: rgba(37, 75, 107, .82);
|
|
|
|
| 396 |
font-family: var(--font-serif);
|
| 397 |
font-style: italic;
|
| 398 |
font-size: clamp(20px, 5vw, 28px);
|
| 399 |
+
font-weight: 700;
|
| 400 |
letter-spacing: .005em;
|
| 401 |
}
|
| 402 |
|
|
|
|
| 502 |
|
| 503 |
.companions-title {
|
| 504 |
margin: 0 0 9px;
|
| 505 |
+
color: var(--pink-title);
|
| 506 |
font-size: clamp(16px, 4vw, 20px);
|
| 507 |
+
font-weight: 700;
|
| 508 |
line-height: 1.35;
|
| 509 |
}
|
| 510 |
|
|
|
|
| 517 |
.companions-list li {
|
| 518 |
margin: 5px 0;
|
| 519 |
font-size: clamp(16px, 4vw, 20px);
|
| 520 |
+
font-weight: 700;
|
| 521 |
line-height: 1.38;
|
| 522 |
letter-spacing: .003em;
|
| 523 |
}
|
|
|
|
| 528 |
font-family: var(--font-serif);
|
| 529 |
font-style: italic;
|
| 530 |
font-size: clamp(16px, 4vw, 20px);
|
| 531 |
+
font-weight: 700;
|
| 532 |
line-height: 1.35;
|
| 533 |
}
|
| 534 |
|
|
|
|
| 673 |
</div>
|
| 674 |
|
| 675 |
<div class="companions reveal-step step-5" id="companions">
|
| 676 |
+
<p class="companions-title">Sei al tavolo con:</p>
|
| 677 |
<ul class="companions-list" id="companionsList"></ul>
|
| 678 |
<p class="cheers">Brinda, sorridi e goditi la serata!</p>
|
| 679 |
</div>
|
|
|
|
| 777 |
|
| 778 |
row.push(cell.trim());
|
| 779 |
if (row.some(Boolean)) rows.push(row);
|
| 780 |
+
|
| 781 |
return rows;
|
| 782 |
}
|
| 783 |
|
| 784 |
function tableFromCSV(csvText) {
|
| 785 |
const rows = parseCSV(csvText);
|
| 786 |
+
|
| 787 |
const headerIndex = rows.findIndex(row =>
|
| 788 |
normalizeName(row[0]) === "nome cognome" &&
|
| 789 |
normalizeName(row[1]) === "nome del tavolo"
|
|
|
|
| 805 |
try {
|
| 806 |
const response = await fetch(DATA_URL, { cache: "no-store" });
|
| 807 |
if (!response.ok) throw new Error("Lista non disponibile");
|
| 808 |
+
|
| 809 |
guests = tableFromCSV(await response.text());
|
| 810 |
els.status.textContent = "Lista invitati pronta.";
|
| 811 |
} catch (error) {
|
|
|
|
| 824 |
if (exact) return exact;
|
| 825 |
|
| 826 |
const partials = guests.filter(guest => guest.key.includes(key) || key.includes(guest.key));
|
| 827 |
+
|
| 828 |
return partials.length === 1 ? partials[0] : null;
|
| 829 |
}
|
| 830 |
|
|
|
|
| 872 |
|
| 873 |
function showMessage(text) {
|
| 874 |
els.message.classList.remove("show");
|
| 875 |
+
|
| 876 |
window.setTimeout(() => {
|
| 877 |
els.message.innerHTML = `<div class="message-card">${escapeHTML(text)}</div>`;
|
| 878 |
els.message.classList.add("show");
|
|
|
|
| 883 |
clearTimeout(hideTimer);
|
| 884 |
|
| 885 |
els.hello.textContent = `Ciao, ${firstName(guest.fullName)}`;
|
| 886 |
+
|
| 887 |
renderTableName(guest);
|
| 888 |
renderCompanions(guest);
|
| 889 |
|
|
|
|
| 898 |
els.reveal.classList.remove("show");
|
| 899 |
els.reveal.setAttribute("aria-hidden", "true");
|
| 900 |
document.body.classList.remove("reveal-open");
|
| 901 |
+
|
| 902 |
stopConfetti();
|
| 903 |
|
| 904 |
hideTimer = window.setTimeout(() => {
|
|
|
|
| 919 |
|
| 920 |
if (!guestsLoaded) {
|
| 921 |
showMessage("Sto caricando la lista invitati... riprova tra un secondo.");
|
| 922 |
+
|
| 923 |
if (!guestsLoadingPromise) guestsLoadingPromise = loadGuests();
|
| 924 |
await guestsLoadingPromise;
|
| 925 |
}
|
|
|
|
| 940 |
}
|
| 941 |
|
| 942 |
els.discover.addEventListener("click", discoverTable);
|
|
|
|
| 943 |
els.again.addEventListener("click", hideReveal);
|
| 944 |
|
| 945 |
els.input.addEventListener("keydown", event => {
|
|
|
|
| 951 |
});
|
| 952 |
|
| 953 |
/* ============= petali ============= */
|
| 954 |
+
|
| 955 |
const ctx = els.canvas.getContext("2d");
|
| 956 |
let petals = [];
|
| 957 |
let rafId = null;
|
| 958 |
|
| 959 |
function resizeCanvas() {
|
| 960 |
const ratio = Math.min(window.devicePixelRatio || 1, 2);
|
| 961 |
+
|
| 962 |
els.canvas.width = Math.floor(window.innerWidth * ratio);
|
| 963 |
els.canvas.height = Math.floor(window.innerHeight * ratio);
|
| 964 |
+
|
| 965 |
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
| 966 |
}
|
| 967 |
|
|
|
|
| 989 |
}));
|
| 990 |
|
| 991 |
if (rafId) cancelAnimationFrame(rafId);
|
| 992 |
+
|
| 993 |
animatePetals();
|
| 994 |
}
|
| 995 |
|
| 996 |
function stopConfetti() {
|
| 997 |
if (rafId) cancelAnimationFrame(rafId);
|
| 998 |
+
|
| 999 |
rafId = null;
|
| 1000 |
petals = [];
|
| 1001 |
+
|
| 1002 |
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
| 1003 |
}
|
| 1004 |
|