|
|
@ -130,7 +130,7 @@ function start(){ |
|
|
|
drop: function(event, ui) { |
|
|
|
drop: function(event, ui) { |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
checkOnDrop($(this), $(ui.draggable)); |
|
|
|
$(this).append($(ui.draggable)); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -358,7 +358,7 @@ function importData(data){ |
|
|
|
drop: function(event, ui) { |
|
|
|
drop: function(event, ui) { |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
checkOnDrop($(this), $(ui.draggable)); |
|
|
|
$(this).append($(ui.draggable)); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -430,7 +430,7 @@ function importData(data){ |
|
|
|
drop: function(event, ui) { |
|
|
|
drop: function(event, ui) { |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
checkOnDrop($(this), $(ui.draggable)); |
|
|
|
$(this).append($(ui.draggable)); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -475,6 +475,7 @@ function importData(data){ |
|
|
|
} |
|
|
|
} |
|
|
|
});
|
|
|
|
});
|
|
|
|
container.appendTo("#data"); |
|
|
|
container.appendTo("#data"); |
|
|
|
|
|
|
|
checkCorrectness(all_imgs); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -537,7 +538,7 @@ function showExample(){ |
|
|
|
drop: function(event, ui) { |
|
|
|
drop: function(event, ui) { |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
checkOnDrop($(this), $(ui.draggable)); |
|
|
|
$(this).append($(ui.draggable)); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -548,7 +549,7 @@ function showExample(){ |
|
|
|
drop: function(event, ui) { |
|
|
|
drop: function(event, ui) { |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){ |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
var tmp_ui = $(ui.draggable).parent(); |
|
|
|
checkOnDrop($(this), $(ui.draggable)); |
|
|
|
$(this).append($(ui.draggable)); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
checkCorrectness(tmp_ui); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -578,9 +579,9 @@ function addCategory(obj){ |
|
|
|
$("<button class='del_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='del_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='add_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='add_category'></button>").appendTo(imgs_container); |
|
|
|
imgs_container.attr("ondragenter", "return false;") |
|
|
|
imgs_container.attr("ondragenter", "return false;") |
|
|
|
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") |
|
|
|
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;") |
|
|
|
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") |
|
|
|
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;") |
|
|
|
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); |
|
|
|
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//add new container
|
|
|
|
//add new container
|
|
|
@ -599,9 +600,9 @@ function addContainer(){ |
|
|
|
$("<button class='del_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='del_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='add_category'></button>").appendTo(imgs_container); |
|
|
|
$("<button class='add_category'></button>").appendTo(imgs_container); |
|
|
|
imgs_container.attr("ondragenter", "return false;") |
|
|
|
imgs_container.attr("ondragenter", "return false;") |
|
|
|
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;") |
|
|
|
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;") |
|
|
|
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;") |
|
|
|
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;") |
|
|
|
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);"); |
|
|
|
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);"); |
|
|
|
container.insertBefore($(".add_block")); |
|
|
|
container.insertBefore($(".add_block")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -704,8 +705,7 @@ function returnId(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//a func for checking when smth will drop
|
|
|
|
//a func for checking when smth will drop
|
|
|
|
function checkOnDrop(dest, source){ |
|
|
|
function checkOnDrop(dest){ |
|
|
|
dest.append(source);
|
|
|
|
|
|
|
|
var tmp_count = dest.find("input[name='count']").val(); |
|
|
|
var tmp_count = dest.find("input[name='count']").val(); |
|
|
|
var tmp_mask = dest.find("input[name='mask']").val(); |
|
|
|
var tmp_mask = dest.find("input[name='mask']").val(); |
|
|
|
if(dest.find(".img_block").size() == tmp_count){ |
|
|
|
if(dest.find(".img_block").size() == tmp_count){ |
|
|
@ -715,47 +715,35 @@ function checkOnDrop(dest, source){ |
|
|
|
tmp_right = false; |
|
|
|
tmp_right = false; |
|
|
|
});
|
|
|
|
});
|
|
|
|
if(tmp_right) |
|
|
|
if(tmp_right) |
|
|
|
dest.removeClass("def_cont") |
|
|
|
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont"); |
|
|
|
.removeClass("red_cont") |
|
|
|
|
|
|
|
.addClass("green_cont"); |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
dest.removeClass("def_cont") |
|
|
|
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont"); |
|
|
|
.removeClass("green_cont") |
|
|
|
|
|
|
|
.addClass("red_cont"); |
|
|
|
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
dest.removeClass("def_cont") |
|
|
|
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont"); |
|
|
|
.removeClass("green_cont") |
|
|
|
|
|
|
|
.addClass("red_cont"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//checking source on correctness
|
|
|
|
//checking source on correctness
|
|
|
|
function checkCorrectness(source){ |
|
|
|
function checkCorrectness(source){ |
|
|
|
if(!source.hasClass("all_imgs")){ |
|
|
|
if(!source.hasClass("all_imgs")){ |
|
|
|
var tmp_count = source.find("input[name='count']").val(); |
|
|
|
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){ |
|
|
|
var tmp_mask = source.find("input[name='mask']").val(); |
|
|
|
source.parent().find(".imgs_cont").each(function(){ |
|
|
|
if(source.find(".img_block").size() == tmp_count){ |
|
|
|
checkOnDrop($(this)) |
|
|
|
var tmp_right = true;
|
|
|
|
}) |
|
|
|
source.find(".img_block").each(function(){ |
|
|
|
} else { |
|
|
|
if($(this).find("input").val() != tmp_mask) |
|
|
|
source.parent().find(".imgs_cont").each(function(){ |
|
|
|
tmp_right = false; |
|
|
|
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont"); |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
if(tmp_right) |
|
|
|
} else { |
|
|
|
source.removeClass("def_cont") |
|
|
|
if(source.find(".img_block").size() > 0){ |
|
|
|
.removeClass("red_cont") |
|
|
|
source.parent().find(".imgs_cont").each(function(){ |
|
|
|
.addClass("green_cont"); |
|
|
|
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont"); |
|
|
|
else |
|
|
|
}) |
|
|
|
source.removeClass("def_cont") |
|
|
|
} else { |
|
|
|
.removeClass("green_cont") |
|
|
|
source.parent().find(".imgs_cont").each(function(){ |
|
|
|
.addClass("red_cont"); |
|
|
|
checkOnDrop($(this)) |
|
|
|
} else if(source.find(".img_block").size() == 0) |
|
|
|
}) |
|
|
|
source.addClass("def_cont") |
|
|
|
} |
|
|
|
.removeClass("green_cont") |
|
|
|
|
|
|
|
.removeClass("red_cont"); |
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
source.removeClass("def_cont") |
|
|
|
|
|
|
|
.removeClass("green_cont") |
|
|
|
|
|
|
|
.addClass("red_cont"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|