spanish-quizzer

An app to quiz you on Spanish vocabulary and verb conjugations
git clone https://git.ashermorgan.net/spanish-quizzer/
Log | Files | Refs | README

commit 93230526d87c2b83648ca268caf79b113a957733
parent c7253636c966d3ac168ef6088e1ca15b67715536
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Fri,  5 Jun 2020 08:30:49 -0700

Fix validation bug in resume method.

Diffstat:
MScripts/Quizzer.js | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Scripts/Quizzer.js b/Scripts/Quizzer.js @@ -83,12 +83,21 @@ function Resume() { } } + // Validate browser for voice input + if (document.getElementById("settingsInputType").value != "Text") { + if (!window.chrome || (!window.chrome.webstore && !window.chrome.runtime)) { + // Browser is not Googole Chrome or Microsoft (Chromium) Edge + alert("Your browser does not support voice input."); + return; + } + } + // Load terms and progress Terms = JSON.parse(localStorage.getItem("terms")); Term = parseInt(localStorage.getItem("term")) - 1; // Validate Terms - if (!Terms || Terms.length == 0 || !Term || Term < -1 || Term > Terms.length) { + if (!Terms || Terms.length == 0 || isNaN(Term) || Term < -1 || Term > Terms.length) { document.getElementById("settingsError").textContent = "An error occured while resuming the previous session."; document.getElementById("settingsError").scrollIntoView(false); return;