Commit ba1a392c authored by maximXbs's avatar maximXbs

fixed 'Separe phrase' app

parent c55f5747
...@@ -18,6 +18,15 @@ function createElements( phrase ) ...@@ -18,6 +18,15 @@ function createElements( phrase )
return s; return s;
} }
function createChain( phrase )
{
var arr = phrase.split(" ");
var result = "";
for( var i = 0; i < arr.length; i++ )
result += '<div class="letterCont">' + createElements(arr[i]) + '</div>';
return result;
}
$(document).ready(function() $(document).ready(function()
{ {
...@@ -135,9 +144,8 @@ $(document).ready(function() ...@@ -135,9 +144,8 @@ $(document).ready(function()
// store the text // store the text
w.setData( "phrase", phrase ); w.setData( "phrase", phrase );
// remove all dots (they are to be set during the exercise) // remove all dots (they are to be set during the exercise)
phrase = phrase.replace( / /g, '' ); //phrase = phrase.replace( / /g, '' );
// create the html // create the html
if(window.sankore && sankore.preference("ordSplPhrasesState", "") == "1" && flag){ if(window.sankore && sankore.preference("ordSplPhrasesState", "") == "1" && flag){
...@@ -147,7 +155,7 @@ $(document).ready(function() ...@@ -147,7 +155,7 @@ $(document).ready(function()
flag = false; flag = false;
} }
else else
w.setViewContent( createElements( phrase ) ); w.setViewContent( createChain( phrase ) );
// the behaviour // the behaviour
...@@ -241,7 +249,7 @@ $(document).ready(function() ...@@ -241,7 +249,7 @@ $(document).ready(function()
if( this.className.indexOf( "fixed" ) != -1 ){ if( this.className.indexOf( "fixed" ) != -1 ){
phrase += ' '; phrase += ' ';
} }
else if( this.className.indexOf( "dash" ) != -1 ){ else if( (this.className.indexOf( "dash" ) != -1) || (this.className.indexOf( "letterCont" ) != -1) ){
return; return;
} }
else{ else{
...@@ -249,7 +257,6 @@ $(document).ready(function() ...@@ -249,7 +257,6 @@ $(document).ready(function()
phrase += ch; phrase += ch;
} }
}); });
//alert(phrase + " | " + this.getData( "phrase" ))
if( phrase == this.getData( "phrase" ) ){ if( phrase == this.getData( "phrase" ) ){
this.elements.containerView.addClass( "answerRight" ); this.elements.containerView.addClass( "answerRight" );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment