<script>
document.body.classList.add('lock-scroll');
let countdown = 15;
const button = document.getElementById('continueButton');
const overlay = document.getElementById('loadingOverlay');
const interval = setInterval(() => {
countdown--;
button.textContent = `Start in ${countdown}s`;
if (countdown <= 0) {
clearInterval(interval);
button.textContent = "Starten";
button.disabled = false;
button.style.backgroundColor = "#28a745";
button.style.cursor = "pointer";
}
}, 1000);
button.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
overlay.style.display = 'none';
document.body.classList.remove('lock-scroll');
});
var countdown = 30;
var countdownDisplay;
var countdownTimer;
// "submit0" is the default Next/Weiter button in SoSci Survey
var buttonID = "submit0";
function countdownStart() {
var button = document.getElementById(buttonID);
// Create countdown display placeholder
countdownDisplay = document.createElement("div");
var cd = countdownDisplay;
cd.style.display = "inline-block";
cd.style.textAlign = "center";
cd.style.fontWeight = "bold";
cd.style.backgroundColor = "#ccc";
cd.style.color = "#666";
cd.style.borderRadius = "5px";
cd.style.padding = "10px";
cd.style.width = button.offsetWidth + "px";
cd.style.height = button.offsetHeight + "px";
cd.style.lineHeight = button.offsetHeight + "px";
// Add countdown display to page
button.parentNode.appendChild(countdownDisplay);
// Hide actual button
button.style.display = "none";
// Start countdown
countdownRefresh();
countdownTimer = window.setInterval(countDown, 30000);
}
function countDown() {
if (countdown > 1) {
countdown--;
countdownRefresh();
} else {
window.clearTimeout(countdownTimer);
var button = document.getElementById(buttonID);
button.style.display = "";
button.parentNode.removeChild(countdownDisplay);
}
}
function countdownRefresh() {
countdownDisplay.textContent = "Please wait " + countdown + " sec...";
}
SoSciTools.attachEvent(window, "load", countdownStart);
</script>
https://www.soscisurvey.de/sfv_media/?act=Khkb76wFSlnTWGOKhgXf7Q5n
I have tried combining them both but the outcome is worse and I am not sure why. The weiter button doesnt go away and have a countdown in its place