fix cleanup bug

This commit is contained in:
Bruno Rybársky 2023-04-01 11:07:33 +02:00
parent fd9e2acc83
commit de7dc499ee
No known key found for this signature in database
GPG Key ID: DFE2C061EF985CD4

@ -14,10 +14,12 @@ let words = [
]; ];
function makeSpaceWord(word){ function makeSpaceWord(word){
$("#lettersky").html("");
$("#imagesky").html("");
let length = word.length; let length = word.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
$("#lettersky").append('<td><div ondrop="drop(event)" ondragover="allowDrop(event)" class="letterplace finalletterplace place"></td>'); $("#lettersky").append('<td><div ondrop="drop(event)" ondragover="allowDrop(event)" class="letterplace finalplace finalletterplace place"></td>');
$("#imagesky").append('<td><div ondrop="drop(event)" ondragover="allowDrop(event)" class="imageplace finalimageplace place"></td>'); $("#imagesky").append('<td><div ondrop="drop(event)" ondragover="allowDrop(event)" class="imageplace finalplace finalimageplace place"></td>');
} }
$("#lettersky").append('<td><div id="letterstatus" class="status"></div></td>'); $("#lettersky").append('<td><div id="letterstatus" class="status"></div></td>');
$("#imagesky").append('<td><div id="imagestatus" class="status"></div></td>'); $("#imagesky").append('<td><div id="imagestatus" class="status"></div></td>');
@ -26,16 +28,18 @@ function makeSpaceWord(word){
let prefix = "assets/"; let prefix = "assets/";
function cleanup(){ function cleanup(){
var htmls = []; // var htmls = [];
var returntos = []; // var returntos = [];
$("[returnto]").each(function (index){ // $("[returnto]").each(function (index){
htmls.push($(this).prop("outerHTML")); // htmls.push($(this).prop("outerHTML"));
returntos.push($(this).attr("returnto")); // returntos.push($(this).attr("returnto"));
$(this).remove(); // $(this).remove();
}); // });
for (var x = 0 ; x < returntos.length; x++) { // for (var x = 0 ; x < returntos.length; x++) {
//$('[returntarget="' + returntos[x] + '"]').html(htmls[x]); // //$('[returntarget="' + returntos[x] + '"]').html(htmls[x]);
} // }
$(".finalplace").html("");
} }
function checkAnswers() { function checkAnswers() {