mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
add post vote ad
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
"start": "node server.js"
|
"start": "node server.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^11.10.0",
|
"better-sqlite3": "^12.10.0",
|
||||||
"body-parser": "^1.20.3",
|
"body-parser": "^1.20.3",
|
||||||
"csv-writer": "^1.6.0",
|
"csv-writer": "^1.6.0",
|
||||||
"csvtojson": "^2.0.14",
|
"csvtojson": "^2.0.14",
|
||||||
|
|||||||
@@ -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 => {
|
document.querySelectorAll('.emoji').forEach(button => {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const category = button.getAttribute('data-category');
|
const category = button.getAttribute('data-category');
|
||||||
@@ -14,13 +37,7 @@ document.querySelectorAll('.emoji').forEach(button => {
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log('Success:', data);
|
console.log('Success:', data);
|
||||||
document.getElementById('thank-you-message').style.display = 'block';
|
showAd(4000, true);
|
||||||
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);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
|
|||||||
@@ -90,9 +90,98 @@ button.selected {
|
|||||||
|
|
||||||
#thank-you-message {
|
#thank-you-message {
|
||||||
display: none;
|
display: none;
|
||||||
margin-top: 0px;
|
position: fixed;
|
||||||
font-size: 2rem;
|
inset: 0;
|
||||||
color: lime;
|
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 {
|
table {
|
||||||
@@ -196,4 +285,4 @@ margin-top: 125px; /* Abstand zur Überschrift */
|
|||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div style="width: 20rem;">
|
<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>
|
||||||
<div style="width: 20rem;">
|
<div style="width: 20rem;">
|
||||||
</div>
|
</div>
|
||||||
@@ -73,7 +76,11 @@
|
|||||||
<img src="/resources/logo.png" alt="Logo" class="logo" height="100" style="margin-top: 40px;">
|
<img src="/resources/logo.png" alt="Logo" class="logo" height="100" style="margin-top: 40px;">
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<script src="src/vote.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user