From b69ea56b9e375c2d0cb13684454ffed3e4717607 Mon Sep 17 00:00:00 2001 From: Oleh Omelchenko Date: Tue, 28 Jan 2025 04:40:18 +0200 Subject: [PATCH] Add timer label to quiz and localize text based on version --- public/quiz.html | 4 +++- src/js/quiz.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/public/quiz.html b/public/quiz.html index 68bcff7..da9dd9d 100644 --- a/public/quiz.html +++ b/public/quiz.html @@ -12,7 +12,9 @@
-
Time remaining: 25s
+
+ Time remaining: 25s +
diff --git a/src/js/quiz.js b/src/js/quiz.js index 3ab5d36..493585c 100644 --- a/src/js/quiz.js +++ b/src/js/quiz.js @@ -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) {