commit aa149247242d754c4958c75fe0bf89138565e382
parent 46cc7f8cdf3c5b8f224edad8eb5ae070fc7a9832
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Thu, 13 Aug 2020 09:51:28 -0700
Refactor CSV loading in reference tables.
Diffstat:
| M | Scripts/Reference.js | | | 138 | +++++++------------------------------------------------------------------------ |
1 file changed, 12 insertions(+), 126 deletions(-)
diff --git a/Scripts/Reference.js b/Scripts/Reference.js
@@ -23,132 +23,18 @@ function Load() {
// Load CSVs
Sets = [];
- Papa.parse("Vocab/Verbs.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Verbs"] = results.data;
- }
- });
- Papa.parse("Vocab/Adjectives.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Adjectives"] = results.data;
- }
- });
- Papa.parse("Vocab/Adverbs.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Adverbs"] = results.data;
- }
- });
- Papa.parse("Vocab/Prepositions.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Prepositions"] = results.data;
- }
- });
- Papa.parse("Vocab/Transitions.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Transitions"] = results.data;
- }
- });
- Papa.parse("Vocab/Colors.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Colors"] = results.data;
- }
- });
- Papa.parse("Vocab/Days.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Days"] = results.data;
- }
- });
- Papa.parse("Vocab/Months.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Months"] = results.data;
- }
- });
- Papa.parse("Vocab/Questions.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Questions"] = results.data;
- }
- });
- Papa.parse("Vocab/Weather.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Weather"] = results.data;
- }
- });
- Papa.parse("Vocab/Family.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Family"] = results.data;
- }
- });
- Papa.parse("Vocab/Clothes.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Clothes"] = results.data;
- }
- });
- Papa.parse("Vocab/Nature.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Nature"] = results.data;
- }
- });
- Papa.parse("Vocab/House.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["House"] = results.data;
- }
- });
- Papa.parse("Vocab/Vacation.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Vacation"] = results.data;
- }
- });
- Papa.parse("Vocab/Childhood.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Childhood"] = results.data;
- }
- });
- Papa.parse("Vocab/Professions.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Professions"] = results.data;
- }
- });
- Papa.parse("Vocab/Health.csv", {
- download: true,
- complete: function(results) {
- // Set verbs
- Sets["Health"] = results.data;
- }
- });
+ let setNames = ["Verbs", "Adjectives", "Adverbs", "Prepositions", "Transitions",
+ "Colors", "Days", "Months", "Questions", "Weather", "Family", "Clothes",
+ "Nature", "House", "Vacation", "Childhood", "Professions", "Health"];
+ for (let setName of setNames) {
+ Papa.parse(`Vocab/${setName}.csv`, {
+ download: true,
+ complete: function(results) {
+ // Set verbs
+ Sets[setName] = results.data;
+ }
+ });
+ }
}