MS

✨ MnemSpark

Where Memories Spark to Life

Start your cognitive wellness journey today.

🔐 Member Login

toast("🎉 All matched! Great job."); closeCol(); return; } cTarget = av[Math.floor(Math.random() * av.length)]; document.getElementById('col-name').textContent = cTarget.name; document.getElementById('col-name').style.transform = "scale(1.05)"; setTimeout(() => document.getElementById('col-name').style.transform = "scale(1)", 250); cSel = null; // Reset visual selection document.querySelectorAll('.c-box').forEach(x => x.classList.remove('sel')); } function buildGrid() { const grid = document.getElementById('col-grid'); grid.innerHTML = ""; window.gameContacts.forEach(c => { const colKey = (c.color || "").trim().toUpperCase(); const hex = HEX[colKey] || '#888'; const sq = document.createElement('div'); sq.className = 'c-box'; sq.style.background = hex; sq.dataset.id = c.id; sq.onclick = () => { document.querySelectorAll('.c-box').forEach(x => x.classList.remove('sel')); sq.classList.add('sel'); cSel = c.id; }; grid.appendChild(sq); }); } function checkCol() { if(!cSel) return toast("❌ Please select a colour first."); if(cSel === cTarget.id) { cMatched.add(cSel); const el = document.querySelector(`[data-id="${cSel}"]`); el.style.opacity = "0.3"; el.style.pointerEvents = "none"; toast("✅ Matched!"); setTimeout(() => { el.remove(); pickCol(); }, 800); } else { toast("❌ Try again"); } } function skipCol() { toast("⏭️ Skipped"); pickCol(); } function closeCol() { stopRing(); // Safety catch document.getElementById('m-col').classList.remove('open'); } // --- HARDSHIP FUNCTIONS --- function openHardship(){ document.getElementById('m-hardship').classList.add('open'); } function closeHardship(){ document.getElementById('m-hardship').classList.remove('open'); } function submitHardship(){ const email = document.getElementById('h-email').value.trim(); const country = document.getElementById('h-country').value.trim(); const reason = document.getElementById('h-reason').value.trim(); if(!email || !country || !reason) return toast("❌ Please fill in Email, Country, and Reason."); toast("Submitting application..."); db.collection("hardship_applications").add({ email: email, country: country, address: document.getElementById('h-address').value, reason: reason, proofType: document.getElementById('h-proof-type').value, proofDetails: document.getElementById('h-proof-details').value, status: "pending", appliedAt: firebase.firestore.FieldValue.serverTimestamp(), userId: auth.currentUser ? auth.currentUser.uid : "guest" }).then(() => { closeHardship(); toast("✅ Thanks for enquiring. We will endeavour to respond within 48 hours."); document.getElementById('h-country').value = ""; document.getElementById('h-address').value = ""; document.getElementById('h-reason').value = ""; document.getElementById('h-proof-details').value = ""; }).catch(e => toast("❌ Error: " + e.message)); }