fixed Sankore-601 issue

preferencesAboutTextFull
maximXbs 12 years ago
parent 545e316074
commit 519b66cbbd
  1. 77
      resources/library/interactivities/Cat images.wgt/js/script.js
  2. 82
      resources/library/interactivities/Cat images.wgt/locales/fr/js/script.js
  3. 82
      resources/library/interactivities/Cat images.wgt/locales/ru/js/script.js
  4. 71
      resources/library/interactivities/Cat text.wgt/js/script.js
  5. 70
      resources/library/interactivities/Cat text.wgt/locales/fr/js/script.js
  6. 70
      resources/library/interactivities/Cat text.wgt/locales/ru/js/script.js

@ -112,7 +112,7 @@ function start(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -341,7 +341,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -413,12 +413,11 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
checkCorrectness(imgs_container);
}
all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -458,6 +457,7 @@ function importData(data){
}
});
container.appendTo("#data");
checkCorrectness(all_imgs);
}
}
}
@ -520,7 +520,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -531,7 +531,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -561,9 +561,9 @@ function addCategory(obj){
$("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);");
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
}
//add new container
@ -686,8 +686,7 @@ function returnId(){
}
//a func for checking when smth will drop
function checkOnDrop(dest, source){
dest.append(source);
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
@ -697,47 +696,35 @@ function checkOnDrop(dest, source){
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val();
var tmp_mask = source.find("input[name='mask']").val();
if(source.find(".img_block").size() == tmp_count){
var tmp_right = true;
source.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
source.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} 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");
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}

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

@ -111,7 +111,7 @@ function start(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -342,7 +342,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -414,7 +414,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -459,6 +459,7 @@ function importData(data){
}
});
container.appendTo("#data");
checkCorrectness(all_imgs);
}
}
}
@ -521,7 +522,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -532,7 +533,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -562,9 +563,9 @@ function addCategory(obj){
$("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);");
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
}
//add new container
@ -583,9 +584,9 @@ function addContainer(){
$("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);");
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
container.insertBefore($(".add_block"));
}
@ -688,8 +689,7 @@ function returnId(){
}
//a func for checking when smth will drop
function checkOnDrop(dest, source){
dest.append(source);
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
@ -699,47 +699,35 @@ function checkOnDrop(dest, source){
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val();
var tmp_mask = source.find("input[name='mask']").val();
if(source.find(".img_block").size() == tmp_count){
var tmp_right = true;
source.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
source.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} 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");
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}

@ -120,7 +120,7 @@ function start(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -339,7 +339,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -410,12 +410,11 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
checkCorrectness(imgs_container);
}
all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -453,6 +452,7 @@ function importData(data){
}
}
});
checkCorrectness(all_imgs);
}
}
}
@ -516,7 +516,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -527,7 +527,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -685,8 +685,7 @@ function changeStyle(val){
}
//a func for checking when smth will drop
function checkOnDrop(dest, source){
dest.append(source);
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
@ -696,46 +695,34 @@ function checkOnDrop(dest, source){
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val();
var tmp_mask = source.find("input[name='mask']").val();
if(source.find(".img_block").size() == tmp_count){
var tmp_right = true;
source.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
source.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} 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");
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}

@ -141,7 +141,7 @@ function start(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -360,7 +360,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -431,7 +431,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -474,6 +474,7 @@ function importData(data){
}
}
});
checkCorrectness(all_imgs);
}
}
}
@ -537,7 +538,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -548,7 +549,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -706,8 +707,7 @@ function changeStyle(val){
}
//a func for checking when smth will drop
function checkOnDrop(dest, source){
dest.append(source);
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
@ -717,46 +717,34 @@ function checkOnDrop(dest, source){
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val();
var tmp_mask = source.find("input[name='mask']").val();
if(source.find(".img_block").size() == tmp_count){
var tmp_right = true;
source.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
source.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} 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");
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}

@ -120,7 +120,7 @@ function start(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -339,7 +339,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -410,7 +410,7 @@ function importData(data){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -453,6 +453,7 @@ function importData(data){
}
}
});
checkCorrectness(all_imgs);
}
}
}
@ -516,7 +517,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -527,7 +528,7 @@ function showExample(){
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
checkOnDrop($(this), $(ui.draggable));
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
@ -685,8 +686,7 @@ function changeStyle(val){
}
//a func for checking when smth will drop
function checkOnDrop(dest, source){
dest.append(source);
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
@ -696,46 +696,34 @@ function checkOnDrop(dest, source){
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
var tmp_count = source.find("input[name='count']").val();
var tmp_mask = source.find("input[name='mask']").val();
if(source.find(".img_block").size() == tmp_count){
var tmp_right = true;
source.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
source.removeClass("def_cont")
.removeClass("red_cont")
.addClass("green_cont");
else
source.removeClass("def_cont")
.removeClass("green_cont")
.addClass("red_cont");
} 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");
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}
Loading…
Cancel
Save