fixed Sankore-601 issue

preferencesAboutTextFull
maximXbs 12 years ago
parent 545e316074
commit 519b66cbbd
  1. 79
      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. 75
      resources/library/interactivities/Cat text.wgt/js/script.js
  5. 72
      resources/library/interactivities/Cat text.wgt/locales/fr/js/script.js
  6. 72
      resources/library/interactivities/Cat text.wgt/locales/ru/js/script.js

@ -112,7 +112,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);
} }
} }
@ -341,7 +341,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);
} }
} }
@ -413,12 +413,11 @@ 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);
} }
} }
}); });
checkCorrectness(imgs_container);
} }
all_imgs = $("<div class='all_imgs'>").appendTo(container); all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -458,6 +457,7 @@ function importData(data){
} }
}); });
container.appendTo("#data"); container.appendTo("#data");
checkCorrectness(all_imgs);
} }
} }
} }
@ -520,7 +520,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);
} }
} }
@ -531,7 +531,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);
} }
} }
@ -561,9 +561,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
@ -686,8 +686,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){
@ -697,47 +696,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");
} }
} }

@ -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");
} }
} }

@ -111,7 +111,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);
} }
} }
@ -342,7 +342,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);
} }
} }
@ -414,7 +414,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);
} }
} }
@ -459,6 +459,7 @@ function importData(data){
} }
}); });
container.appendTo("#data"); container.appendTo("#data");
checkCorrectness(all_imgs);
} }
} }
} }
@ -521,7 +522,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);
} }
} }
@ -532,7 +533,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);
} }
} }
@ -562,9 +563,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
@ -583,9 +584,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"));
} }
@ -688,8 +689,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){
@ -699,47 +699,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");
} }
} }

@ -120,7 +120,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);
} }
} }
@ -339,7 +339,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);
} }
} }
@ -410,12 +410,11 @@ 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);
} }
} }
}); });
checkCorrectness(imgs_container);
} }
all_imgs = $("<div class='all_imgs'>").appendTo(container); all_imgs = $("<div class='all_imgs'>").appendTo(container);
@ -452,7 +451,8 @@ function importData(data){
} }
} }
} }
}); });
checkCorrectness(all_imgs);
} }
} }
} }
@ -516,7 +516,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);
} }
} }
@ -527,7 +527,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);
} }
} }
@ -685,8 +685,7 @@ function changeStyle(val){
} }
//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){
@ -696,46 +695,34 @@ 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");
} }
} }

@ -141,7 +141,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);
} }
} }
@ -360,7 +360,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);
} }
} }
@ -431,7 +431,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);
} }
} }
@ -473,7 +473,8 @@ function importData(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);
} }
} }
@ -706,8 +707,7 @@ function changeStyle(val){
} }
//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){
@ -717,46 +717,34 @@ 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");
} }
} }

@ -120,7 +120,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);
} }
} }
@ -339,7 +339,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);
} }
} }
@ -410,7 +410,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);
} }
} }
@ -452,7 +452,8 @@ function importData(data){
} }
} }
} }
}); });
checkCorrectness(all_imgs);
} }
} }
} }
@ -516,7 +517,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);
} }
} }
@ -527,7 +528,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);
} }
} }
@ -685,8 +686,7 @@ function changeStyle(val){
} }
//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){
@ -696,46 +696,34 @@ 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");
} }
} }
Loading…
Cancel
Save