commit 7e47b63adbd1c62c3f67e378528e42f0008de981
parent 89be92e2949d145d4a12cf07699be806f236725a
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Fri, 23 Oct 2020 08:41:53 -0700
Implement Read method in global.js.
Diffstat:
4 files changed, 15 insertions(+), 41 deletions(-)
diff --git a/js/global.js b/js/global.js
@@ -1,7 +1,6 @@
/**
* Set the app theme.
* @param {Boolean} darkTheme - Whether to use the dark theme. If null, a theme will be automatically chosen.
- * @returns {void}
*/
function SetTheme(darkTheme = null) {
// Get theme from localStorage if null
@@ -36,7 +35,6 @@ function SetTheme(darkTheme = null) {
/**
* Loads the page.
- * @returns {void}
*/
function LoadPage() {
// Add event Listeners
@@ -63,3 +61,17 @@ function getLang(label) {
return "en";
}
}
+
+
+
+/**
+ * Read a peice of text.
+ * @param {String} text - The text to read.
+ * @param {String} label - The language of the text.
+ */
+function Read(text, label)
+{
+ var msg = new SpeechSynthesisUtterance(text);
+ msg.lang = getLang(label);
+ window.speechSynthesis.speak(msg);
+}
diff --git a/js/quizzer.js b/js/quizzer.js
@@ -282,22 +282,3 @@ let quizzer = Vue.component("quizzer", {
</div>
`,
});
-
-
-
-/**
- * Read a peice of text.
- * @param {String} text - The text to read.
- * @param {String} label - The language of the text.
- */
-function Read(text, label)
-{
- var msg = new SpeechSynthesisUtterance(text);
- if (label.toLowerCase().includes("english")) {
- msg.lang = 'en';
- }
- else if (label.toLowerCase().includes("spanish")){
- msg.lang = 'es';
- }
- window.speechSynthesis.speak(msg);
-}
diff --git a/js/reference.js b/js/reference.js
@@ -64,22 +64,3 @@ function setTableHeight() {
var tableY = document.getElementById("referenceTable").offsetTop;
document.getElementById("referenceTable").style.height = `${window.innerHeight - tableY - 50}px`;
}
-
-
-
-/**
- * Read a term.
- * @param {Number} row - The row of the term.
- * @param {Number} column - The column of the term.
- */
-function Read(row, column)
-{
- var msg = new SpeechSynthesisUtterance(app.sets[app.set][row][column]);
- if (app.sets[app.set][0][column].toLowerCase().includes("english")) {
- msg.lang = 'en';
- }
- else if (app.sets[app.set][0][column].toLowerCase().includes("spanish")){
- msg.lang = 'es';
- }
- window.speechSynthesis.speak(msg);
-}
diff --git a/reference.html b/reference.html
@@ -66,7 +66,7 @@
<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>
+ <td v-if="rowIndex !== 0" v-for="(column, columnIndex) in row" @click="Read(column, sets[set][0][columnIndex])" :lang="getLang(sets[set][0][columnIndex])">{{ column }}</td>
</tr>
</table>
</div>