ris riferimenti, in progress
This commit is contained in:
parent
739d7a5262
commit
6d0dc88adf
|
@ -61,6 +61,7 @@ $(document).ready(function() {
|
|||
/*var commentsArray = []
|
||||
var commentsJson = {}*/
|
||||
var commentsSQL = {}
|
||||
var resultcommentsSQL = {}
|
||||
/*var resultSentences = new Set()*/
|
||||
const cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
||||
var loadedCanti = new Set();
|
||||
|
@ -581,7 +582,7 @@ $(document).ready(function() {
|
|||
const cid = $(this).attr('name').replace(" ", "_");
|
||||
var telive = getListaRis()
|
||||
cantoDisplayed = "#" + cid;
|
||||
|
||||
|
||||
|
||||
|
||||
if (telive.length > 0) {
|
||||
|
@ -606,16 +607,16 @@ $(document).ready(function() {
|
|||
forma = formeterza;
|
||||
numeroCantica = 3;
|
||||
}
|
||||
|
||||
|
||||
if (!(loadedCanti.has(cid))) {
|
||||
showCanto(forma, '1', parcid[1])
|
||||
loadedCanti.add(cid)
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (var tel of telive) {
|
||||
var telId = tel.split("_");
|
||||
var commento = "#Commento_"+numeroCantica+"_" + telId[2] + "_" + telId[3];
|
||||
var commento = "#Commento_" + numeroCantica + "_" + telId[2] + "_" + telId[3];
|
||||
telId = "#" + telId[0] + telId[1] + "_" + telId[2];
|
||||
$(commento).addClass("risultato ")
|
||||
$(telId + " #" + tel.replace('|', '')).addClass("mark ")
|
||||
|
@ -1022,7 +1023,12 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
var noteAdded;
|
||||
|
||||
jQuery(document).delegate(' .showcomments', 'click', function() {
|
||||
if (cantoDisplayed.includes('#vistaFrasi')) {
|
||||
showCommentsInResult($(this).attr('id'), $(this).attr('class'))
|
||||
return
|
||||
}
|
||||
var cid = $(this).attr('id');
|
||||
var queryComment = false;
|
||||
var idClass = $(this).attr('class');
|
||||
|
@ -1129,6 +1135,35 @@ $(document).ready(function() {
|
|||
|
||||
})
|
||||
|
||||
function showCommentsInResult(tmpcid, tmpclass) {
|
||||
var queryComment = false;
|
||||
var myid=tmpcid.split('_')
|
||||
//var parentClass = $(this).parent().attr('class');
|
||||
filterOn = true;
|
||||
|
||||
if (tmpclass.includes("filterRiferimentiOn")) {
|
||||
filterOn = true;
|
||||
} else {
|
||||
if (tmpclass.includes("filterRiferimentiOff")) {
|
||||
filterOn = false;
|
||||
}
|
||||
}
|
||||
var tmpresu = getRisultatiRiferimenti()
|
||||
|
||||
var resultComments = Object.groupBy(tmpresu, ({ Cantica }) => Cantica);
|
||||
|
||||
var tcantica='Inferno'
|
||||
if (myid=='2')
|
||||
tcantica='Purgatorio'
|
||||
if (myid=='3')
|
||||
tcantica='Paradiso'
|
||||
if (! tcantica in resultComments)
|
||||
return
|
||||
var tmpCanti=resultComments[tcantica]
|
||||
var cantiComments=Object.groupBy(tmpresu, ({ Canto }) => Canto);
|
||||
|
||||
}
|
||||
|
||||
function createNoteGroup(cantica, canto, versi, id, len, queryComment) {
|
||||
var noteGroupCard = $('<div class="card card-body noteCardGroup well well-sm mx-1 my-2 p-0" id="noteGroupCard' + id + '">');
|
||||
var commentHeader = $('<div class="d-flex align-content-start flex-nowrap text-muted" id="commentoGruppoVersi' + id + '">')
|
||||
|
@ -1655,7 +1690,7 @@ $(document).ready(function() {
|
|||
//var latestPhraseId = "";
|
||||
var telive = getListaRis()
|
||||
var numeroCantica;
|
||||
|
||||
|
||||
for (var ve of telive) {
|
||||
//let idve = ve
|
||||
var telId = ve.split("_");
|
||||
|
@ -1667,14 +1702,14 @@ $(document).ready(function() {
|
|||
case "Paradiso": numeroCantica = 3;
|
||||
break;
|
||||
}
|
||||
var commento = "#Commento_"+numeroCantica+"_" + telId[2] + "_" + telId[3];
|
||||
var commento = "#Commento_" + numeroCantica + "_" + telId[2] + "_" + telId[3];
|
||||
$(commento).removeClass("risultato ")
|
||||
if (ve[0]!='#')
|
||||
ve='#'+ve
|
||||
if (ve[0] != '#')
|
||||
ve = '#' + ve
|
||||
$(ve).removeClass("mark ")
|
||||
minim.contents().find(ve.replace('|', '')).removeClass("mark ")
|
||||
}
|
||||
|
||||
|
||||
const tmplistaidcomm = getListaIdCommenti()
|
||||
for (var idco of tmplistaidcomm) {
|
||||
//$('[name="' + cantica + 'Canto ' + k + '"]')
|
||||
|
@ -1721,7 +1756,7 @@ $(document).ready(function() {
|
|||
listaRisultatiCommenti = await queryRiferimentimul(jsonQuery, cantoDisplayed)
|
||||
}
|
||||
//carico i commenti risultato della query
|
||||
|
||||
|
||||
showRisultatiCommenti(listaRisultatiCommenti)
|
||||
return
|
||||
}
|
||||
|
@ -1864,24 +1899,24 @@ $(document).ready(function() {
|
|||
$("#vistaFrasi").attr('style', 'display: d-flex;');
|
||||
cantoDisplayed = "#vistaFrasi";
|
||||
}
|
||||
|
||||
|
||||
var uniq_res = [...new Set(listaRisultatiCommenti)];
|
||||
var risLen = uniq_res.length;
|
||||
var risultato=''
|
||||
var risultato = ''
|
||||
var setVersicontesto = new Set()
|
||||
for (var j = start; j < start + offset && j < risLen; j++) {
|
||||
numeroRisultato++
|
||||
commentoRisultato = uniq_res[j].replace('#','').split("_")
|
||||
risultato=uniq_res[j]
|
||||
|
||||
if (setVersicontesto.has(commentoRisultato[0]+'_Canto_'+commentoRisultato[2]+'_'+commentoRisultato[3]+'_sp'))
|
||||
commentoRisultato = uniq_res[j].replace('#', '').split("_")
|
||||
risultato = uniq_res[j]
|
||||
|
||||
if (setVersicontesto.has(commentoRisultato[0] + '_Canto_' + commentoRisultato[2] + '_' + commentoRisultato[3] + '_sp'))
|
||||
continue
|
||||
|
||||
|
||||
var cre = getVersoContext(commentoRisultato, 3)
|
||||
//console.log(cre)
|
||||
|
||||
|
||||
var divVerso = ''
|
||||
var elementoversospan=''
|
||||
var elementoversospan = ''
|
||||
var numeroCantica = 0
|
||||
var canto = 0
|
||||
var versiIniziali = $('<div class="versiFrase mt-3" />')
|
||||
|
@ -1889,7 +1924,7 @@ $(document).ready(function() {
|
|||
|
||||
listaVersi.attr('id', "Frase" + numeroRisultato);
|
||||
versiIniziali.attr('id', "versiFrase" + numeroRisultato);
|
||||
if(commentoRisultato[3]!='Proemio'){
|
||||
if (commentoRisultato[3] != 'Proemio') {
|
||||
var numeroVersi = 0;
|
||||
|
||||
for (var forma of cre) {
|
||||
|
@ -1897,32 +1932,32 @@ $(document).ready(function() {
|
|||
numeroCantica = forma.cantica
|
||||
canto = forma.canto
|
||||
}
|
||||
if (!setVersicontesto.has(forma.cantica+'_Canto_'+forma.canto+'_'+forma.verso+'_sp')) {
|
||||
divVerso = createDivVersoGenericLi(forma.cantica, forma.verso+'_res', 'Canto_'+forma.canto)
|
||||
if (!setVersicontesto.has(forma.cantica + '_Canto_' + forma.canto + '_' + forma.verso + '_sp')) {
|
||||
divVerso = createDivVersoGenericLi(forma.cantica, forma.verso + '_res', 'Canto_' + forma.canto)
|
||||
elementoversospan = $('<span />')
|
||||
elementoversospan.attr('id', forma.cantica + "_" + 'Canto_'+forma.canto + "_" + forma.verso + '_sp_res')
|
||||
elementoversospan.attr('id', forma.cantica + "_" + 'Canto_' + forma.canto + "_" + forma.verso + '_sp_res')
|
||||
divVerso.append(elementoversospan)
|
||||
versiIniziali.append(divVerso)
|
||||
listaVersi.append(versiIniziali)
|
||||
elencoRiferimenti.append(listaVersi)
|
||||
setVersicontesto.add(forma.cantica+'_Canto_'+forma.canto+'_'+forma.verso+'_sp')
|
||||
setVersicontesto.add(forma.cantica + '_Canto_' + forma.canto + '_' + forma.verso + '_sp')
|
||||
numeroVersi++;
|
||||
}
|
||||
|
||||
|
||||
createSpanFormeNew(forma.testo, forma.catg, 'e' + forma.posizione, forma.periodo, forma.funzperiodo, elementoversospan)
|
||||
}
|
||||
}
|
||||
else{
|
||||
divVerso = createDivVersoGenericLi(commentoRisultato[0], '0_res', 'Canto_'+commentoRisultato[2])
|
||||
else {
|
||||
divVerso = createDivVersoGenericLi(commentoRisultato[0], '0_res', 'Canto_' + commentoRisultato[2])
|
||||
elementoversospan = $('<span />')
|
||||
elementoversospan.attr('id', commentoRisultato[0] + "_" + 'Canto_'+commentoRisultato[2] + '_0_sp_res')
|
||||
elementoversospan.attr('id', commentoRisultato[0] + "_" + 'Canto_' + commentoRisultato[2] + '_0_sp_res')
|
||||
divVerso.append(elementoversospan)
|
||||
versiIniziali.append(divVerso)
|
||||
listaVersi.append(versiIniziali)
|
||||
elencoRiferimenti.append(listaVersi)
|
||||
setVersicontesto.add(commentoRisultato[0]+'P')
|
||||
setVersicontesto.add(commentoRisultato[0] + 'P')
|
||||
numeroVersi++;
|
||||
var testoProemio = commentoRisultato[0]+", Canto "+commentoRisultato[2]+" Proemio"
|
||||
var testoProemio = commentoRisultato[0] + ", Canto " + commentoRisultato[2] + " Proemio"
|
||||
createSpanFormeNew(testoProemio, '* ', 'e0', '*', '*', elementoversospan)
|
||||
}
|
||||
var comandi = $('<div class=" comandi col flex-nowrap d-inline justify-content-between pl-1 pb-2 ml-2 mb-2 border-bottom"/>')
|
||||
|
@ -1930,8 +1965,8 @@ $(document).ready(function() {
|
|||
var comandiGrp = $('<div />')
|
||||
comandiGrp.attr('class', 'btn-group flex-nowrap d-inline pr-3 mt-1 mr-3 align-text-bottom');
|
||||
comandiGrp.attr('role', "group")
|
||||
|
||||
|
||||
|
||||
|
||||
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"/>')
|
||||
|
@ -1941,37 +1976,37 @@ $(document).ready(function() {
|
|||
citazione.appendTo(citazioneDiv);
|
||||
|
||||
citazioneDiv.appendTo(comandi);
|
||||
|
||||
|
||||
comandi.appendTo(elencoRiferimenti);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//ottimizzare
|
||||
// evidenzio i versi con almeno un risultato
|
||||
for (var tres of uniq_res){
|
||||
for (var tres of uniq_res) {
|
||||
if (tres.includes('Proemio'))
|
||||
tres=tres.replace('Proemio','0')
|
||||
$('#' + tres+'_res').addClass("mark ")
|
||||
|
||||
tres = tres.replace('Proemio', '0')
|
||||
$('#' + tres + '_res').addClass("mark ")
|
||||
|
||||
}
|
||||
|
||||
|
||||
//metto l'icona anche ai versi che hanno riferimenti ma che non sono nel resultset
|
||||
var versicontesto = [...setVersicontesto];
|
||||
for (var elverso of versicontesto){
|
||||
if (versoCommentato (elverso)){
|
||||
var tresa=elverso.split('_')
|
||||
var tcantica='1'
|
||||
if (tresa[0]=='Purgatorio')
|
||||
tcantica='2'
|
||||
if (tresa[0]=='Paradiso')
|
||||
tcantica='3'
|
||||
var tverso= tresa[3]
|
||||
var aidCommento = "CommentoRes_" + tcantica + "_" + tresa[2] + '_'+tverso;
|
||||
var apio = $("#" + aidCommento )
|
||||
for (var elverso of versicontesto) {
|
||||
if (versoCommentato(elverso)) {
|
||||
var tresa = elverso.split('_')
|
||||
var tcantica = '1'
|
||||
if (tresa[0] == 'Purgatorio')
|
||||
tcantica = '2'
|
||||
if (tresa[0] == 'Paradiso')
|
||||
tcantica = '3'
|
||||
var tverso = tresa[3]
|
||||
var aidCommento = "CommentoRes_" + tcantica + "_" + tresa[2] + '_' + tverso;
|
||||
var apio = $("#" + aidCommento)
|
||||
if (apio.length)
|
||||
continue;
|
||||
var myverso = $('#'+elverso.replace('sp', 'res'))
|
||||
var myverso = $('#' + elverso.replace('sp', 'res'))
|
||||
createCommentSpan(aidCommento, myverso, 1)
|
||||
}
|
||||
}
|
||||
|
@ -2164,9 +2199,9 @@ $(document).ready(function() {
|
|||
var spanoccorrenza = $('<button />')
|
||||
spanoccorrenza.attr('id', idVerso)
|
||||
//btn-sm btn-outline-secondary
|
||||
if (idVerso.startsWith("CommentoRes_")){
|
||||
if (idVerso.startsWith("CommentoRes_")) {
|
||||
spanoccorrenza.attr('class', 'btn btn-sm btn-outline-primary risultato showcomments bg-light border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
}else{
|
||||
} else {
|
||||
spanoccorrenza.attr('class', 'btn btn-sm btn-outline-primary showcomments bg-light border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
|
||||
}
|
||||
|
@ -2271,7 +2306,7 @@ $(document).ready(function() {
|
|||
var elementoverso = $('<li />')
|
||||
/*var elementoversospan=$('<span />')*/
|
||||
//elementoverso.append(spannum)
|
||||
|
||||
|
||||
elementoverso.attr("value", num)
|
||||
|
||||
//elementoverso.attr("style", "line-height: 1.0em")
|
||||
|
|
|
@ -12,6 +12,7 @@ var listaidversi = []
|
|||
var listaversicommentati=[]
|
||||
var listaidcommenti = []
|
||||
var listarisriferimenti = []
|
||||
var listariferimentirisultato=[]
|
||||
const cantobadgeclassBis = 'badge badge-outline-warning badge-pill'
|
||||
|
||||
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
||||
|
@ -121,8 +122,8 @@ export function versoCommentato(rif) {
|
|||
}
|
||||
|
||||
export function getRisultatiRiferimenti() {
|
||||
listarisriferimenti=[... new Set(listarisriferimenti)]
|
||||
return listarisriferimenti;
|
||||
//listarisriferimenti=[... new Set(listarisriferimenti)]
|
||||
return listariferimentirisultato;
|
||||
}
|
||||
export function getListaRis() {
|
||||
return listaidversi;
|
||||
|
@ -134,6 +135,7 @@ export function cleanListaRis() {
|
|||
listaidversi = [];
|
||||
listaidcommenti = [];
|
||||
listarisriferimenti = [];
|
||||
listariferimentirisultato=[]
|
||||
}
|
||||
export function getFontiS() {
|
||||
|
||||
|
@ -196,18 +198,18 @@ async function getCitazioniInVerso(canticapar = '', cantopar = '', versovar='')
|
|||
RCC as RapportoCommentoCommentatoreText, RSO as RapportoSoggettoOggetto,
|
||||
Aut as NomeAutoreCitazione, TiFo as TitoloFonteCitazione, Verso as VersoCitazione, CA as AreaTematica,
|
||||
TiCi as TipoCitazione, CEP as CitEpisodi, CIM as CitImmagini, CTE as CitTeorie,
|
||||
CMO as CitMotivi, CST as CitStilemi, CTO as CitTopografie, CPER as CitPersonaggi, IdRiferimento, n1, n2, n3
|
||||
CMO as CitMotivi, CST as CitStilemi, CTO as CitTopografie, CPER as CitPersonaggi, IdRiferimento, Cantica, Canto n1, n2, n3
|
||||
from riferimenti
|
||||
where Cantica='${canticapar}' and Canto='${cantopar}' and Verso='${versovar}' order by n1, n2, n3;
|
||||
`);
|
||||
|
||||
var resultvc = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
listarisriferimenti=listarisriferimenti.concat(resultvc)
|
||||
listariferimentirisultato=listariferimentirisultato.concat(resultvc)
|
||||
|
||||
|
||||
await tconn.close();
|
||||
return resultvc
|
||||
//return resultvc
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
value: defaultEditorQuery
|
||||
},
|
||||
requestConfig : {
|
||||
endpoint : "https://lida.dantenetwork.it/fuseki/commedia/query"
|
||||
endpoint : "https://hdnlab1.isti.cnr.it/fuseki/commedia/query"
|
||||
},
|
||||
copyEndpointOnNewTab : false,
|
||||
resizeable : true,
|
||||
|
|
Loading…
Reference in New Issue