diff --git a/backend/package.json b/backend/package.json index 355cf23..4a353f0 100644 --- a/backend/package.json +++ b/backend/package.json @@ -7,7 +7,7 @@ "start": "node server.js" }, "dependencies": { - "better-sqlite3": "^11.10.0", + "better-sqlite3": "^12.10.0", "body-parser": "^1.20.3", "csv-writer": "^1.6.0", "csvtojson": "^2.0.14", diff --git a/frontend/public/src/vote.js b/frontend/public/src/vote.js index b7f82f3..087e3ec 100644 --- a/frontend/public/src/vote.js +++ b/frontend/public/src/vote.js @@ -1,3 +1,26 @@ +const adOverlay = document.getElementById('thank-you-message'); +const content = document.getElementById('content'); +let adTimeout; + +function closeAd() { + clearTimeout(adTimeout); + adOverlay.style.display = 'none'; + adOverlay.setAttribute('aria-hidden', 'true'); + content.style.visibility = 'visible'; + document.querySelectorAll('.emoji').forEach(button => button.classList.remove('selected')); +} + +function showAd(duration, hideContent = false) { + clearTimeout(adTimeout); + adOverlay.style.display = 'block'; + adOverlay.setAttribute('aria-hidden', 'false'); + content.style.visibility = hideContent ? 'hidden' : 'visible'; + adTimeout = setTimeout(closeAd, duration); +} + +document.getElementById('on-vote-ad-button').addEventListener('click', () => showAd(10000)); +document.getElementById('close-ad-button').addEventListener('click', closeAd); + document.querySelectorAll('.emoji').forEach(button => { button.addEventListener('click', () => { const category = button.getAttribute('data-category'); @@ -14,13 +37,7 @@ document.querySelectorAll('.emoji').forEach(button => { .then(response => response.json()) .then(data => { console.log('Success:', data); - document.getElementById('thank-you-message').style.display = 'block'; - document.getElementById('content').style.visibility = 'hidden'; - setTimeout(() => { - document.getElementById('thank-you-message').style.display = 'none'; - document.getElementById('content').style.visibility = 'visible'; - document.querySelectorAll('.emoji').forEach(button => button.classList.remove('selected')); - }, 2500); + showAd(4000, true); }) .catch((error) => { console.error('Error:', error); diff --git a/frontend/public/style.css b/frontend/public/style.css index 0a55562..7459768 100644 --- a/frontend/public/style.css +++ b/frontend/public/style.css @@ -90,9 +90,98 @@ button.selected { #thank-you-message { display: none; - margin-top: 0px; - font-size: 2rem; - color: lime; + position: fixed; + inset: 0; + z-index: 1000; + background: #000; +} + +#thank-you-message img { + width: 100%; + height: 100%; + object-fit: contain; + display: block; +} + +.on-vote-ad-button { + padding: 0; + border: 0; + border-radius: 0; + background: transparent; + box-shadow: none; + cursor: pointer; + animation: ad-press 4s ease-in-out infinite; +} + +.on-vote-ad-button img { + display: block; +} + +.on-vote-ad-button:active { + transform: scale(0.95); +} + +.ad-attention-circle { + position: fixed; + left: 50%; + bottom: -44px; + width: 88px; + height: 88px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.45); + pointer-events: none; + z-index: 10; + animation: ad-circle-flight 4s ease-in-out infinite; +} + +@keyframes ad-circle-flight { + 0%, 12% { + transform: translateX(-50%) scale(0.3); + opacity: 0; + } + 20% { + transform: translateX(-50%) scale(1); + opacity: 1; + } + 55% { + transform: translate(calc(-50% - 21vw), -210px) scale(1); + opacity: 0.8; + } + 75% { + transform: translate(calc(-50% - 39vw), -105px) scale(0.3); + opacity: 0; + } + 100% { + transform: translate(calc(-50% - 39vw), -105px) scale(0.3); + opacity: 0; + } +} + +@keyframes ad-press { + 0%, 65%, 100% { + transform: scale(1); + } + 75% { + transform: scale(0.84); + } + 84% { + transform: scale(1.04); + } +} + +.close-ad-button { + position: absolute; + top: 24px; + right: 24px; + width: 64px; + height: 64px; + padding: 0; + border-radius: 50%; + background: rgba(0, 0, 0, 0.7); + color: white; + font-size: 3rem; + line-height: 1; + cursor: pointer; } table { @@ -196,4 +285,4 @@ margin-top: 125px; /* Abstand zur Überschrift */ font-size: 2rem; font-weight: bold; margin: 0; -} \ No newline at end of file +} diff --git a/frontend/public/vote.html b/frontend/public/vote.html index dbde244..42f75fe 100644 --- a/frontend/public/vote.html +++ b/frontend/public/vote.html @@ -66,6 +66,9 @@ - + + - \ No newline at end of file +