From b09025de6e7b09047dd8e54b4c5528a7efe78671 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Sun, 2 Jun 2024 21:38:14 -0400 Subject: [PATCH] Adjusted the welcome message for first timers --- scripts/welcome/confetti.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/welcome/confetti.js b/scripts/welcome/confetti.js index bb296367..4340e475 100644 --- a/scripts/welcome/confetti.js +++ b/scripts/welcome/confetti.js @@ -4,32 +4,42 @@ document.addEventListener("DOMContentLoaded", function() { // Check if it's the user's first visit if (!localStorage.getItem('firstVisit')) { // Set the first visit flag in local storage - localStorage.setItem('firstVisit', 'false'); + localStorage.setItem('firstVisit', 'true'); // Display a welcome message const welcomeMessage = document.createElement('div'); - welcomeMessage.innerText = "Welcome!"; + welcomeMessage.innerHTML = ` +
+ Welcome to the ML Systems Book! +
+
+ A collaborative resource for learning about machine learning systems. +
+
+ Prof. Vijay Janapa Reddi, Harvard University. +
+ `; welcomeMessage.style.position = 'fixed'; welcomeMessage.style.top = '0'; welcomeMessage.style.left = '0'; welcomeMessage.style.width = '100%'; welcomeMessage.style.height = '100%'; welcomeMessage.style.display = 'flex'; + welcomeMessage.style.flexDirection = 'column'; welcomeMessage.style.justifyContent = 'center'; welcomeMessage.style.alignItems = 'center'; welcomeMessage.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; // Semi-opaque background welcomeMessage.style.color = 'white'; - welcomeMessage.style.fontSize = '5em'; welcomeMessage.style.textAlign = 'center'; welcomeMessage.style.zIndex = '1000'; welcomeMessage.style.opacity = '1'; - welcomeMessage.style.transition = 'opacity 2s'; // Add transition for opacity + welcomeMessage.style.transition = 'opacity 12s'; // Add transition for opacity document.body.appendChild(welcomeMessage); // Trigger the confetti script const script = document.createElement('script'); script.src = "https://run.confettipage.com/here.js"; - script.setAttribute('data-confetticode', 'U2FsdGVkX19H2OWLrooaDFegLFthmLw91OrLhii6zjU20bEELdqOM8ZxlWHaher3attSQ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BUSd0wiuMBsJ5iY9YamkrYuAoHgo0GBClOTXMSek4VgRSbNUkAQt8Gc/KLyhKrkMCuv+a1YiDazuHEZ8T9x70YLI1r52Kd/z4MP4ROCgqrpI17CnjyOs3Dk7pj1/i93Hd6U56W/E/6eMn2EF8IQFPaUmmmulnGD62UhzcgRF+c9fbO/oTtoCH0804Nmm23iaxWjq7rVZAzteziBgBF25ACDPjFwxXHESnYfDs3MWyquqwcLSR5j9SuMlF97reG+g4qXJdbVr5gnR/RaVMXAhd8+yZkv'); document.body.appendChild(script); // Fade out the welcome message after a few seconds