add post vote ad

This commit is contained in:
Matewoo
2026-09-11 15:11:18 +02:00
parent 4d9d6ab02e
commit 6cceb3f762
4 changed files with 127 additions and 14 deletions
+1 -1
View File
@@ -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",
+24 -7
View File
@@ -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);
+93 -4
View File
@@ -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;
}
}
+9 -2
View File
@@ -66,6 +66,9 @@
</div>
<div class="footer">
<div style="width: 20rem;">
<button id="on-vote-ad-button" class="on-vote-ad-button" type="button" aria-label="Informationen anzeigen">
<img src="/resources/on-vote-ad.png" alt="Informationen anzeigen" height="100" style="margin-top: 40px;">
</button>
</div>
<div style="width: 20rem;">
</div>
@@ -73,7 +76,11 @@
<img src="/resources/logo.png" alt="Logo" class="logo" height="100" style="margin-top: 40px;">
</div>
</div>
<div id="thank-you-message" style="display: none; margin-top: -420px; font-size: 5rem;">Vielen Dank für Ihr Feedback!</div>
<div class="ad-attention-circle" aria-hidden="true"></div>
<div id="thank-you-message" aria-hidden="true">
<img src="/resources/post-vote-ad.png" alt="">
<button id="close-ad-button" class="close-ad-button" type="button" aria-label="Anzeige schließen">×</button>
</div>
<script src="src/vote.js"></script>
</body>
</html>
</html>