Add timer label to quiz and localize text based on version

This commit is contained in:
2025-01-28 04:40:18 +02:00
parent b905c221cc
commit b69ea56b9e
2 changed files with 11 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ document.addEventListener('DOMContentLoaded', function () {
const quizContainer = document.getElementById('quiz');
const resultsContainer = document.getElementById('results');
const timerDisplay = document.getElementById('time');
const timerLabel = document.getElementById('timer-label'); // Add a label for the timer
const version = localStorage.getItem('quizVersion');
const quizId = 'quiz';
let questions = [];
@@ -15,6 +16,13 @@ document.addEventListener('DOMContentLoaded', function () {
let timer;
let startTime = new Date().toISOString();
// Set timer label based on version
if (version === 'ukrainian') {
timerLabel.textContent = 'Час, що залишився:';
} else {
timerLabel.textContent = 'Time remaining:';
}
// Generate and store browser ID
function generateBrowserId() {
return 'xxxx-xxxx-4xxx-yxxx-xxxx-xxxx-xxxx-xxxx'.replace(/[xy]/g, function(c) {