Nuova versione con gestione risultato ricerca Riferimenti
This commit is contained in:
parent
c12d94038c
commit
ccae0d8728
|
@ -488,7 +488,7 @@
|
|||
<ul class="nav nav-tabs" id="tab-list" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link py-1 active" id="vis0-tab" data-toggle="tab" href="#vis0" role="tab" aria-controls="vis0" aria-selected="true"><span class=" btn-link"><ion-icon name="document-attach"></ion-icon></span>
|
||||
<span class="h6 btn-link"> Riferimenti</span></a>
|
||||
<span class="h6 btn-link" id="tabRiferimenti"> Riferimenti</span></a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link py-1" id="vis1-tab" data-toggle="tab" href="#vis1" role="tab" aria-controls="vis1" aria-selected="true"><span class=" btn-link"><ion-icon name="analytics"></ion-icon></span>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, get
|
|||
import { getJsonQuery, emptyStructCard } from './script_5.0.js';
|
||||
import { resetGraphStr } from './syntgraph_5.0.js'
|
||||
|
||||
|
||||
export var manageRisultatoCommmenti
|
||||
export var resetResult;
|
||||
export var lsentid;
|
||||
export var lisid;
|
||||
|
@ -18,12 +18,13 @@ export var listaClausoleRisultato;
|
|||
export var numeroContesti;
|
||||
export var cantoDisplayed;
|
||||
export var showOffset = 30;
|
||||
export var isSearchRiferimenti = false;
|
||||
|
||||
const cantobadgeclass = 'badge badge-outline-warning badge-pill'
|
||||
const hdnNamespace = 'http://dantenetwork.it/data/commedia/'
|
||||
const syntitNamespace = 'https://dantenetwork.it/ontology/syntit/current/'
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
//removeGraph = false;
|
||||
const dialogspeakers = {
|
||||
|
@ -34,6 +35,7 @@ $(document).ready(function() {
|
|||
"san Bernardo": "diaSanBernardo"
|
||||
}
|
||||
const dialogaltri = 'diaAltri'
|
||||
const versiPerGruppo = 5;
|
||||
var listaClausoleRisultatoContesti = []
|
||||
|
||||
var listaRisultatiCommenti = []
|
||||
|
@ -43,10 +45,13 @@ $(document).ready(function() {
|
|||
|
||||
//const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commedia/query";
|
||||
const sparqlEndpoint = "https://lida.dantenetwork.it/fuseki/commedia/query";
|
||||
var elencoRiferimenti;
|
||||
|
||||
var shownSentenceList = new Set()
|
||||
|
||||
var filterBottonAdded = false;
|
||||
var listarisultati = [];
|
||||
var showingComments = false;
|
||||
var filterOn = true;
|
||||
listaPeriodiRisultato = [];
|
||||
listaClausoleRisultato = []
|
||||
/*var commentsArray = []
|
||||
|
@ -516,15 +521,19 @@ $(document).ready(function() {
|
|||
|
||||
jQuery(document).delegate('.navig-canto, .citazioneFrase', 'click', function(e) {
|
||||
resetFrasi()
|
||||
|
||||
//Nik Riferimenti carica
|
||||
//nasconde vista risultati
|
||||
$("#vistaFrasi").css("display", "none");
|
||||
|
||||
//rimuove il grafo sintattico se c'è'
|
||||
resetGraphStr()
|
||||
emptyStructCard()
|
||||
showingComments = false;
|
||||
$('#displaynote').empty();
|
||||
$(".filterRiferimentiOn").css('display', 'none');
|
||||
$(".filterRiferimentiOff").css('display', 'none');
|
||||
|
||||
|
||||
|
||||
$(cantoDisplayed).css("display", "none");
|
||||
|
||||
const cid = $(this).attr('name').replace(" ", "_");
|
||||
|
@ -544,12 +553,14 @@ $(document).ready(function() {
|
|||
loadedCanti.add(cid)
|
||||
}
|
||||
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
||||
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
||||
|
||||
var telive = getListaRis()
|
||||
for (var tel of telive) {
|
||||
$(tel).addClass("mark ")
|
||||
}
|
||||
$("#"+tel).addClass("mark ")
|
||||
}
|
||||
|
||||
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
||||
|
||||
|
||||
drawMinimap("#" + $(this).attr('name').replace(" ", "_"), false)
|
||||
|
||||
|
@ -854,7 +865,7 @@ $(document).ready(function() {
|
|||
|
||||
}
|
||||
/*INIZIO GESTIONE CITAZIONI*/
|
||||
|
||||
|
||||
async function initCitazioni() {
|
||||
//"#InfernoCanto_1"
|
||||
var idcantica = '1'
|
||||
|
@ -878,12 +889,9 @@ $(document).ready(function() {
|
|||
/*console.log(myid)*/
|
||||
if (canto.length == 1)
|
||||
canto = '0' + canto
|
||||
//commentsJson = getVersiConCitazioniJson(cantica, canto)
|
||||
|
||||
/*
|
||||
*/
|
||||
var mresult = await getVersiConCitazioni(cantica, canto)
|
||||
|
||||
var mresult = await getVersiConCitazioni(cantica, canto)
|
||||
|
||||
commentsSQL = Object.groupBy(mresult, ({ VersoCitazione }) => VersoCitazione);
|
||||
|
||||
var tmpkeys = []
|
||||
|
@ -923,11 +931,36 @@ $(document).ready(function() {
|
|||
var noteAdded;
|
||||
jQuery(document).delegate(' .showcomments', 'click', function() {
|
||||
var cid = $(this).attr('id');
|
||||
var queryComment = false;
|
||||
var idClass = $(this).attr('class');
|
||||
filterOn = true;
|
||||
|
||||
if (idClass.includes("filterRiferimentiOn")) {
|
||||
filterOn = true;
|
||||
} else {
|
||||
if (idClass.includes("filterRiferimentiOff")) {
|
||||
filterOn = false;
|
||||
}
|
||||
}
|
||||
if (!hasCommentsJson(cid)) {
|
||||
return
|
||||
}
|
||||
if (showingComments) {
|
||||
if (filterOn) {
|
||||
$(".filterRiferimentiOn").css('display', 'inline-block');
|
||||
$(".filterRiferimentiOff").css('display', 'none');
|
||||
} else {
|
||||
$(".filterRiferimentiOff").css('display', 'inline-block');
|
||||
$(".filterRiferimentiOn").css('display', 'none');
|
||||
}
|
||||
} else {
|
||||
$(".filterRiferimentiOn").css('display', 'none');
|
||||
$(".filterRiferimentiOff").css('display', 'none');
|
||||
}
|
||||
|
||||
var parcid = cid.split('_')
|
||||
var cantica;
|
||||
var verso = parcid[3];
|
||||
switch (parcid[1]) {
|
||||
case "1": cantica = "Inferno";
|
||||
break;
|
||||
|
@ -936,13 +969,19 @@ $(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)
|
||||
|
||||
if (parcid[0] == "CommentoQuery") {
|
||||
queryComment = true;
|
||||
}
|
||||
commentArea.empty()
|
||||
if ($('#noteCard0').length) {
|
||||
$("#noteCard0")[0].remove();
|
||||
}
|
||||
var id = cid.substr(9);
|
||||
id = parcid.at(-1)
|
||||
var collapseNote;
|
||||
var gruppoVersi;
|
||||
var versText = "";
|
||||
|
||||
|
@ -957,24 +996,28 @@ $(document).ready(function() {
|
|||
//gruppoVersi = k.split("_").slice(-1)[0]
|
||||
gruppoVersi = k
|
||||
if (gruppoVersi.includes("-")) {
|
||||
versText = ", Versi " + gruppoVersi;
|
||||
versText = ", Versi " + verso//gruppoVersi;
|
||||
} else {
|
||||
versText = ", Verso " + gruppoVersi;
|
||||
}
|
||||
var queryComment = false;
|
||||
if (parcid[0] == "CommentoQuery") {
|
||||
queryComment = true;
|
||||
versText = ", Verso " + 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){ //Nik changes
|
||||
if (noteAdded){
|
||||
if (queryComment) { //Nik changes
|
||||
if (noteAdded) {
|
||||
commentArea.append(currentGroup);
|
||||
if (filterOn) {
|
||||
$(".filterRiferimentiOff").css('display', 'inline-block');
|
||||
$(".filterRiferimentiOn").css('display', 'none');
|
||||
} else {
|
||||
$(".filterRiferimentiOn").css('display', 'inline-block');
|
||||
$(".filterRiferimentiOff").css('display', 'none');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
commentArea.append(currentGroup);
|
||||
}
|
||||
}
|
||||
|
@ -995,50 +1038,33 @@ $(document).ready(function() {
|
|||
if (len > 1) {
|
||||
var commentiSP = " commenti su "
|
||||
} else {
|
||||
var commentiSP = " commento su " // Nik riferimenti modificare con funzione successiva
|
||||
var commentiSP = " commento su "
|
||||
}
|
||||
//noteGroupCard.append('<h6 class="card-title m-2 text-warning">' + cantica + ", Canto " + canto + versi + "</h6>");
|
||||
rigaNota.append('<h6 class="card-title m-2 text-warning"><span class="badge badge-warning badge-pill mx-1">' + len + "</span>" + commentiSP + cantica + ", Canto " + canto + versi + "</h6>");
|
||||
rigaNota.appendTo(commentHeader);
|
||||
if (queryComment) {
|
||||
var filterButton = $('<button />'); // Nik da migliorare
|
||||
filterButton.attr('id', 'filterRiferimentiOn_' + id + '_' + canto)
|
||||
filterButton.attr('class', 'btn btn-sm btn-outline-primary showQueryComments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
var filterIcon = '<ion-icon name="funnel"></ion-icon>';
|
||||
var filterIcon1 = '<ion-icon name="funnel-outline"></ion-icon>';
|
||||
var filterButton1 = $('<button />'); // Nik da migliorare
|
||||
filterButton1.attr('id', 'filterRiferimentiOff_' + id + '_' + canto)
|
||||
filterButton1.attr('class', 'btn btn-sm btn-outline-primary showQueryComments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
filterButton1.append(filterIcon1)
|
||||
filterButton1.css('display', 'none');
|
||||
filterButton.append(filterIcon)
|
||||
filterButton.appendTo(commentHeader)
|
||||
filterButton1.appendTo(commentHeader)
|
||||
} else {
|
||||
$('#'+'filterRiferimentiOn_' + id + '_' + canto).remove()
|
||||
$('#'+'filterRiferimentiOff_' + id + '_' + canto).remove()
|
||||
}
|
||||
|
||||
buttons.appendTo(commentHeader);
|
||||
commentHeader.appendTo(noteGroupCard);
|
||||
|
||||
|
||||
return noteGroupCard;
|
||||
}
|
||||
|
||||
function createNoteEntry(comments, id, pos, queryComment) {
|
||||
const tmplistaidcomm = getListaIdCommenti()
|
||||
var idref = comments.Id
|
||||
|
||||
|
||||
if (tmplistaidcomm.length && tmplistaidcomm.includes(idref)) { // Nik riferimenti
|
||||
var noteCard = $('<div class="card card-body bg-light border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||
noteAdded = true;
|
||||
}
|
||||
else { //Nik changes
|
||||
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||
if (queryComment){
|
||||
noteCard.css("display", "none");
|
||||
if (queryComment) {
|
||||
if(filterOn){
|
||||
noteCard.css("display", "none");
|
||||
}else{
|
||||
noteCard.css("display", "inline-block");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
var collapseCardBody = $('<div class="card-body px-0 py-1 mx-3 my-0 border-top rounded" >');
|
||||
var divCampiSingoli = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
||||
|
@ -1537,17 +1563,34 @@ $(document).ready(function() {
|
|||
*/
|
||||
var unitaRicerca = 'forma'
|
||||
|
||||
function manageQuery() {
|
||||
|
||||
async function manageQuery() {
|
||||
cleanSearchResult()
|
||||
isSearchRiferimenti = false;
|
||||
//var esprlogica = []
|
||||
var jsonQuery = getJsonQuery()
|
||||
// $("#paginaLista option").remove();
|
||||
// $('#paginaLista').append(`<option value="1">1/1</option>`);
|
||||
|
||||
showingComments = false;
|
||||
if (filterBottonAdded) {
|
||||
$(".filterRiferimentiOn").css('display', 'none');
|
||||
$(".filterRiferimentiOff").css('display', 'none');
|
||||
const emptyNoteList = '<div class="card card-body well well-sm m-1 mt-2 p-0" id="noteCard0"><span class="p-3 text-muted bg-lida-vis small" style="opacity: 0.6;">Nessun commento visualizzato</span></div>';
|
||||
$('#displaynote').empty()
|
||||
$('#displaynote').append($(emptyNoteList))
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (jsonQuery['QueryAvanzata'] == 0)
|
||||
unitaRicerca = 'forma'
|
||||
else
|
||||
unitaRicerca = jsonQuery['unitaRicerca']
|
||||
if (unitaRicerca == 'riferimenti') {
|
||||
listaRisultatiCommenti = queryRiferimenti(jsonQuery.Riferimento100, cantoDisplayed)
|
||||
isSearchRiferimenti = true;
|
||||
listaRisultatiCommenti = await queryRiferimenti(jsonQuery.Riferimento100, cantoDisplayed)
|
||||
showRisultatiCommenti(listaRisultatiCommenti)
|
||||
return
|
||||
}
|
||||
console.log("got json query, unita ricerca: " + unitaRicerca)
|
||||
|
@ -1616,6 +1659,134 @@ $(document).ready(function() {
|
|||
executeQuerySearch(myquery)
|
||||
}
|
||||
|
||||
function showRisultatiCommenti(listaRisultatiCommenti) {
|
||||
|
||||
if (cantoDisplayed != '#vistaFrasi') {
|
||||
prevCantoDisplayed = cantoDisplayed;
|
||||
$(cantoDisplayed).css("display", "none");
|
||||
//visualizzo
|
||||
$("#vistaFrasi").attr('style', 'display: d-flex;');
|
||||
cantoDisplayed = "#vistaFrasi";
|
||||
}
|
||||
var listIcon = ' <ion-icon name="list-outline"></ion-icon>';
|
||||
if (listaRisultatiCommenti.length > 0) {
|
||||
$("#headingZero").closest('.card').attr('style', 'display: d-flex;')
|
||||
var spanbadgelista = $('<span />');
|
||||
spanbadgelista.attr('class', 'badge badge-warning badge-pill mx-2 ');
|
||||
spanbadgelista.append(listaRisultatiCommenti.length + listIcon)
|
||||
spanbadgelista.appendTo($('#cantica0-badge'))
|
||||
//countResultContexts()
|
||||
numeroContesti = listaRisultatiCommenti.length;
|
||||
$("#loader").fadeOut(300);
|
||||
$("#cantica0").trigger("click");
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
if (!filterBottonAdded) {
|
||||
var cardRiferimenti = $("#tabRiferimenti")
|
||||
var filterButton = $('<button />');
|
||||
filterButton.attr('id', 'filterRiferimentiOn')
|
||||
filterButton.attr('class', 'btn btn-sm btn-outline-primary filterRiferimentiOn showcomments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
//var filterIcon = '<ion-icon name="funnel"></ion-icon>';
|
||||
var filterIcon = '<img id="filterImgOn" src="./images/filterOnPieno.png" width="50%" height="50%">'
|
||||
var filterIcon1 = '<img id="filterImgOff" src="./images/filterOffPieno.png" width="50%" height="50%">'
|
||||
//var filterIcon1 = '<ion-icon name="funnel-outline"></ion-icon>';
|
||||
var filterButton1 = $('<button />');
|
||||
filterButton1.attr('id', 'filterRiferimentiOff')
|
||||
filterButton1.attr('class', 'btn btn-sm btn-outline-primary filterRiferimentiOff showcomments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
filterButton1.append(filterIcon1)
|
||||
filterButton1.css('display', 'none');
|
||||
filterButton.css('display', 'none');
|
||||
|
||||
filterButton.append(filterIcon)
|
||||
filterButton.appendTo(cardRiferimenti)
|
||||
filterButton1.appendTo(cardRiferimenti)
|
||||
filterBottonAdded = true;
|
||||
}
|
||||
|
||||
const emptyNoteList = '<div class="card card-body well well-sm m-1 mt-2 p-0" id="noteCard0"><span class="p-3 text-muted bg-lida-vis small" style="opacity: 0.6;">Nessun commento visualizzato</span></div>';
|
||||
$('#displaynote').empty()
|
||||
$('#displaynote').append($(emptyNoteList))
|
||||
}
|
||||
|
||||
manageRisultatoCommmenti = function(start, offset = showOffset) {
|
||||
var commentoRisultato = [];
|
||||
var cantica;
|
||||
var canto;
|
||||
var verso;
|
||||
var idFrase = 0;
|
||||
var cid;
|
||||
var numCantica;
|
||||
var ultimoVersoPrecedente;
|
||||
elencoRiferimenti = $("#vistaFrasi");
|
||||
elencoRiferimenti.empty();
|
||||
|
||||
if (cantoDisplayed != '#vistaFrasi') {
|
||||
prevCantoDisplayed = cantoDisplayed;
|
||||
$(cantoDisplayed).css("display", "none");
|
||||
//visualizzo
|
||||
$("#vistaFrasi").attr('style', 'display: d-flex;');
|
||||
cantoDisplayed = "#vistaFrasi";
|
||||
}
|
||||
|
||||
for (var j = start; j < start+offset; j++) {
|
||||
commentoRisultato = listaRisultatiCommenti[j].split("_")
|
||||
var listaVersi = $('<ol class="pt-3" />')
|
||||
idFrase++;
|
||||
listaVersi.attr('id', "Frase" + idFrase);
|
||||
var versiFrase = $('<div class="versiFrase mt-3" />')
|
||||
versiFrase.attr('id', "versiFrase" + idFrase);
|
||||
cantica = commentoRisultato[0];
|
||||
canto = commentoRisultato[2];
|
||||
|
||||
cid = cantica + "Canto_" + canto
|
||||
switch (cantica) {
|
||||
case "Inferno":
|
||||
numCantica = 1;
|
||||
break;
|
||||
case "Purgatorio":
|
||||
numCantica = 2;
|
||||
break;
|
||||
case "Paradiso":
|
||||
numCantica = 3
|
||||
break;
|
||||
}
|
||||
if (!(loadedCanti.has(cid))) {
|
||||
showCanto(formeprima, numCantica, canto)
|
||||
loadedCanti.add(cid)
|
||||
}
|
||||
|
||||
verso = Number(commentoRisultato[3]);
|
||||
if (verso <= ultimoVersoPrecedente) {
|
||||
$("#" + cantica + '_Canto_' + canto + '_' + verso).addClass("mark ")
|
||||
continue;
|
||||
}
|
||||
$("#" + cantica + '_Canto_' + canto + '_' + verso).addClass("mark ")
|
||||
|
||||
for (var num = 0; num<versiPerGruppo; num++){
|
||||
var liVerso = $("#" + cantica + '_Canto_' + canto + '_' + verso).clone()
|
||||
versiFrase.append(liVerso)
|
||||
verso++
|
||||
}
|
||||
|
||||
ultimoVersoPrecedente = verso;
|
||||
|
||||
listaVersi.append(versiFrase)
|
||||
elencoRiferimenti.append(listaVersi)
|
||||
var citazioneDiv = $('<div class=" text-right flex-nowrap d-inline ml-3 px-3 py-0"/>')
|
||||
var citazione = $('<span class= " pl-3 citazioneFrase align-text-top"/>')
|
||||
|
||||
citazione.append("[" + cantica + ", Canto " + getRoman(canto) + "]")
|
||||
citazione.attr('name', cantica + "Canto " + canto);
|
||||
citazione.attr('id', idCitazione + '_' + numCantica + '_' + (verso-versiPerGruppo));
|
||||
citazione.appendTo(citazioneDiv);
|
||||
citazioneDiv.appendTo(elencoRiferimenti)
|
||||
|
||||
}
|
||||
showingComments = true;
|
||||
|
||||
return verso;
|
||||
}
|
||||
function executeLocalSearch(testo, forme, limit, cantica, cont, resultsInCantica, resultsInCanto) {
|
||||
|
||||
for (var ip = 0; ip <= limit; ip++) {
|
||||
|
@ -1668,6 +1839,8 @@ $(document).ready(function() {
|
|||
var elverso, formaItem, currSentenceId;
|
||||
var ultimaFormaCanto;
|
||||
let numeroPeriodo = 1;
|
||||
showingComments = false;
|
||||
|
||||
formecantica.map(function(item) {
|
||||
formaItem = item.split("_");
|
||||
var sentenceid = idcantica + "_" + formaItem[1] + "_s_" + formaItem[5]
|
||||
|
|
|
@ -142,7 +142,7 @@ export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
|||
|
||||
var result4 = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
console.log(result4)
|
||||
|
||||
await tconn.close();
|
||||
return result4
|
||||
|
||||
|
@ -234,48 +234,25 @@ export async function queryRiferimenti(filtro, cid) {
|
|||
var resxcantica = Object.groupBy(result4, ({ Cantica }) => Cantica);
|
||||
var resKeys = Object.keys(resxcantica);
|
||||
|
||||
for (let key = 0; key < resKeys.length; key++) {
|
||||
|
||||
switch(resKeys[key]){
|
||||
case "Inferno": resxcantica.Inferno.sort(function(a, b) {
|
||||
var valA = a.Verso.split('-')[0]
|
||||
var valB = b.Verso.split('-')[0]
|
||||
return a.Canto.localeCompare(b.Canto) || Number(valA) - Number(valB);
|
||||
});
|
||||
break;
|
||||
case "Purgatorio": resxcantica.Purgatorio.sort(function(a, b) {
|
||||
var valA = a.Verso.split('-')[0]
|
||||
var valB = b.Verso.split('-')[0]
|
||||
return a.Canto.localeCompare(b.Canto) || Number(valA) - Number(valB);
|
||||
});
|
||||
break;
|
||||
case "Paradiso": resxcantica.Paradiso.sort(function(a, b) {
|
||||
var valA = a.Verso.split('-')[0]
|
||||
var valB = b.Verso.split('-')[0]
|
||||
return a.Canto.localeCompare(b.Canto) || Number(valA) - Number(valB);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
listaidversi = []
|
||||
var arrayIdx = 0;
|
||||
//var tuttiVersiInferno = []
|
||||
var tuttiVersiPurgatorio= []
|
||||
var tuttiVersiParadiso = []
|
||||
|
||||
|
||||
if (resKeys.includes("Inferno")){
|
||||
listaidversi[arrayIdx] = resxcantica.Inferno;
|
||||
arrayIdx++;
|
||||
sortRiferimenti(resxcantica.Inferno,listaidversi)
|
||||
}
|
||||
if (resKeys.includes("Purgatorio")){
|
||||
listaidversi[arrayIdx] = resxcantica.Purgatorio;
|
||||
arrayIdx++;
|
||||
sortRiferimenti(resxcantica.Purgatorio,tuttiVersiPurgatorio)
|
||||
listaidversi = listaidversi.concat(tuttiVersiPurgatorio)
|
||||
}
|
||||
if (resKeys.includes("Paradiso")){
|
||||
listaidversi[arrayIdx] = resxcantica.Paradiso;
|
||||
arrayIdx++;
|
||||
sortRiferimenti(resxcantica.Paradiso,tuttiVersiParadiso)
|
||||
listaidversi = listaidversi.concat(tuttiVersiParadiso)
|
||||
}
|
||||
|
||||
|
||||
var numcid = cid.split('_')[1]
|
||||
for (var cantica in resxcantica) {
|
||||
var $nctags = $(' .navig-canto')
|
||||
|
||||
|
@ -304,28 +281,10 @@ export async function queryRiferimenti(filtro, cid) {
|
|||
}
|
||||
spanbadge.appendTo($nctags.filter('[name="' + cantica + 'Canto ' + canto + '"]'))
|
||||
for (const tmpvi of tmpv) {
|
||||
var myveid = '#' + cantica + '_Canto_' + canto + '_' + tmpvi.Verso.split('-')[0]
|
||||
|
||||
console.log(myveid)
|
||||
listaidversi.push(myveid)
|
||||
listaidcommenti.push(tmpvi.IdRiferimento)
|
||||
if (cid.includes(cantica) && numcid == canto){
|
||||
var multiButton = $('<button />');
|
||||
multiButton.attr('id','CommentoQuery_'+ i + '_' + canto + '_' + tmpvi.Verso.split('-')[0])
|
||||
multiButton.attr('class', 'btn btn-sm btn-outline-primary showcomments bg-light border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
var commentIcon = '<ion-icon name="document-attach"></ion-icon>';
|
||||
multiButton.append (commentIcon)
|
||||
var idButton = null;
|
||||
idButton = $('#'+ 'CommentoQuery_'+ i + '_' + canto + '_' + tmpvi.Verso.split('-')[0]);
|
||||
if (idButton [0] == null){
|
||||
$(myveid).append(multiButton);
|
||||
}
|
||||
$(myveid).addClass("mark ") // Nik Riferimenti
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
drawMinimap(cid, true)
|
||||
|
||||
}
|
||||
|
@ -333,7 +292,33 @@ export async function queryRiferimenti(filtro, cid) {
|
|||
return listaidversi
|
||||
|
||||
}
|
||||
|
||||
function sortRiferimenti(canticaArray,arrayValues){
|
||||
var versi = []
|
||||
var cantica;
|
||||
var canto;
|
||||
for (var j = 0; j < canticaArray.length; j++) {
|
||||
versi = canticaArray[j].Verso.split("-")
|
||||
cantica = canticaArray[j].Cantica
|
||||
canto = canticaArray[j].Canto
|
||||
if (canto.startsWith('0')) {
|
||||
canto = canto.replace('0', '')
|
||||
}
|
||||
arrayValues.push(cantica + '_Canto_' + canto + '_' + versi[0])
|
||||
}
|
||||
arrayValues.sort(function(a, b) {
|
||||
var versoA = a.split('_')
|
||||
var versoB = b.split('_')
|
||||
var cantoA = Number(versoA[2]);
|
||||
var cantoB = Number(versoB[2])
|
||||
versoA = versoA[3];
|
||||
versoB = versoB[3];
|
||||
if (cantoA == cantoB){
|
||||
return (versoA - versoB)
|
||||
}else{
|
||||
return (cantoA - cantoB)
|
||||
}
|
||||
});
|
||||
}
|
||||
function opzioniRiferimenti() {
|
||||
$.each(rif_commentatori, function(i, p) {
|
||||
if (!!p && p.length > 2) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import {numeroContesti, resetResult, showOffset} from './browseMgr_5.0.js'
|
||||
import {numeroContesti, resetResult, isSearchRiferimenti, manageRisultatoCommmenti, showOffset} from './browseMgr_5.0.js'
|
||||
import { resetGraphStr } from './syntgraph_5.0.js';
|
||||
import { getAutoriFontiCitazioniS, getCommentatoriS, getAreeTematicheS, getFontiS} from './dataMgr_5.0.js';
|
||||
|
||||
|
@ -716,8 +716,7 @@ $(document).ready(function() {
|
|||
var nRisultatiPerPag = 30;//showOffset;
|
||||
|
||||
// Fine variabili
|
||||
|
||||
|
||||
|
||||
getJsonQuery = function(){
|
||||
return queryJson;
|
||||
};
|
||||
|
@ -1636,6 +1635,7 @@ $(document).ready(function() {
|
|||
};
|
||||
|
||||
function managePage() {
|
||||
|
||||
if (currPage == 0){
|
||||
numeroPagine = Math.ceil(numeroContesti/nRisultatiPerPag);
|
||||
$("#paginaLista option").remove();
|
||||
|
@ -1668,7 +1668,13 @@ $(document).ready(function() {
|
|||
}
|
||||
};
|
||||
};
|
||||
$.manageResultList((currPage-1)*nRisultatiPerPag, nRisultatiPerPag);
|
||||
if (isSearchRiferimenti) {
|
||||
manageRisultatoCommmenti((currPage - 1) * nRisultatiPerPag, nRisultatiPerPag)
|
||||
|
||||
} else {
|
||||
$.manageResultList((currPage - 1) * nRisultatiPerPag, nRisultatiPerPag);
|
||||
|
||||
}
|
||||
if (latestPhraseId != "") {
|
||||
document.getElementById(latestPhraseId).scrollIntoView({
|
||||
behavior: "smooth",
|
||||
|
|
Loading…
Reference in New Issue