Skip to content

Commit

Permalink
Modularize words DB
Browse files Browse the repository at this point in the history
  • Loading branch information
vonBarbarosa committed Feb 21, 2016
1 parent 3cf0ca3 commit 24c6c3e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ <h1 class="text-center"> Forca Fonética</h1>

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>


<script type="text/javascript" src="js/wordsDB.js"></script>
<script type="text/javascript" src="js/functions.js"></script>
<script type="text/javascript">
app.init();
Expand Down
43 changes: 0 additions & 43 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,6 @@ var currentWord = {
answered: []
};

var wordsDB = [
{
//agora a.ˈgɔ.rə
id: 0,
ortography : "agora",
phonology : ["a.'gɔ.ɾə"]
},
{
//chamado ʃa.ˈma.dʊ
id: 1,
ortography : "chamado",
phonology : ["ʃa.ˈma.dʊ"]
},
{
//desde ˈdez.dʒɪ
id: 2,
ortography : "desde",
phonology : ["ˈdez.dʒɪ", "ˈdez.dɪ"]
},
{
//colocar koloˈkah
id: 3,
ortography : "colocar",
phonology : ["ko.lo.ˈkah", "ko.lo.ˈkax", "ko.lo.ˈkaɾ", "ko.lo.ˈkaɹ"]
},
{
//contra ˈkõ.tɾə
id: 4,
ortography : "contra",
phonology : ["ˈkõ.tɾə"]
},
{
//deus ˈdeʊ̯s
id: 5,
ortography : "deus",
phonology : ["ˈdeʊ̯s","ˈdeʊ̯ʃ"]
}
];

var app = {

init: function() {
Expand Down Expand Up @@ -144,13 +105,9 @@ phon2str: function(phon_arr){
getNewWord: function(){
currentWord.index++;

//
currentWord.ortography = wordsDB[currentWord.index].ortography;
currentWord.phonology = app.array2phon(wordsDB[currentWord.index].phonology);


//currentWord.phonology = app.array2phon(currentWord.phonology);

//INSIGHT: this part might better be in a separated function for reusability
currentWord.answered = new Array();
for (var i = 0; i < currentWord.phonology[0].length; i++) {
Expand Down
38 changes: 38 additions & 0 deletions js/wordsDB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var wordsDB = [
{
//agora a.ˈgɔ.rə
id: 0,
ortography : "agora",
phonology : ["a.'gɔ.ɾə"]
},
{
//chamado ʃa.ˈma.dʊ
id: 1,
ortography : "chamado",
phonology : ["ʃa.ˈma.dʊ"]
},
{
//desde ˈdez.dʒɪ
id: 2,
ortography : "desde",
phonology : ["ˈdez.dʒɪ", "ˈdez.dɪ"]
},
{
//colocar koloˈkah
id: 3,
ortography : "colocar",
phonology : ["ko.lo.ˈkah", "ko.lo.ˈkax", "ko.lo.ˈkaɾ", "ko.lo.ˈkaɹ"]
},
{
//contra ˈkõ.tɾə
id: 4,
ortography : "contra",
phonology : ["ˈkõ.tɾə"]
},
{
//deus ˈdeʊ̯s
id: 5,
ortography : "deus",
phonology : ["ˈdeʊ̯s","ˈdeʊ̯ʃ"]
}
];

0 comments on commit 24c6c3e

Please sign in to comment.