From cd0ed513dd8e70a34aae511f49214ec08a7ab1a9 Mon Sep 17 00:00:00 2001 From: cesare Date: Thu, 13 Mar 2025 17:34:58 +0100 Subject: [PATCH] gestione risultati rif --- js/browseMgr_5.1.js | 244 ++++++++++++++++++++++++++++++++------------ js/dataMgr_5.1.js | 65 +++++++++--- js/utilsMgr_5.1.js | 9 +- 3 files changed, 237 insertions(+), 81 deletions(-) diff --git a/js/browseMgr_5.1.js b/js/browseMgr_5.1.js index 3a0b249..7a7dd73 100644 --- a/js/browseMgr_5.1.js +++ b/js/browseMgr_5.1.js @@ -583,6 +583,7 @@ $(document).ready(function() { cantoDisplayed = "#" + cid; + if (telive.length > 0) { initCitazioni() } else { @@ -603,13 +604,13 @@ $(document).ready(function() { } //var telive = getListaRis() - for (var tel of telive) { + for (var tel of telive) { var telId = tel.split("_"); - telId = "#"+telId[0]+telId[1]+"_"+telId[2]; + telId = "#" + telId[0] + telId[1] + "_" + telId[2]; //replace inserito per evitare errori per i dati non corretti - $(telId+" #"+tel.replace('|', '')).addClass("mark ") - } - + $(telId + " #" + tel.replace('|', '')).addClass("mark ") + } + $("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;') @@ -933,7 +934,7 @@ $(document).ready(function() { } /*INIZIO GESTIONE CITAZIONI*/ - async function initCitazioni( cantoCitazione = cantoDisplayed) { + async function initCitazioni(cantoCitazione = cantoDisplayed) { //"#InfernoCanto_1" var idcantica = '1' var mcanto = cantoCitazione.replace("#", '') @@ -1016,9 +1017,6 @@ $(document).ready(function() { var queryComment = false; var idClass = $(this).attr('class'); var parentClass = $(this).parent().attr('class'); - if(cid.includes("Proemio")){ - parentClass = "mark"; - } filterOn = true; if (idClass.includes("filterRiferimentiOn")) { @@ -1031,15 +1029,15 @@ $(document).ready(function() { if (!hasCommentsJson(cid)) { return } - if (getListaIdCommenti().length>0) { + if (getListaIdCommenti().length > 0) { if (filterOn) { - if (parentClass.includes("mark")){ + if (parentClass.includes("mark")) { $(".filterRiferimentiOn").css('display', 'inline-block'); $(".filterRiferimentiOff").css('display', 'none'); - }else{ + } else { $(".filterRiferimentiOn").css('display', 'none'); $(".filterRiferimentiOff").css('display', 'none'); - } + } } else { $(".filterRiferimentiOff").css('display', 'inline-block'); $(".filterRiferimentiOn").css('display', 'none'); @@ -1060,10 +1058,10 @@ $(document).ready(function() { case "3": cantica = "Paradiso"; } var commentArea = $('#displaynote'); - var idCommento = "CommentoQuery_"+parcid[1]+"_"+parcid[2]+"_"+parcid[3]; - $(".filterRiferimentiOn").attr("id",idCommento) - $(".filterRiferimentiOff").attr("id",idCommento) - + var idCommento = "CommentoQuery_" + parcid[1] + "_" + parcid[2] + "_" + parcid[3]; + $(".filterRiferimentiOn").attr("id", idCommento) + $(".filterRiferimentiOff").attr("id", idCommento) + if (parcid[0] == "CommentoQuery") { // verificare queryComment = true; } @@ -1091,14 +1089,14 @@ $(document).ready(function() { } else { versText = ", Verso " + gruppoVersi; } - + currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsSQL[k].length, queryComment) noteAdded = false; commentsSQL[k].forEach(function(value, i) { currentGroup.append(createNoteEntry(value, k, i, queryComment)) }); - if (queryComment) { - if (noteAdded) { + if (queryComment) { + if (noteAdded) { commentArea.append(currentGroup); if (filterOn) { $(".filterRiferimentiOff").css('display', 'inline-block'); @@ -1107,7 +1105,7 @@ $(document).ready(function() { $(".filterRiferimentiOn").css('display', 'inline-block'); $(".filterRiferimentiOff").css('display', 'none'); } - }else{ + } else { if (k.includes("-") && !filterOn) { commentArea.append(currentGroup); } @@ -1149,27 +1147,27 @@ $(document).ready(function() { } var toTitleCase = str => str.replace(/(^\w|\s\w)(\S*)/g, (_, m1, m2) => m1.toUpperCase() + m2.toLowerCase()) - function isCommentInResult(idComment){ + function isCommentInResult(idComment) { const tmplistaidcomm = getListaIdCommenti() if (tmplistaidcomm.length && tmplistaidcomm.includes(idComment)) { return true; - } + } return false; } - + function createNoteEntry(comments, id, pos, queryComment) { var idref = comments.Id - if (isCommentInResult(idref)) { + if (isCommentInResult(idref)) { var noteCard = $('
'); noteAdded = true; } - else { + else { var noteCard = $('
'); if (queryComment) { - if(filterOn){ + if (filterOn) { noteCard.css("display", "none"); - }else{ + } else { noteCard.css("display", "inline-block"); } } @@ -1517,9 +1515,9 @@ $(document).ready(function() { } - var ile=-1 + var ile = -1 for (var detail of details) { - ile+=1 + ile += 1 myitems = detail.split(','); catgramm = '
'; @@ -1649,7 +1647,7 @@ $(document).ready(function() { for (var ve of telive) { //let idve = ve $(ve.replace('|', '')).removeClass("mark ") - minim.contents().find(ve).removeClass("mark ") + minim.contents().find(ve.replace('|', '')).removeClass("mark ") } const tmplistaidcomm = getListaIdCommenti() for (var idco of tmplistaidcomm) { @@ -1669,8 +1667,8 @@ $(document).ready(function() { isSearchRiferimenti = false; //var esprlogica = [] var jsonQuery = getJsonQuery() - // $("#paginaLista option").remove(); - // $('#paginaLista').append(``); + // $("#paginaLista option").remove(); + // $('#paginaLista').append(``); showingComments = false; if (filterBottonAdded) { @@ -1680,8 +1678,8 @@ $(document).ready(function() { $('#displaynote').empty() $('#displaynote').append($(emptyNoteList)) } - - + + if (jsonQuery['QueryAvanzata'] == 0) unitaRicerca = 'forma' @@ -1766,7 +1764,7 @@ $(document).ready(function() { } function showRisultatiCommenti(listaRisultatiCommenti) { - + if (cantoDisplayed != '#vistaFrasi') { prevCantoDisplayed = cantoDisplayed; $(cantoDisplayed).css("display", "none"); @@ -1786,19 +1784,19 @@ $(document).ready(function() { managePage(); $("#loader").fadeOut(300); //$("#cantica0").trigger("click"); - }else{ + } else { return; } if (!filterBottonAdded) { var cardRiferimenti = $("#tabRiferimenti") - var filterButton = $('