fixed 'Separe phrase' app

preferencesAboutTextFull
maximXbs 12 years ago
parent c55f57477b
commit ba1a392cad
  1. 17
      resources/library/interactivities/Separe phrase.wgt/scripts/app.js

@ -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()
// 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()
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()
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()
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" );
} }

Loading…
Cancel
Save