From 6acbeae3580e6ffdb94d6ac42cf83c57ae2f531e Mon Sep 17 00:00:00 2001 From: "Felix W. Dekker" Date: Tue, 28 Jan 2020 10:24:22 +0100 Subject: [PATCH] Add debug statements --- index.html | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 76a5b9a..194e079 100644 --- a/index.html +++ b/index.html @@ -401,6 +401,10 @@ const centuryInput = new class extends ValidatableInput { isValid(value) { + console.log("# Validate century"); + console.log(`Input: ${value}`); + console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`); + console.log(`Expected: ${quizDate.getCenturyAnchorString()}`); return DoomsdayDate.expandDayString(value) === quizDate.getCenturyAnchorString(); } @@ -419,6 +423,10 @@ }($("#century-input"), $("#century-title-label"), $("#century-submit")); const yearInput = new class extends ValidatableInput { isValid(value) { + console.log("# Validate year"); + console.log(`Input: ${value}`); + console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`); + console.log(`Expected: ${quizDate.getYearAnchorString()}`); return DoomsdayDate.expandDayString(value) === quizDate.getYearAnchorString(); } @@ -437,6 +445,10 @@ }($("#year-input"), $("#year-title-label"), $("#year-submit")); const dayInput = new class extends ValidatableInput { isValid(value) { + console.log("# Validate day"); + console.log(`Input: ${value}`); + console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`); + console.log(`Expected: ${quizDate.getWeekdayString()}`); return DoomsdayDate.expandDayString(value) === quizDate.getWeekdayString(); } @@ -455,7 +467,11 @@ }($("#day-input"), $("#day-title-label"), $("#day-submit")); const resetButton = $("#reset-button"); - resetButton.addEventListener("click", () => reloadQuiz()); + resetButton.addEventListener("click", () => { + console.log(" "); + console.log(" "); + reloadQuiz(); + }); /** @@ -463,6 +479,13 @@ */ function reloadQuiz() { quizDate = DoomsdayDate.random(); + console.log("# Reset"); + console.log(`New date: ${quizDate.date.toISOString().substr(0, 10)}`); + console.log(`Century#: ${quizDate.getCentury()}`); + console.log(`Century: ${quizDate.getCenturyAnchorString()}`); + console.log(`Year: ${quizDate.getYearAnchorString()}`); + console.log(`Day: ${quizDate.getWeekdayString()}`); + centuryInput.reset(); yearInput.reset(); dayInput.reset();