pulito codice

This commit is contained in:
Luca Trupiano 2025-02-07 18:14:53 +01:00
parent cca554879f
commit 0616f8af26
1 changed files with 12 additions and 129 deletions

View File

@ -136,7 +136,6 @@ $(document).ready(function() {
$('#checkmarkAdvanced').attr('style','opacity: 1');
$('#checkmarkSimple').attr('style','opacity: 0');
queryJson.QueryAvanzata = "1";
// $("#collapseOptions").collapse('hide');
$("#simpleSearchDiv").fadeOut(300, function(){
$("#rigaRicercaSemplice").removeClass( "bg-lida08" )
$("#rigaRicercaSemplice").addClass( "bg-lida10" )
@ -165,19 +164,18 @@ $(document).ready(function() {
$('#searchSimple').on('click', function() {
$('#searchSimple').addClass('disabled');
$('#searchAdvanced').removeClass('disabled');
$('#checkmarkSimple').attr('style','opacity: 1');
$('#checkmarkAdvanced').attr('style','opacity: 0');
queryJson.QueryAvanzata = "0";
$("#collapseAdvanced").collapse('hide');
$("#advancedSearchDiv").fadeOut(300, function(){
$("#rigaRicercaSemplice").removeClass( "bg-lida10" )
$("#rigaRicercaSemplice").addClass( "bg-lida08" )
$("#advancedSearchDiv").removeClass( "d-flex" )
$("#simpleSearchDiv").addClass( "d-flex" )
$("#simpleSearchDiv").fadeIn(400);
});
});
$('#checkmarkSimple').attr('style', 'opacity: 1');
$('#checkmarkAdvanced').attr('style', 'opacity: 0');
queryJson.QueryAvanzata = "0";
$("#collapseAdvanced").collapse('hide');
$("#advancedSearchDiv").fadeOut(300, function() {
$("#rigaRicercaSemplice").removeClass("bg-lida10")
$("#rigaRicercaSemplice").addClass("bg-lida08")
$("#advancedSearchDiv").removeClass("d-flex")
$("#simpleSearchDiv").addClass("d-flex")
$("#simpleSearchDiv").fadeIn(400);
});
});
// Inizializza sortable
$( "#sortable0" ).sortable({
@ -235,7 +233,6 @@ $(document).ready(function() {
//maxHeight: 880,
alsoResize: "#displaycanto",
resize: function(event, ui) {
//console.log($("#colVisualizza").css("height"));
$("#displaycanto").width(" min-content");
var infoHeightToSet = $("body")[0].clientHeight*cssTableMainHeight - $(visCantoClass)[0].clientHeight-2-63-2-46;
$("#displayinfo").css("maxHeight", infoHeightToSet+"px");
@ -243,7 +240,6 @@ $(document).ready(function() {
$("#displaynote").css("maxHeight", infoHeightToSet+"px");
$("#displaynote").css("height", infoHeightToSet+"px");
$(".visInfo").css("height", (infoHeightToSet+4)+"px");
//console.log($("#colVisualizza").css("height"));
getDimensionsDiv(true);
},
stop: function(event, ui) {
@ -733,39 +729,18 @@ $(document).ready(function() {
// Funzioni di gestione del tab Periodo, usate da synthgraph.js
fillStructCard = function(lisid){
/* var structGroupCard = $('<div class="card card-body structCardGroup well well-sm mx-1 my-2 p-0" id="structGroupCard0">');
var commentHeader = $('<div class="d-flex align-content-start flex-nowrap text-muted" id="structGruppoVersi0">')
var rigaNota = $('<div class="p-0 m-0">');
var buttons = $('<div class="d-flex flex-wrap-reverse ml-auto align-items-center justify-content-end px-1 pt-1 pb-0">')
var closeButton = $('<button id="closeStruct0"'+
'class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeStruct rounded text-warning align-self-end px-1 pb-0 ml-1 mb-1">'+
'<ion-icon name="close-circle"></ion-icon>');
var structCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 px-2 pt-1 pb-0 border-lida08" id="structCard0">');
*/
var cantiche=["Inferno", "Purgatorio","Paradiso"];
var romani = ["I","II","III","IV","V","VI","VII","VIII","IX","X",
"XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX",
"XXI","XXII","XXIII","XXIV","XXV","XXVI","XXVII","XXVIII","XXIX","XXX",
"XXXI","XXXII","XXXIII","XXXIV"];
var lisidArray = lisid.split('_')
/*
closeButton.appendTo(buttons);
rigaNota.append('<h6 class="card-title m-2 text-warning">' + cantiche[lisidArray[0]-1] + ", Canto " + romani[lisidArray[1]-1] + ", Verso " + lisidArray[2] + "</h6>");
rigaNota.appendTo(commentHeader);
buttons.appendTo(commentHeader);
commentHeader.appendTo(structGroupCard);
structCard.appendTo(structGroupCard);
$('#displayinfo').empty();
structGroupCard.appendTo($('#displayinfo'));
*/
$('#structHead0').text(cantiche[lisidArray[0]-1] + ", Canto " + romani[lisidArray[1]-1] + ", Verso " + lisidArray[2]);
$('#structGroupCard0').attr('style', "display: flex;");
$('#infoCard0').attr('style', "display: none;");
};
emptyStructCard = function(){
//$('#displayinfo').empty();
//$('#displayinfo').append($(emptyInfo))
$('#infoCard0').attr('style', "display: flex;");
$('#structGroupCard0').attr('style', "display: none;");
};
@ -806,53 +781,13 @@ $(document).ready(function() {
};
var rifText = "Nessun filtro definito<br>";
addRifLIitem(sortableId,rifID,rifText,checkInsert,toExpand);
// var claClone = document.getElementById("rif0xR1Rx").cloneNode(true);
// claClone.setAttribute("id","claRif100" + rifID);
// claClone.setAttribute("id","rif" + rifID);
$("#rif" + rifID).attr("data-claActive", active);
$("#rif" + rifID).attr("style", "");
// claClone.setAttribute("data-claActive", active);
// claClone.setAttribute("aria-labelledby","rif" + rifID + "-tab");
// claClone.setAttribute("style", "");
//$('#claBody' + rifID).append(claClone);
// se non cambio l'id della select react non rileva l'evento onchange:
// $('#cla' + rifID + " #grammtypesN").attr("id","grammtypes" + rifID);
// $('#cla' + rifID + " #lemma_formaN").attr("id","lemma_forma" + rifID);
// $('#cla' + rifID + " #queryTextN").attr("id","queryText" + rifID);
// $('#cla' + rifID + " #opzioni_testoN").attr("id","opzioni_testo" + rifID);
// $('#cla' + rifID + " #contextDivN").attr("id","contextDiv" + rifID);
addClaContext(rifID);
refreshClaList();
refreshSortables();
}
/*
// Funzione di creazione del tab delle clausole grammaticali
function addGramCla(sortableId,active,tabID,toExpand){
if (active > 0) {
var checkInsert = ' checked="checked"';
} else {
var checkInsert = '';
};
var claText = "Categoria grammaticale: <br>";
addClaLIitem(sortableId,tabID,claText,checkInsert,toExpand);
var claClone = document.getElementById("tipogrammaticaleN").cloneNode(true);
claClone.setAttribute("id","cla" + tabID);
claClone.setAttribute("data-claActive", active);
claClone.setAttribute("aria-labelledby","cla" + tabID + "-tab");
claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone);
// se non cambio l'id della select react non rileva l'evento onchange:
$('#cla' + tabID + " #grammtypesN").attr("id","grammtypes" + tabID);
$('#cla' + tabID + " #lemma_formaN").attr("id","lemma_forma" + tabID);
$('#cla' + tabID + " #queryTextN").attr("id","queryText" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id","opzioni_testo" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id","contextDiv" + tabID);
addClaContext(tabID);
}
*/
// Funzione di creazione delle subclausole grammaticali basate sul valore scelto
function addCatgramSubcla(tabPaneId,selectedValue){
var dettagliBox = $("#" + tabPaneId + " .dettaglifiltri");
@ -963,49 +898,6 @@ $(document).ready(function() {
};
}
/*
// Funzione di creazione del tab delle clausole sintattiche
function addSyntCla(sortableId,active,tabID,toExpand){
if (active > 0) {
var checkInsert = ' checked="checked"';
} else {
var checkInsert = '';
};
var claText = "Tipo sintattico: <br>";
addClaLIitem(sortableId,tabID,claText,checkInsert,toExpand);
var claClone = document.getElementById("tiposintatticoN").cloneNode(true);
claClone.setAttribute("id","cla" + tabID);
claClone.setAttribute("data-claActive",active);
claClone.setAttribute("aria-labelledby","cla" + tabID + "-tab");
claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone);
$('#cla' + tabID + " #lemma_formaN").attr("id","lemma_forma" + tabID);
$('#cla' + tabID + " #queryTextN").attr("id","queryText" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id","opzioni_testo" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id","contextDiv" + tabID);
addClaContext(tabID);
}
// Funzione di creazione del tab delle clausole metafore
function addMetaCla(sortableId,active,tabID,toExpand){
var checkInsert = ' disabled';
//if (active > 0) {
// var checkInsert = '" checked="checked"';
//} else {
// var checkInsert = '"';
//};
var claText = "Clausola Metafore - non ancora implementata";
addClaLIitem(sortableId,tabID,claText,checkInsert,toExpand);
var claClone = document.getElementById("tipometaforaN").cloneNode(true);
claClone.setAttribute("id","cla" + tabID);
claClone.setAttribute("data-claActive",active);
claClone.setAttribute("aria-labelledby","cla" + tabID + "-tab");
claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone);
}
*/
// Funzione di creazione della parte di definizione del contesto delle clausole
function addClaContext(tabID){
var contClone = document.getElementById("contextTable-xX0").cloneNode(true);
@ -1172,10 +1064,6 @@ $(document).ready(function() {
// Funzione di refresh dei filtri sulla ricerca dei Riferimenti
function updateRifListItem(rifIdNum, sortableRifId){
//id="li-claRif100"
//id="sortableRif0"
//rifIdNum = rifIdNum || 100;
//sortableRifId = sortableRifId || 100;
var rifText = '';
var checkInsert = '';
var jsonTextToParse = '{';
@ -1210,7 +1098,6 @@ $(document).ready(function() {
};
};
if (claSubParType == "text" && $(this)[0].value) {
// rifText = rifText + $(this)[0].id.replace(rifIdNum,"") + ': <span class="font-italic">"' + $(this)[0].value + '"</span>; ';
rifText = rifText + $(this)[0].name + ': <span class="font-italic">"' + $(this)[0].value + '"</span>; ';
jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].id.replace(rifIdNum,"") + '": "' + $(this)[0].value + '"';
};
@ -1348,7 +1235,6 @@ $(document).ready(function() {
} else {
condLIplaceholder = condLIplaceholderPart1 + placeholderName[i] + sortableID.slice(-1) + condLIplaceholderPart2 + condLIplaceholderText2 + '</li>';
}
//$("#" + sortableID).append(condLIplaceholder).hide().fadeIn(300);
$("#" + sortableID).append(function() {
return $(condLIplaceholder).hide();
});
@ -1377,7 +1263,6 @@ $(document).ready(function() {
} else {
condLIplaceholder = condLIplaceholderPart1 + placeholderName[i] + sortableID.slice(-1) + condLIplaceholderPart2 + condLIplaceholderText1 + '</li>';
}
//$("#" + sortableID).append(condLIplaceholder).hide().fadeIn(300);
$("#" + sortableID).append(function() {
return $(condLIplaceholder).hide();
});
@ -1392,7 +1277,6 @@ $(document).ready(function() {
$(placeholderID).fadeOut(300, function() {
$(placeholderID).remove();
});
//$(placeholderID).remove();
};
$(iconBtn).attr("class", "btn btn-sm iconClClass NOremoveCond text-muted border rounded px-1 pb-0");
$(iconBtn).prop("disabled", true);
@ -1403,7 +1287,6 @@ $(document).ready(function() {
$(placeholderID).fadeOut(300, function() {
$(placeholderID).remove();
});
//$(placeholderID).remove();
};
};
});