var sankoreLang = { display: "Display", edit: "Edit", short_desc: "Listen to the sound and make the correct word.", add: "Add new block", enter: "Enter your description here ...", example: "example" }; //main function function start(){ $("#display_text").text(sankoreLang.display); $("#edit_text").text(sankoreLang.edit); if(window.sankore){ if(sankore.preference("associer_sound","")){ var data = jQuery.parseJSON(sankore.preference("associer_sound","")); importData(data); } else { showExample(); } } else showExample(); //events if (window.widget) { window.widget.onleave = function(){ exportData(); } } $("#display, #edit").click(function(event){ if(this.id == "display"){ if(!$(this).hasClass("selected")){ if(window.sankore) sankore.enableDropOnWidget(false); $(this).addClass("selected"); $("#display_img").removeClass("red_point").addClass("green_point"); $("#edit_img").removeClass("green_point").addClass("red_point"); $("#edit").removeClass("selected"); $(".add_block").remove(); $(".cont").each(function(){ var container = $(this); var tmp_array = []; var imgs_container = container.find(".imgs_cont"); container.find(".text_cont .audio_desc").removeAttr("contenteditable"); container.find(".text_cont").removeAttr("ondragenter") .removeAttr("ondragleave") .removeAttr("ondragover") .removeAttr("ondrop") container.find(".close_cont").remove(); var answer = imgs_container.find(".audio_answer").text(); imgs_container.find(".audio_answer").remove(); imgs_container.find("input").val(answer); for(var j in answer){ var tmp_letter = $("