var sankoreLang = { display: "Afficher", edit: "Modifier", short_desc: "Ecoutez le son et replacer les lettres dans l'ordre.", add: "Nouveau bloc", enter: "Saisir la consigne ici ...", example: "exemple", wgt_name: "Ordonner les lettres", reload: "Recharger", slate: "Bois", pad: "Pad" }; //main function function start(){ $("#wgt_display").text(sankoreLang.display); $("#wgt_edit").text(sankoreLang.edit); $("#wgt_name").text(sankoreLang.wgt_name); $("#wgt_reload").text(sankoreLang.reload); $(".style_select option[value='1']").text(sankoreLang.slate); $(".style_select option[value='2']").text(sankoreLang.pad); if(window.sankore){ if(sankore.preference("associer_sound","")){ var data = jQuery.parseJSON(sankore.preference("associer_sound","")); importData(data); } else showExample(); if(sankore.preference("ord_let_style","")){ changeStyle(sankore.preference("ord_let_style","")); $(".style_select").val(sankore.preference("ord_let_style","")); } else changeStyle(1) } else showExample(); //events if (window.widget) { window.widget.onleave = function(){ exportData(); sankore.setPreference("ord_let_style", $(".style_select").find("option:selected").val()); } } $("#wgt_reload").click(function(){ window.location.reload(); }); $(".style_select").change(function (event){ changeStyle($(this).find("option:selected").val()); }) $("#wgt_display, #wgt_edit").click(function(event){ if(this.id == "wgt_display"){ if(!$(this).hasClass("selected")){ if(window.sankore) sankore.enableDropOnWidget(false); $(this).addClass("selected"); $("#wgt_edit").removeClass("selected"); $(".style_select").css("display","none"); $(".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 = $("