var sankoreLang = { display: "Display", edit: "Edit", first_desc: "Fruits", second_desc: "Vegetables", potatoes: "Potato", carrot: "Carrot", onion: "Onion", apple: "Apple", pear: "Pear", enter: "Enter a category name here ...", add: "Add new block", text: "Some text" }; //main function function start(){ $("#display_text").text(sankoreLang.display); $("#edit_text").text(sankoreLang.edit); if(window.sankore){ if(sankore.preference("categoriser_text","")){ var data = jQuery.parseJSON(sankore.preference("categoriser_text","")); importData(data); } else { showExample(); } } else showExample(); if (window.widget) { window.widget.onleave = function(){ exportData(); } } $("#display, #edit").click(function(event){ if(this.id == "display"){ if(!$(this).hasClass("selected")){ $(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_right = ""; var tmp_array = []; container.find(".close_cont").remove(); container.find(".imgs_cont").each(function(){ $(this).find(".del_category").remove(); $(this).find(".add_img").remove(); $(this).find(".add_category").remove(); $(this).removeAttr("ondragenter") .removeAttr("ondragleave") .removeAttr("ondragover") .removeAttr("ondrop") .find(".cat_desc").attr("disabled","disabled"); var tmp_count = $(this).find(".img_block").size(); $(this).find("input[name='count']").val(tmp_count); $(this).find(".img_block").each(function(){ $(this).find(".close_img").remove(); var tmp_text = $(this).find(".text_cont"); tmp_text.removeAttr("contenteditable") .css("margin", ($(this).height() - tmp_text.height())/2 + "px 0px"); tmp_array.push($(this)); $(this).remove(); }); $(this).droppable({ hoverClass: 'dropHere', drop: function(event, ui) { if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ var tmp_ui = $(ui.draggable).parent(); checkOnDrop($(this), $(ui.draggable)); checkCorrectness(tmp_ui); } } }); $(this).removeAttr("style"); }); var all_imgs = $("