diff --git a/js/script_4.8.js b/js/script_4.8.js index d8d956e..981823f 100644 --- a/js/script_4.8.js +++ b/js/script_4.8.js @@ -10,6 +10,7 @@ var latestPhraseId = ""; var numeroPagine = 0; var latestOffset = 0; var numberOfQueries = 0; +var topClause = 1; const cssCantoHeight = 0.65; const cssTableMainHeight = 0.95; //.tableMain {height: 95%;} @@ -341,19 +342,32 @@ $(document).ready(function() { $('#cla-TabContent').on('click', '.removeCla', function() { var claListItemId = $(this).closest('li').attr('id'); var claIdNum = claListItemId.substr(6); + var condizioni; + var idCondizione; + if (claListLen == 1) { + return; + } claListLen--; numberOfQueries--; var thisIs = $("#" + claListItemId); - if (claIdNum > 1) { - $("#" + claListItemId).fadeOut(300, function() { - thisIs.remove(); + $("#" + claListItemId).fadeOut(300, function() { + thisIs.remove(); + if (claIdNum == topClause){ + condizioni = $(".condizioneAndOr") + idCondizione = condizioni[1].id; + topClause = idCondizione.substr(4); + $("#" + idCondizione).remove(); + }else{ $("#cond" + claIdNum).remove(); - delete queryJson["Clausola" + claIdNum]; - delete window["context" + claIdNum]; - refreshClaList(claIdNum); - refreshSortables(); - }); - } + } + delete queryJson["Clausola" + claIdNum]; + delete window["context" + claIdNum]; + refreshClaList(claIdNum); + refreshSortables(); + if (claIdNum == 1) { + $("#unitaRicerca").prop('disabled', false); + } + }); }); // Evento: click sull'icona rimuovi condizione @@ -989,6 +1003,7 @@ $(document).ready(function() { }; var boolCond = $('') boolCond.attr('id','cond'+tabID); + boolCond.addClass("condizioneAndOr") switch (cond){ case 1: boolCond.append("AND"); break;