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 4fe96fc2de16e65a1333e0094330b69db1c92b76
parent 35e8dbd58abb2127b256e9ffcc7ebc9790fd6be4
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Sun, 11 Oct 2020 15:16:23 -0700

Replace == operator with ===.

Diffstat:
Mindex.html | 10+++++-----
Mjs/quizzer.js | 10+++++-----
Mjs/settings.js | 22+++++++++++-----------
Mreference.html | 6+++---
4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/index.html b/index.html @@ -28,7 +28,7 @@ <h1 id="jsError">You must have JavaScript enabled to run Spanish-Quizzer.</h1> </noscript> - <div id="home" v-show="state == 'home'" hidden> + <div id="home" v-show="state === 'home'" hidden> <h1>What do you want to study?</h1> <div> @@ -42,8 +42,8 @@ </div> - <div id="settings" v-show="state == 'verbSettings' || state == 'vocabSettings'" hidden> - <div id="verbSettings" v-show="state == 'verbSettings'"> + <div id="settings" v-show="state === 'verbSettings' || state === 'vocabSettings'" hidden> + <div id="verbSettings" v-show="state === 'verbSettings'"> <h1>Choose your settings and then click start.</h1> <h2> @@ -76,7 +76,7 @@ </div> - <div id="vocabSettings" v-show="state == 'vocabSettings'"> + <div id="vocabSettings" v-show="state === 'vocabSettings'"> <h1>Choose your settings and then click start.</h1> <h2> @@ -167,7 +167,7 @@ </div> - <quizzer id="quizzer" v-show="state == 'verbQuizzer' || state == 'vocabQuizzer'" :active="state == 'verbQuizzer' || state == 'vocabQuizzer'" hidden + <quizzer id="quizzer" v-show="state === 'verbQuizzer' || state === 'vocabQuizzer'" :active="state === 'verbQuizzer' || state === 'vocabQuizzer'" hidden :starting-index="promptIndex" :starting-prompts="prompts" @new-prompt="updateProgress" :prompt-type="promptType" :input-type="inputType" :repeat-prompts="repeatPrompts"> </quizzer> diff --git a/js/quizzer.js b/js/quizzer.js @@ -73,7 +73,7 @@ let quizzer = Vue.component("quizzer", { // Get new prompt this.index++; - if (this.index == this.prompts.length) { + if (this.index === this.prompts.length) { // The user just finished this.prompts = Shuffle(this.prompts); this.index = 0; @@ -87,12 +87,12 @@ let quizzer = Vue.component("quizzer", { this.responce = ""; // Read prompt - if (this.promptType != "Text") { + if (this.promptType !== "Text") { Read(this.prompt[1], this.prompt[0]); } // Get voice input - if (this.inputType != "Text") { + if (this.inputType !== "Text") { // Create recognition object var recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)(); @@ -276,13 +276,13 @@ let quizzer = Vue.component("quizzer", { <section> <label id="quizzerInputType" for="quizzerInput">{{ prompt[2] }}</label> - <input id="quizzerInput" ref="input" type="text" v-model="responce" :readonly="!responceActive || inputType == 'Voice'" + <input id="quizzerInput" ref="input" type="text" v-model="responce" :readonly="!responceActive || inputType === 'Voice'" @keyup.ctrl.enter.exact="Reset();" @keyup.enter.exact="Enter();" :lang="getLang(prompt[2])" autocomplete="off" spellcheck="false" autocorrect="off" placeholder="Type the answer"> </section> <div id="quizzerButtons"> - <button v-if="responceActive" :disabled="inputType == 'Voice'" @click="Submit();">Submit</button> + <button v-if="responceActive" :disabled="inputType === 'Voice'" @click="Submit();">Submit</button> <button v-else @click="Continue();">Continue</button> <button @click="Reset();">Skip</button> </div> diff --git a/js/settings.js b/js/settings.js @@ -3,7 +3,7 @@ */ function CreateSession() { // Get prompts - if (app.state == "vocabSettings") { + if (app.state === "vocabSettings") { // Filter and load Sets into prompts app.prompts = []; for (let filter of app.vocabFilters) @@ -15,7 +15,7 @@ function CreateSession() { // Shuffle prompts app.prompts = Shuffle(app.prompts); } - else if (app.state == "verbSettings") { + else if (app.state === "verbSettings") { // Get prompts app.prompts = Shuffle(ApplyVerbFilter(Sets["Verbs"], app.verbFilters)); } @@ -49,10 +49,10 @@ function CreateSession() { function ResumeSession() { // Get localStorage prefix let prefix; - if (app.state == "vocabSettings") { + if (app.state === "vocabSettings") { prefix = "vocab-" } - else if (app.state == "verbSettings") { + else if (app.state === "verbSettings") { prefix = "verb-" } @@ -92,7 +92,7 @@ function StartSession() { if (!app.prompts) { throw "Bad arguments."; } - else if (app.prompts.length == 0) { + else if (app.prompts.length === 0) { throw "Terms is empty."; } else if (isNaN(app.promptIndex) || app.promptIndex < 0 || app.promptIndex >= app.prompts.length) { @@ -100,7 +100,7 @@ function StartSession() { } // Validate browser for voice input - if (app.inputType != "Text") { + if (app.inputType !== "Text") { if (typeof InstallTrigger !== "undefined") { // Browser is Firefox alert("You must enable speech recognition in about:config."); @@ -113,17 +113,17 @@ function StartSession() { } // Give iOS devices ringer warning for prompt audio - if (app.promptType != "Text") { + if (app.promptType !== "Text") { if (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)) { alert("Please make sure your ringer is on in order to hear audio prompts."); } } // Show and hide elements (also enables the quizzer) - if (app.state == "verbSettings") { + if (app.state === "verbSettings") { app.state = "verbQuizzer"; } - else if (app.state == "vocabSettings") { + else if (app.state === "vocabSettings") { app.state = "vocabQuizzer"; } } @@ -192,7 +192,7 @@ function ApplyVerbFilter(terms, filterInfo) { // Expand "All Tenses" filters let filters = []; // Format: [{tense:"specific tense", subject:"specific subject", type:"regex"}] for (let filter of filterInfo) { - if (filter.tense.toLowerCase() == "all tenses") { + if (filter.tense.toLowerCase() === "all tenses") { filters.push({ tense: "present participles", type: filter.type, subject: filter.subject, direction: filter.direction }); filters.push({ tense: "present tense", type: filter.type, subject: filter.subject, direction: filter.direction }); filters.push({ tense: "preterite tense", type: filter.type, subject: filter.subject, direction: filter.direction }); @@ -205,7 +205,7 @@ function ApplyVerbFilter(terms, filterInfo) { // Expand "All Subjects" filters for (let filter of filters) { - if (filter.subject.toLowerCase() == "all subjects" && filter.tense != "present participles") { + if (filter.subject.toLowerCase() === "all subjects" && filter.tense !== "present participles") { filter.subject = "yo"; filters.push({ tense: filter.tense, type: filter.type, subject: "tú", direction: filter.direction }); filters.push({ tense: filter.tense, type: filter.type, subject: "él", direction: filter.direction }); diff --git a/reference.html b/reference.html @@ -59,9 +59,9 @@ <div id="referenceTable" hidden> <table> - <tr v-for="(row, rowIndex) in sets[set]" v-show="rowIndex == 0 || row.join(',').toLowerCase().includes(query.toLowerCase())"> - <th v-if="rowIndex == 0" v-for="column in row">{{ column }}</th> - <td v-if="rowIndex != 0" v-for="(column, columnIndex) in row" @click="Read(rowIndex, columnIndex)" :lang="getLang(sets[set][0][columnIndex])">{{ column }}</td> + <tr v-for="(row, rowIndex) in sets[set]" v-show="rowIndex === 0 || row.join(',').toLowerCase().includes(query.toLowerCase())"> + <th v-if="rowIndex === 0" v-for="column in row">{{ column }}</th> + <td v-if="rowIndex !== 0" v-for="(column, columnIndex) in row" @click="Read(rowIndex, columnIndex)" :lang="getLang(sets[set][0][columnIndex])">{{ column }}</td> </tr> </table> </div>