fixed ordre phrase

preferencesAboutTextFull
unknown 13 years ago
parent 96c00f5403
commit 285315c20a
  1. 5
      resources/library/interactivities/Ordre mots.wgt/locales/fr/scripts/template2.js
  2. 5
      resources/library/interactivities/Ordre mots.wgt/locales/ru/scripts/template2.js
  3. 5
      resources/library/interactivities/Ordre mots.wgt/scripts/template2.js
  4. 54
      resources/library/interactivities/Ordre phrase.wgt/locales/fr/script/template2.js
  5. 50
      resources/library/interactivities/Ordre phrase.wgt/locales/ru/script/template2.js
  6. 48
      resources/library/interactivities/Ordre phrase.wgt/scripts/template2.js

@ -106,10 +106,7 @@ $(document).ready(function(){
// create new set of letters
var letters;
if(window.sankore && curWord && !editMode)
letters = createWordLetters( curWord );
else
letters = shuffle( createWordLetters( word ) );
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );

@ -106,10 +106,7 @@ $(document).ready(function(){
// create new set of letters
var letters;
if(window.sankore && curWord && !editMode)
letters = createWordLetters( curWord );
else
letters = shuffle( createWordLetters( word ) );
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );

@ -104,10 +104,7 @@ $(document).ready(function(){
// create new set of letters
var letters;
if(window.sankore && curWord && !editMode)
letters = createWordLetters( curWord );
else
letters = shuffle( createWordLetters( word ) );
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );

@ -28,11 +28,11 @@ function checkResponse()
var sankoreLang = {
view: "Afficher",
edit: "Modifier",
example: "Cette phrase\nest un\nexemple",
example: "Cette phrase\nest un\nexample",
wgt_name: "Ordonner des phrases",
reload: "Recharger",
slate: "Ardoise",
pad: "Tablette"
slate: "Bois",
pad: "Pad"
};
@ -53,6 +53,8 @@ var phrases = [];
var editMode = false; // just a flag
var wgtState = false; // just another flag
// if use the "edit" button or rely on the api instead
var isSankore = false;
// whether to do window.resize or not (window = widget area)
@ -92,19 +94,39 @@ $(document).ready(function(){
}
});
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload).click(function(){
window.location.reload();
if(wgtState)
$("#wgt_display").trigger("click");
else
{
$( "#mp_word" ).empty();
var phrases;
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
$( "#mp_word" ).sortable();
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
}
});
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$( "#mp_word textarea" ).live("change", function(){
saveData();
})
})
function str_replace( w, b, s ){
@ -226,6 +248,8 @@ function modeView()
sentence = p2.join( "\n" );
}
wgtState = false;
// clean the previous word
$( "#mp_word" ).empty();
@ -248,7 +272,9 @@ function modeView()
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
$( "#mp_word" ).sortable();
checkSentence();
}
/*
@ -259,14 +285,14 @@ modeEdit
function modeEdit()
{
editMode = true;
// if no sankore api, insert ok button
wgtState = true;
$( "#mp_word").css( "margin-left", 0 ).empty()
.append('<textarea cols="50" rows="5">'+sentence+'</textarea>');
}
function saveData() {
if (window.widget) {
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val())
{
@ -275,7 +301,7 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
modeEdit();
}
@ -284,7 +310,7 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
}
sankore.setPreference("rightOrdPhrases", sentence);

@ -53,6 +53,8 @@ var phrases = [];
var editMode = false; // just a flag
var wgtState = false; // just another flag
// if use the "edit" button or rely on the api instead
var isSankore = false;
// whether to do window.resize or not (window = widget area)
@ -92,19 +94,39 @@ $(document).ready(function(){
}
});
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload).click(function(){
window.location.reload();
if(wgtState)
$("#wgt_display").trigger("click");
else
{
$( "#mp_word" ).empty();
var phrases;
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
$( "#mp_word" ).sortable();
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
}
});
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$( "#mp_word textarea" ).live("change", function(){
saveData();
})
})
function str_replace( w, b, s ){
@ -226,6 +248,8 @@ function modeView()
sentence = p2.join( "\n" );
}
wgtState = false;
// clean the previous word
$( "#mp_word" ).empty();
@ -248,7 +272,9 @@ function modeView()
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
$( "#mp_word" ).sortable();
checkSentence();
}
/*
@ -259,14 +285,14 @@ modeEdit
function modeEdit()
{
editMode = true;
// if no sankore api, insert ok button
wgtState = true;
$( "#mp_word").css( "margin-left", 0 ).empty()
.append('<textarea cols="50" rows="5">'+sentence+'</textarea>');
}
function saveData() {
if (window.widget) {
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val())
{
@ -275,7 +301,7 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
modeEdit();
}
@ -284,9 +310,9 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
}
sankore.setPreference("rightOrdPhrases", sentence);
}
}
}

@ -54,6 +54,8 @@ var phrases = [];
var editMode = false; // just a flag
var wgtState = false; // just another flag
// if use the "edit" button or rely on the api instead
var isSankore = false;
// whether to do window.resize or not (window = widget area)
@ -93,19 +95,39 @@ $(document).ready(function(){
}
});
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload).click(function(){
window.location.reload();
if(wgtState)
$("#wgt_display").trigger("click");
else
{
$( "#mp_word" ).empty();
var phrases;
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
$( "#mp_word" ).sortable();
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
}
});
$(".style_select option[value='1']").text(sankoreLang.slate);
$(".style_select option[value='2']").text(sankoreLang.pad);
$(".style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$( "#mp_word textarea" ).live("change", function(){
saveData();
})
})
function str_replace( w, b, s ){
@ -227,6 +249,8 @@ function modeView()
sentence = p2.join( "\n" );
}
wgtState = false;
// clean the previous word
$( "#mp_word" ).empty();
@ -249,7 +273,9 @@ function modeView()
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
$( "#mp_word" ).sortable();
checkSentence();
}
/*
@ -260,14 +286,14 @@ modeEdit
function modeEdit()
{
editMode = true;
// if no sankore api, insert ok button
wgtState = true;
$( "#mp_word").css( "margin-left", 0 ).empty()
.append('<textarea cols="50" rows="5">'+sentence+'</textarea>');
}
function saveData() {
if (window.widget) {
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $(".style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val())
{
@ -276,7 +302,7 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
modeEdit();
}
@ -285,7 +311,7 @@ function saveData() {
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
}
sankore.setPreference("rightOrdPhrases", sentence);

Loading…
Cancel
Save