var sankoreLang = { display: "Display", edit: "Edit", short_desc: "Select the number \"three\".", add: "Add new block", enter: "Enter what to do here..." }; //main function function start(){ $("#display_text").text(sankoreLang.display); $("#edit_text").text(sankoreLang.edit); if(window.sankore){ if(sankore.preference("associer","")){ var data = jQuery.parseJSON(sankore.preference("associer","")); 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")){ 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_i = 0; var tmp_array = []; container.find(".text_cont").removeAttr("contenteditable"); container.find(".add_img").remove(); container.find(".close_cont").remove(); container.find(".img_block").each(function(){ if($(this).find("img").attr("src") != "img/drop_img.png"){ $(this).find(".close_img").remove(); $(this).find(".clear_img").remove(); $(this).find(".true_img").remove(); $(this).find(".false_img").remove(); $(this).removeAttr("ondragenter") .removeAttr("ondragleave") .removeAttr("ondragover") .removeAttr("ondrop") .addClass("img_gray"); } else $(this).remove(); }); var img_answers = $("
").insertAfter(container.find(".sub_cont")); container.find(".img_block").each(function(){ $(this).css("float",""); tmp_array.push($(this)); }); tmp_array = shuffle(tmp_array); for(var i = 0; i