|
|
@ -11,6 +11,7 @@ var sankoreLang = { |
|
|
|
pad: "Планшет" |
|
|
|
pad: "Планшет" |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//main function
|
|
|
|
//main function
|
|
|
|
function start(){ |
|
|
|
function start(){ |
|
|
|
|
|
|
|
|
|
|
@ -45,7 +46,16 @@ function start(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$("#wgt_reload").click(function(){ |
|
|
|
$("#wgt_reload").click(function(){ |
|
|
|
window.location.reload(); |
|
|
|
if($("#wgt_display").hasClass("selected")){ |
|
|
|
|
|
|
|
$("#wgt_edit").trigger("click"); |
|
|
|
|
|
|
|
$("#wgt_display").trigger("click"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$("#wgt_display").trigger("click"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){ |
|
|
|
|
|
|
|
exportData(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(".style_select").change(function (event){ |
|
|
|
$(".style_select").change(function (event){ |
|
|
@ -67,7 +77,7 @@ function start(){ |
|
|
|
var imgs_container = container.find(".imgs_cont"); |
|
|
|
var imgs_container = container.find(".imgs_cont"); |
|
|
|
|
|
|
|
|
|
|
|
container.find(".text_cont .audio_desc").removeAttr("contenteditable"); |
|
|
|
container.find(".text_cont .audio_desc").removeAttr("contenteditable"); |
|
|
|
container.find(".text_cont").removeAttr("ondragenter") |
|
|
|
container.find(".audio_block").removeAttr("ondragenter") |
|
|
|
.removeAttr("ondragleave") |
|
|
|
.removeAttr("ondragleave") |
|
|
|
.removeAttr("ondragover") |
|
|
|
.removeAttr("ondragover") |
|
|
|
.removeAttr("ondrop") |
|
|
|
.removeAttr("ondrop") |
|
|
@ -105,10 +115,10 @@ function start(){ |
|
|
|
.addClass("imgs_answers_gray") |
|
|
|
.addClass("imgs_answers_gray") |
|
|
|
.sortable("destroy"); |
|
|
|
.sortable("destroy"); |
|
|
|
container.find(".text_cont .audio_desc").attr("contenteditable","true"); |
|
|
|
container.find(".text_cont .audio_desc").attr("contenteditable","true"); |
|
|
|
container.find(".text_cont").attr("ondragenter", "return false;") |
|
|
|
container.find(".audio_block").attr("ondragenter", "return false;") |
|
|
|
.attr("ondragleave", "$(this).removeClass('gray'); return false;") |
|
|
|
.attr("ondragleave", "$(this).removeClass('audio_gray'); return false;") |
|
|
|
.attr("ondragover", "$(this).addClass('gray'); return false;") |
|
|
|
.attr("ondragover", "$(this).addClass('audio_gray'); return false;") |
|
|
|
.attr("ondrop", "$(this).removeClass('gray'); return onDropAudio(this,event);"); |
|
|
|
.attr("ondrop", "$(this).removeClass('audio_gray'); return onDropAudio(this,event);"); |
|
|
|
container.find(".img_block").remove(); |
|
|
|
container.find(".img_block").remove(); |
|
|
|
$("<div class='audio_answer' contenteditable>" + container.find(".imgs_cont input").val() + "</div>").appendTo(container.find(".imgs_cont")); |
|
|
|
$("<div class='audio_answer' contenteditable>" + container.find(".imgs_cont input").val() + "</div>").appendTo(container.find(".imgs_cont")); |
|
|
|
});
|
|
|
|
});
|
|
|
@ -218,6 +228,7 @@ function exportData(){ |
|
|
|
cont_obj.text = $(this).find(".audio_desc").text(); |
|
|
|
cont_obj.text = $(this).find(".audio_desc").text(); |
|
|
|
cont_obj.audio = $(this).find("source").attr("src").replace("../../",""); |
|
|
|
cont_obj.audio = $(this).find("source").attr("src").replace("../../",""); |
|
|
|
cont_obj.answer = $(this).find(".audio_answer").text(); |
|
|
|
cont_obj.answer = $(this).find(".audio_answer").text(); |
|
|
|
|
|
|
|
cont_obj.cur_answer = "";
|
|
|
|
array_to_export.push(cont_obj); |
|
|
|
array_to_export.push(cont_obj); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -226,10 +237,15 @@ function exportData(){ |
|
|
|
cont_obj.text = $(this).find(".audio_desc").text(); |
|
|
|
cont_obj.text = $(this).find(".audio_desc").text(); |
|
|
|
cont_obj.audio = $(this).find("source").attr("src").replace("../../",""); |
|
|
|
cont_obj.audio = $(this).find("source").attr("src").replace("../../",""); |
|
|
|
cont_obj.answer = $(this).find(".imgs_cont input").val();
|
|
|
|
cont_obj.answer = $(this).find(".imgs_cont input").val();
|
|
|
|
|
|
|
|
cont_obj.cur_answer = getAnswer($(this).find(".imgs_cont")); |
|
|
|
array_to_export.push(cont_obj); |
|
|
|
array_to_export.push(cont_obj); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
sankore.setPreference("associer_sound", JSON.stringify(array_to_export)); |
|
|
|
sankore.setPreference("associer_sound", JSON.stringify(array_to_export)); |
|
|
|
|
|
|
|
if($("#wgt_display").hasClass("selected")) |
|
|
|
|
|
|
|
sankore.setPreference("associer_sound_state", "display"); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
sankore.setPreference("associer_sound_state", "edit"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//import
|
|
|
|
//import
|
|
|
@ -253,16 +269,31 @@ function importData(data){ |
|
|
|
$("<input type='hidden'/>").appendTo(audio_block); |
|
|
|
$("<input type='hidden'/>").appendTo(audio_block); |
|
|
|
$("<div class='audio_desc'>" + data[i].text + "</div>").appendTo(text); |
|
|
|
$("<div class='audio_desc'>" + data[i].text + "</div>").appendTo(text); |
|
|
|
$("<input type='hidden' value='" + data[i].answer + "'/>").appendTo(imgs_container); |
|
|
|
$("<input type='hidden' value='" + data[i].answer + "'/>").appendTo(imgs_container); |
|
|
|
for(var j in data[i].answer){ |
|
|
|
if(data[i].cur_answer) |
|
|
|
var tmp_letter = $("<div class='img_block' style='text-align: center;'>" + data[i].answer[j] + "</div>"); |
|
|
|
for(var j in data[i].cur_answer){ |
|
|
|
tmp_array.push(tmp_letter); |
|
|
|
var tmp_letter = $("<div class='img_block' style='text-align: center;'>" + data[i].cur_answer[j] + "</div>"); |
|
|
|
}
|
|
|
|
tmp_array.push(tmp_letter); |
|
|
|
tmp_array = shuffle(tmp_array); |
|
|
|
}
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
for(j in data[i].answer){ |
|
|
|
|
|
|
|
tmp_letter = $("<div class='img_block' style='text-align: center;'>" + data[i].answer[j] + "</div>"); |
|
|
|
|
|
|
|
tmp_array.push(tmp_letter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(sankore.preference("associer_sound_state","")){ |
|
|
|
|
|
|
|
if(sankore.preference("associer_sound_state","") == "edit") |
|
|
|
|
|
|
|
tmp_array = shuffle(tmp_array); |
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
tmp_array = shuffle(tmp_array); |
|
|
|
|
|
|
|
|
|
|
|
for(j = 0; j<tmp_array.length;j++) |
|
|
|
for(j = 0; j<tmp_array.length;j++) |
|
|
|
tmp_array[j].appendTo(imgs_container); |
|
|
|
tmp_array[j].appendTo(imgs_container); |
|
|
|
imgs_container.sortable( { |
|
|
|
|
|
|
|
update: checkResult |
|
|
|
imgs_container.sortable().bind('sortupdate', function(event, ui) { |
|
|
|
} ); |
|
|
|
checkResult(event); |
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if(data[i].cur_answer) |
|
|
|
|
|
|
|
imgs_container.trigger("sortupdate") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -296,9 +327,9 @@ function showExample(){ |
|
|
|
tmp_array = shuffle(tmp_array); |
|
|
|
tmp_array = shuffle(tmp_array); |
|
|
|
for(var i = 0; i<tmp_array.length;i++) |
|
|
|
for(var i = 0; i<tmp_array.length;i++) |
|
|
|
tmp_array[i].appendTo(imgs_container); |
|
|
|
tmp_array[i].appendTo(imgs_container); |
|
|
|
imgs_container.sortable( { |
|
|
|
imgs_container.sortable().bind('sortupdate', function(event, ui) { |
|
|
|
update: checkResult |
|
|
|
checkResult(event); |
|
|
|
} ); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//check result
|
|
|
|
//check result
|
|
|
@ -457,6 +488,15 @@ function onDropAudio(obj, event) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//get text
|
|
|
|
|
|
|
|
function getAnswer(obj){ |
|
|
|
|
|
|
|
var answer = ""; |
|
|
|
|
|
|
|
obj.find(".img_block").each(function(){ |
|
|
|
|
|
|
|
answer += $(this).text(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return answer; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (window.widget) { |
|
|
|
if (window.widget) { |
|
|
|
window.widget.onremove = function(){ |
|
|
|
window.widget.onremove = function(){ |
|
|
|
$("audio").each(function(){ |
|
|
|
$("audio").each(function(){ |
|
|
|