Add random quiz version selection and update webhook integration

This commit is contained in:
2025-01-30 16:58:41 +02:00
parent f8bb71a184
commit 823c27e5ca
3 changed files with 28 additions and 19 deletions

View File

@@ -31,6 +31,18 @@
</p>
<button id="consentButton">Погоджуюсь з умовами, розпочати тест</button>
<script>
document.getElementById('consentButton').addEventListener('click', function() {
fetch('data/questions.json')
.then(response => response.json())
.then(data => {
const quizVersions = Object.keys(data.quizzes);
const randomVersion = quizVersions[Math.floor(Math.random() * quizVersions.length)];
localStorage.setItem('quizVersion', randomVersion);
window.location.href = 'quiz.html';
});
});
</script>
</div>
</body>
</html>