2022-11-06 17:12:56 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var resetResult;
|
|
|
|
var lsid;
|
2023-02-03 15:42:34 +01:00
|
|
|
var lsentid;
|
|
|
|
const formaClass='frm'
|
2023-02-08 17:07:49 +01:00
|
|
|
var selectedVista;
|
2023-03-08 09:31:58 +01:00
|
|
|
var listaPeriodiRisultato;
|
2023-03-09 12:49:29 +01:00
|
|
|
var listaClausoleRisultato;
|
2023-03-16 14:29:51 +01:00
|
|
|
var numeroContesti;
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
lsid='';
|
2023-02-01 08:57:41 +01:00
|
|
|
removeGraph=false;
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2023-12-21 12:48:32 +01:00
|
|
|
const cantobadgeclass = 'badge badge-outline-warning badge-pill'
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
const sparqlGenerator = sparqljs.Generator;
|
|
|
|
const myEngine = new Comunica.QueryEngine();
|
|
|
|
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
|
2023-06-08 16:14:17 +02:00
|
|
|
//const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/CommediaReasoningTest/query";
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
var shownSentenceList = new Set()
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-03-15 11:07:44 +01:00
|
|
|
listarisultati = [];
|
2023-03-08 09:31:58 +01:00
|
|
|
listaPeriodiRisultato = [];
|
2023-03-09 12:49:29 +01:00
|
|
|
listaClausoleRisultato=[]
|
2023-05-23 18:27:35 +02:00
|
|
|
var commentsArray = []
|
2023-12-19 15:35:44 +01:00
|
|
|
var commentsJson = {}
|
2023-01-24 15:40:28 +01:00
|
|
|
var resultSentences = new Set()
|
2023-01-30 15:57:30 +01:00
|
|
|
var cantiche=["Inferno", "Purgatorio","Paradiso"]
|
|
|
|
var loadedCanti=new Set();
|
2023-02-08 17:07:49 +01:00
|
|
|
const openSTag="{"
|
|
|
|
const closeSTag="}"
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2023-02-07 10:51:30 +01:00
|
|
|
var cantoDisplayed = "#InfernoCanto_1";
|
2023-02-27 09:40:26 +01:00
|
|
|
var prevCantoDisplayed = "#InfernoCanto_1";
|
2023-02-22 11:20:16 +01:00
|
|
|
var contextLength = 3;
|
2023-03-15 16:32:23 +01:00
|
|
|
var showOffset = 30;
|
2023-03-15 10:03:56 +01:00
|
|
|
var idCitazione = "citazioneFrase";
|
2023-02-16 08:59:44 +01:00
|
|
|
|
2023-11-07 08:41:14 +01:00
|
|
|
initCitazioni();
|
2023-05-23 18:27:35 +02:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
resetResult=function(){
|
|
|
|
//console.log('clean result')
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
}
|
|
|
|
|
2023-02-27 09:21:07 +01:00
|
|
|
//hideMinimap();
|
2023-01-24 15:40:28 +01:00
|
|
|
createAllDivCanti()
|
2023-02-23 10:27:17 +01:00
|
|
|
//const start = performance.now();
|
2023-01-30 15:57:30 +01:00
|
|
|
showCanto(formeprima, '1','1')
|
2023-02-01 17:46:32 +01:00
|
|
|
$("#InfernoCanto_1").attr('style', 'display: d-flex;')
|
2023-02-07 14:13:51 +01:00
|
|
|
loadedCanti.add("InfernoCanto_1")
|
2023-03-21 15:20:01 +01:00
|
|
|
drawMinimap("#InfernoCanto_1", false)
|
2023-02-23 10:27:17 +01:00
|
|
|
const minim=$(" .minimap__content")
|
|
|
|
//const end = performance.now();
|
|
|
|
//console.log(`Load cantiche time: ${end - start} ms`);
|
2023-02-09 13:20:25 +01:00
|
|
|
|
2023-02-07 10:51:30 +01:00
|
|
|
$("#valoreVista").on('change', function() {
|
2023-02-08 17:07:49 +01:00
|
|
|
selectedVista = $(this).val();
|
2023-02-07 10:51:30 +01:00
|
|
|
switch (selectedVista){
|
|
|
|
case "forme":
|
|
|
|
$("#vistaFrasi").css("display", "none");
|
|
|
|
$("#vistaDialoghi").css("display", "none");
|
|
|
|
$("#vistaMetafore").css("display", "none");
|
2023-02-08 17:07:49 +01:00
|
|
|
resetFrasi()
|
2023-02-07 10:51:30 +01:00
|
|
|
$(cantoDisplayed).attr('style', 'display: d-flex;')
|
|
|
|
break;
|
|
|
|
case "frasi":
|
2023-04-11 11:00:35 +02:00
|
|
|
//cancello il grafo sintattico
|
|
|
|
var periodograph=document.getElementById("periodograph");
|
|
|
|
if (periodograph!=null){
|
|
|
|
let showngr=periodograph.getAttribute('name').split("_")
|
|
|
|
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
|
|
|
|
resetSentenceStructure(tmpsent)
|
|
|
|
shownSentenceList.delete(tmpsent)
|
|
|
|
|
|
|
|
//$("#periodograph").empty()
|
|
|
|
periodograph.parentNode.removeChild(periodograph);
|
2023-04-19 16:55:30 +02:00
|
|
|
|
2023-04-11 11:00:35 +02:00
|
|
|
}
|
2023-02-07 10:51:30 +01:00
|
|
|
loadFrasi();
|
2023-02-27 09:21:07 +01:00
|
|
|
|
2023-02-07 10:51:30 +01:00
|
|
|
break;
|
|
|
|
case "metafore":
|
2023-02-08 17:07:49 +01:00
|
|
|
//loadMetafore();
|
2023-02-27 09:21:07 +01:00
|
|
|
|
2023-02-07 10:51:30 +01:00
|
|
|
break;
|
|
|
|
case "dialoghi":
|
2024-01-04 15:32:24 +01:00
|
|
|
resetFrasi()
|
|
|
|
loadDialoghi();
|
2023-02-27 09:21:07 +01:00
|
|
|
|
2023-02-07 10:51:30 +01:00
|
|
|
break;
|
2023-11-06 13:45:20 +01:00
|
|
|
case "citazioni":
|
|
|
|
//cancello il grafo sintattico
|
|
|
|
var periodograph=document.getElementById("periodograph");
|
|
|
|
if (periodograph!=null){
|
|
|
|
let showngr=periodograph.getAttribute('name').split("_")
|
|
|
|
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
|
|
|
|
resetSentenceStructure(tmpsent)
|
|
|
|
shownSentenceList.delete(tmpsent)
|
|
|
|
|
|
|
|
periodograph.parentNode.removeChild(periodograph);
|
|
|
|
}
|
2023-02-07 10:51:30 +01:00
|
|
|
}
|
|
|
|
});
|
2023-01-10 15:26:58 +01:00
|
|
|
|
2023-02-26 11:38:33 +01:00
|
|
|
|
2023-02-15 15:40:01 +01:00
|
|
|
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
$(" ."+formaClass).each(function(idx, element) {
|
2023-01-24 15:40:28 +01:00
|
|
|
// We cycle through the elements using each() so that we can choose the element specifically that we wish to clean up afterward
|
|
|
|
var ele = $(element);
|
|
|
|
ele.tooltip({
|
2023-02-08 17:07:49 +01:00
|
|
|
content: (function() {return formatTTContent(ele.attr('title'), ele.attr('class').split(' ')[1]);}),
|
2023-01-24 15:40:28 +01:00
|
|
|
classes:{"ui-tooltip":'Nik_dropdown-content'},
|
|
|
|
close: function (event, ui) {$(".ui-helper-hidden-accessible").remove();},
|
|
|
|
create: function(ev, ui) {$(this).data("ui-tooltip").liveRegion.remove();},
|
|
|
|
hide: false,
|
2023-02-23 10:27:17 +01:00
|
|
|
show: {delay: 800,duration: 0}
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-02-16 11:33:44 +01:00
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
$( " ."+formaClass ).dblclick(function() {
|
2023-02-01 08:57:41 +01:00
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
var sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
|
2023-02-03 15:42:34 +01:00
|
|
|
console.log('dblclick '+lisid)
|
2023-02-01 08:57:41 +01:00
|
|
|
if (shownSentenceList.has(sentenceId)){
|
|
|
|
resetSentenceStructure(sentenceId)
|
|
|
|
shownSentenceList.delete(sentenceId)
|
|
|
|
lsid=''
|
|
|
|
|
|
|
|
}
|
|
|
|
else{
|
2023-02-03 15:42:34 +01:00
|
|
|
//showSentenceStructure (sentenceId)
|
2023-02-01 08:57:41 +01:00
|
|
|
shownSentenceList.add(sentenceId)
|
|
|
|
|
2023-04-19 13:27:12 +02:00
|
|
|
|
2023-02-01 08:57:41 +01:00
|
|
|
}
|
|
|
|
});
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
|
2023-02-03 15:42:34 +01:00
|
|
|
$(" ."+formaClass).hover(function(idx, element) {
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
var sentenceId=$(this).attr('class').split(' ')[0].split('_')
|
2023-01-30 15:57:30 +01:00
|
|
|
var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3]
|
2023-02-03 15:42:34 +01:00
|
|
|
lsentid=$(this).attr('class').split(' ')[0]
|
2023-01-30 15:57:30 +01:00
|
|
|
lisid=tmplisid
|
|
|
|
});
|
2023-02-22 11:20:16 +01:00
|
|
|
|
2023-02-20 10:50:19 +01:00
|
|
|
|
2023-03-10 17:20:06 +01:00
|
|
|
/*
|
2023-03-13 11:57:34 +01:00
|
|
|
* Espansione del contesto
|
2023-03-10 17:20:06 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
jQuery(document).delegate(' .espandiFrase, .riduciFrase', 'click', function() {
|
2023-03-13 19:35:47 +01:00
|
|
|
if ($(this).hasClass("disabled")) {
|
|
|
|
return;
|
|
|
|
};
|
2023-03-13 09:24:31 +01:00
|
|
|
var posizioniEspansione=[]
|
2023-03-10 17:20:06 +01:00
|
|
|
var cid = $(this).attr('id');
|
|
|
|
var parcid = cid.split('_');
|
2023-03-12 21:07:35 +01:00
|
|
|
var posVerso
|
2023-03-10 17:20:06 +01:00
|
|
|
reit = '#versiFrase' + parcid[4]
|
|
|
|
var expcontextLength=$(reit+" > li").length
|
|
|
|
if(cid.includes('_er_')){
|
2023-03-13 10:04:20 +01:00
|
|
|
expcontextLength=contextLength
|
2023-03-11 11:25:05 +01:00
|
|
|
}else{
|
2023-03-12 21:07:35 +01:00
|
|
|
posVerso = $(reit).attr('posVerso')
|
|
|
|
if (posVerso == 1){ // caso inizio o fine canto
|
2023-03-11 11:25:05 +01:00
|
|
|
expcontextLength+=contextLength;
|
|
|
|
}
|
2023-03-10 17:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//svuoto la lista di versi
|
|
|
|
$(reit).empty()
|
|
|
|
//genero la nuova lista di versi
|
|
|
|
var versiContestoExp = getFormaContext(parseInt(parcid[3]), expcontextLength);
|
|
|
|
var divVersoExp=''
|
|
|
|
var setVersicontestoExp = new Set()
|
|
|
|
for (forma of versiContestoExp) {
|
|
|
|
if (!setVersicontestoExp.has(forma.verso)) {
|
|
|
|
divVersoExp = createDivVersoLI(forma.cantica, forma.verso, forma.canto)
|
|
|
|
$(reit).append(divVersoExp)
|
|
|
|
setVersicontestoExp.add(forma.verso)
|
|
|
|
}
|
|
|
|
createSpanFormeNew(forma.testo, forma.catg, 'e' + forma.posizione, forma.periodo, forma.funzperiodo, divVersoExp)
|
2023-03-13 09:24:31 +01:00
|
|
|
posizioniEspansione.push('e' + forma.posizione)
|
2023-03-10 17:20:06 +01:00
|
|
|
}
|
2023-03-11 11:25:05 +01:00
|
|
|
|
2023-03-10 17:20:06 +01:00
|
|
|
if(cid.includes('_er_')){
|
2023-03-13 19:35:47 +01:00
|
|
|
///$("#"+cid).css("display", "none");
|
|
|
|
$("#"+cid).removeClass( "btn-outline-primary" );
|
|
|
|
$("#"+cid).addClass( "btn-outline-secondary" );
|
|
|
|
$("#"+cid).addClass( "disabled" );
|
2023-03-10 17:20:06 +01:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
cid = cid.replace("ex","er");
|
2023-03-13 19:35:47 +01:00
|
|
|
///$("#"+cid).attr('style', 'display: d-flex;');
|
|
|
|
$("#"+cid).removeClass( "btn-outline-secondary" );
|
|
|
|
$("#"+cid).removeClass( "disabled" );
|
|
|
|
$("#"+cid).addClass( "btn-outline-primary" );
|
2023-03-10 17:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//evidenzio risultato
|
2023-03-16 11:20:13 +01:00
|
|
|
//var idris = '#e' + parcid[3]
|
|
|
|
//$(idris).addClass("font-weight-bold mark ")
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#e' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
|
|
|
}
|
|
|
|
|
2023-03-10 17:20:06 +01:00
|
|
|
//gestisco risultati se unità di ricerca è periodo
|
|
|
|
if (listaPeriodiRisultato.length){
|
|
|
|
for (msid of listaPeriodiRisultato){
|
|
|
|
loadPeriodo(msid)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//gestisce risultati se unità di ricerca è frase
|
|
|
|
if (listaClausoleRisultato.length){
|
|
|
|
for (clsid of listaClausoleRisultato){
|
|
|
|
let tmpid=clsid.split('-')
|
2024-01-03 15:09:53 +01:00
|
|
|
//loadFrase(tmpid[0], tmpid[1])
|
|
|
|
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
2023-03-10 17:20:06 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//aggiungo listeners
|
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
//addFormaListenersInRisultato(posizioniEspansione)
|
|
|
|
addFormaListenersInCanto()
|
2023-03-10 17:20:06 +01:00
|
|
|
|
2023-03-13 19:35:47 +01:00
|
|
|
//disegno minimap, onlyContent = true
|
|
|
|
drawMinimap('#vistaFrasi', true)
|
2023-03-16 11:20:13 +01:00
|
|
|
//manageMM('#vistaFrasi')
|
2023-03-10 17:20:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2023-02-11 13:01:48 +01:00
|
|
|
/*
|
|
|
|
* Costruzione e visualizzazione del risultato in frasi.
|
|
|
|
*/
|
2023-02-20 10:50:19 +01:00
|
|
|
|
2023-03-15 16:32:23 +01:00
|
|
|
/*
|
|
|
|
* Costruzione e visualizzazione del risultato in frasi.
|
|
|
|
*/
|
2023-03-15 18:12:38 +01:00
|
|
|
|
|
|
|
//$.manageResultList(start, offset)
|
2023-03-17 09:01:00 +01:00
|
|
|
var prevstart=-1
|
|
|
|
var prevoffset=-1
|
2023-03-15 18:37:58 +01:00
|
|
|
jQuery.manageResultList = function manageResultList(start, offset = showOffset){
|
2023-03-16 14:29:51 +01:00
|
|
|
|
2023-03-17 09:01:00 +01:00
|
|
|
if(offset==prevoffset && start==prevstart && cantoDisplayed=='#vistaFrasi')
|
|
|
|
return
|
|
|
|
console.log('Paginazione...')
|
|
|
|
prevstart=start
|
|
|
|
prevoffset=offset
|
2023-03-16 14:29:51 +01:00
|
|
|
if(cantoDisplayed!='#vistaFrasi'){
|
|
|
|
prevCantoDisplayed=cantoDisplayed;
|
2023-03-15 18:12:38 +01:00
|
|
|
$(cantoDisplayed).css("display", "none");
|
2023-03-16 11:20:13 +01:00
|
|
|
//visualizzo
|
|
|
|
$("#vistaFrasi").attr('style', 'display: d-flex;');
|
2023-03-16 17:10:26 +01:00
|
|
|
cantoDisplayed="#vistaFrasi";
|
2023-03-15 18:12:38 +01:00
|
|
|
}
|
2023-03-17 09:01:00 +01:00
|
|
|
|
2023-03-16 11:20:13 +01:00
|
|
|
//listarisultati.sort(function(a, b){return a - b});
|
2023-03-16 14:29:51 +01:00
|
|
|
showFrasi (start, offset)
|
2023-03-15 18:12:38 +01:00
|
|
|
if (selectedVista=='frasi'){
|
|
|
|
loadFrasi();
|
2024-01-04 15:32:24 +01:00
|
|
|
}
|
|
|
|
if (selectedVista=='dialoghi'){
|
|
|
|
loadDialoghi();
|
2023-03-15 18:12:38 +01:00
|
|
|
}
|
|
|
|
addFormaListenersInCanto()
|
2023-03-21 15:20:01 +01:00
|
|
|
drawMinimap('#vistaFrasi', false)
|
2023-03-16 11:20:13 +01:00
|
|
|
|
2023-03-15 18:12:38 +01:00
|
|
|
}
|
|
|
|
|
2023-03-16 14:29:51 +01:00
|
|
|
function countResultContexts(){
|
|
|
|
var numeroRisultati = 0;
|
|
|
|
var ultimaPosizione = -1;
|
|
|
|
for (risultato of listarisultati){
|
|
|
|
if (risultato <= parseInt(ultimaPosizione)){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
numeroRisultati=numeroRisultati+1;
|
|
|
|
var versiContesto= getFormaContext(risultato, contextLength);
|
|
|
|
var ultimaForma=versiContesto.slice(-1)
|
|
|
|
ultimaPosizione=ultimaForma[0].posizione
|
|
|
|
}
|
|
|
|
console.log('N. contesti: '+numeroRisultati)
|
|
|
|
numeroContesti=numeroRisultati
|
|
|
|
return (numeroRisultati)
|
|
|
|
}
|
2023-03-15 18:12:38 +01:00
|
|
|
|
2023-03-16 17:10:26 +01:00
|
|
|
function getResInPage(startcont, endcont){
|
|
|
|
var res = [];
|
|
|
|
var ultimaPosizione = -1;
|
|
|
|
var contaContesti=0
|
|
|
|
for (risultato of listarisultati){
|
|
|
|
if (risultato <= parseInt(ultimaPosizione)){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
contaContesti=contaContesti+1;
|
|
|
|
if (contaContesti >= startcont && contaContesti < endcont){
|
|
|
|
res.push(risultato)
|
|
|
|
}
|
|
|
|
if (contaContesti > endcont)
|
|
|
|
break;
|
|
|
|
var versiContesto= getFormaContext(risultato, contextLength);
|
|
|
|
var ultimaForma=versiContesto.slice(-1)
|
|
|
|
ultimaPosizione=ultimaForma[0].posizione
|
|
|
|
}
|
|
|
|
//ordino la lista dei risultati
|
|
|
|
res.sort(function(a, b){return a - b});
|
|
|
|
return (res)
|
|
|
|
}
|
|
|
|
|
2023-03-15 18:37:58 +01:00
|
|
|
function showFrasi (start, offset = showOffset) {
|
2023-03-15 16:32:23 +01:00
|
|
|
var canto, numeroCantica;
|
|
|
|
var divVerso;
|
|
|
|
var elencoRisutati = $("#vistaFrasi");
|
|
|
|
elencoRisutati.empty();
|
|
|
|
|
|
|
|
var numeroRisultato = 0;
|
|
|
|
var ultimaPosizione = 0;
|
|
|
|
var numeroVersi;
|
2023-03-15 18:37:58 +01:00
|
|
|
const intsup =Math.min(start+offset, listarisultati.length)
|
2023-03-16 17:10:26 +01:00
|
|
|
var resincontext=getResInPage(start, start+offset)
|
|
|
|
//for (let i=start; i<intsup; i++){
|
|
|
|
for (let i=0; i<resincontext.length; i++){
|
|
|
|
//risultato = listarisultati[i];
|
|
|
|
risultato = resincontext[i];
|
2023-03-15 16:32:23 +01:00
|
|
|
numeroRisultato++;
|
|
|
|
risultato = parseInt(risultato)
|
|
|
|
if (risultato <= parseInt(ultimaPosizione)){
|
|
|
|
continue;
|
|
|
|
}
|
2023-03-16 14:29:51 +01:00
|
|
|
var versiContesto= getFormaContext(risultato, contextLength);
|
2023-03-15 16:32:23 +01:00
|
|
|
var setVersicontesto = new Set()
|
|
|
|
divVerso =''
|
|
|
|
numeroCantica=0
|
|
|
|
canto=0
|
|
|
|
//var titoloCanto = $('<h5 class="titolo-canto"/>')
|
|
|
|
var versiIniziali = $('<div class="versiFrase mt-3" />')
|
|
|
|
var listaVersi = $('<ol class="pt-3" />')
|
|
|
|
|
|
|
|
listaVersi.attr('id', "Frase"+numeroRisultato);
|
|
|
|
versiIniziali.attr('id', "versiFrase"+numeroRisultato);
|
|
|
|
numeroVersi = 0;
|
|
|
|
for (forma of versiContesto){
|
|
|
|
if (setVersicontesto.size == 0){
|
|
|
|
numeroCantica=forma.cantica
|
|
|
|
canto=forma.canto
|
|
|
|
}
|
|
|
|
if (!setVersicontesto.has(forma.verso)){
|
|
|
|
divVerso = createDivVersoLI(forma.cantica, forma.verso, forma.canto)
|
|
|
|
versiIniziali.append(divVerso)
|
|
|
|
listaVersi.append(versiIniziali)
|
|
|
|
elencoRisutati.append(listaVersi)
|
|
|
|
setVersicontesto.add(forma.verso)
|
|
|
|
numeroVersi++;
|
|
|
|
}
|
|
|
|
createSpanFormeNew(forma.testo, forma.catg, 'e'+forma.posizione, forma.periodo, forma.funzperiodo, divVerso)
|
|
|
|
}
|
|
|
|
ultimaPosizione = forma.posizione;
|
|
|
|
|
|
|
|
if (numeroVersi < contextLength +1) {
|
|
|
|
versiIniziali.attr('posVerso', 1); // inizio o fine canto
|
|
|
|
}else {
|
|
|
|
versiIniziali.attr('posVerso', 9999);
|
|
|
|
}
|
|
|
|
|
|
|
|
var comandi = $('<div />')
|
|
|
|
comandi.attr('id',"comandiFrase"+numeroRisultato)
|
2023-03-16 17:10:26 +01:00
|
|
|
comandi.attr('class', 'comandi col flex-nowrap d-inline justify-content-between pl-1 pb-2 ml-2 mb-2 border-bottom');
|
2023-03-15 16:32:23 +01:00
|
|
|
|
|
|
|
var comandiGrp = $('<div />')
|
2023-03-16 17:10:26 +01:00
|
|
|
comandiGrp.attr('class', 'btn-group flex-nowrap d-inline pr-3 mt-1 mr-3 align-text-bottom');
|
2023-03-15 16:32:23 +01:00
|
|
|
comandiGrp.attr('role',"group")
|
|
|
|
|
|
|
|
var spanBadgeExpand = $('<button />');
|
|
|
|
var expandIcon = '<ion-icon name="expand-outline"></ion-icon>';
|
|
|
|
spanBadgeExpand.attr('class', 'btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0');
|
|
|
|
var spanBadgeReduce = $('<button />');
|
|
|
|
var reduceIcon = '<ion-icon name="contract-outline"></ion-icon>';
|
|
|
|
|
|
|
|
spanBadgeReduce.attr('class', 'btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled');
|
|
|
|
|
|
|
|
spanBadgeExpand.attr('id', getCantica(numeroCantica)+"Canto_ex_"+canto+"_"+risultato+"_"+numeroRisultato);
|
|
|
|
spanBadgeExpand.append(expandIcon);
|
|
|
|
|
|
|
|
spanBadgeReduce.attr('id', getCantica(numeroCantica)+"Canto_er_"+canto+"_"+risultato+"_"+numeroRisultato);
|
|
|
|
spanBadgeReduce.append(reduceIcon)
|
|
|
|
|
|
|
|
spanBadgeExpand.appendTo(comandiGrp);
|
|
|
|
spanBadgeReduce.appendTo(comandiGrp);
|
|
|
|
|
|
|
|
comandiGrp.appendTo(comandi);
|
|
|
|
|
|
|
|
|
|
|
|
var citazioneDiv = $('<div />')
|
2023-03-16 17:10:26 +01:00
|
|
|
citazioneDiv.attr('class', ' text-right flex-nowrap d-inline ml-3 px-3 py-0');
|
2023-03-15 16:32:23 +01:00
|
|
|
var citazione = $('<span />')
|
|
|
|
citazione.append("["+getCantica(numeroCantica)+", Canto "+getRoman(canto)+"]")
|
|
|
|
citazione.attr('class', ' pl-3 citazioneFrase align-text-top');
|
|
|
|
citazione.attr('name', getCantica(numeroCantica)+"Canto "+canto);
|
|
|
|
citazione.attr('id', idCitazione+'_'+numeroRisultato+'_'+risultato);
|
|
|
|
citazione.appendTo(citazioneDiv);
|
|
|
|
|
|
|
|
citazioneDiv.appendTo(comandi);
|
|
|
|
|
|
|
|
comandi.appendTo(elencoRisutati);
|
|
|
|
|
|
|
|
}
|
2023-03-15 18:12:38 +01:00
|
|
|
|
2023-03-15 16:32:23 +01:00
|
|
|
//evidenzio resultati
|
|
|
|
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#e' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
|
|
|
}
|
2023-03-15 18:12:38 +01:00
|
|
|
|
2023-03-15 16:32:23 +01:00
|
|
|
//evidenzio i periodi se unità di ricerca è impostato come periodo
|
|
|
|
if (listaPeriodiRisultato.length){
|
|
|
|
for (msid of listaPeriodiRisultato){
|
|
|
|
loadPeriodo(msid)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//evidenzio le frasi se unità di ricerca è frase
|
|
|
|
if (listaClausoleRisultato.length){
|
|
|
|
for (clsid of listaClausoleRisultato){
|
|
|
|
let tmpid=clsid.split('-')
|
2024-01-03 15:09:53 +01:00
|
|
|
//loadFrase(tmpid[0], tmpid[1])
|
|
|
|
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
2023-03-15 16:32:23 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-15 18:12:38 +01:00
|
|
|
}
|
2023-03-15 10:03:56 +01:00
|
|
|
|
2023-03-13 19:35:47 +01:00
|
|
|
jQuery(document).delegate('.navig-canto, .citazioneFrase', 'click', function(e) {
|
2023-02-08 17:07:49 +01:00
|
|
|
resetFrasi()
|
2023-02-13 13:30:32 +01:00
|
|
|
|
2023-02-22 14:57:21 +01:00
|
|
|
//nasconde vista risultati
|
2023-02-13 13:30:32 +01:00
|
|
|
$("#vistaFrasi").css("display", "none");
|
2023-02-16 11:33:44 +01:00
|
|
|
|
|
|
|
//rimuove il grafo sintattico se c'è'
|
|
|
|
var periodograph=document.getElementById("periodograph");
|
2023-02-22 14:57:21 +01:00
|
|
|
|
2023-02-16 11:33:44 +01:00
|
|
|
if (periodograph!=null){
|
2023-02-23 10:46:02 +01:00
|
|
|
let showngr=periodograph.getAttribute('name').split("_")
|
2023-02-16 11:33:44 +01:00
|
|
|
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
|
|
|
|
if (shownSentenceList.has(tmpsent)){
|
|
|
|
lisid=''
|
|
|
|
resetSentenceStructure(tmpsent)
|
|
|
|
shownSentenceList.delete(tmpsent)
|
|
|
|
}
|
|
|
|
$("#periodograph").empty()
|
|
|
|
}
|
|
|
|
|
2023-02-23 10:46:02 +01:00
|
|
|
|
|
|
|
$(cantoDisplayed).css("display", "none");
|
2023-02-16 11:33:44 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
const cid=$(this).attr('name').replace(" ", "_");
|
2023-02-07 10:51:30 +01:00
|
|
|
|
2023-02-07 15:27:23 +01:00
|
|
|
cantoDisplayed = "#"+cid;
|
2023-11-09 16:28:44 +01:00
|
|
|
initCitazioni()
|
2023-03-16 14:29:51 +01:00
|
|
|
var parcid=cid.split('_')
|
2023-02-07 10:51:30 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
if ( !(loadedCanti.has(cid)))
|
|
|
|
{
|
|
|
|
if(parcid[0].includes('Inferno'))
|
|
|
|
showCanto(formeprima, '1',parcid[1])
|
|
|
|
if(parcid[0].includes('Purgatorio'))
|
|
|
|
showCanto(formeseconda, '2',parcid[1])
|
|
|
|
if(parcid[0].includes('Paradiso'))
|
|
|
|
showCanto(formeterza, '3',parcid[1])
|
|
|
|
loadedCanti.add(cid)
|
|
|
|
}
|
2023-02-01 17:46:32 +01:00
|
|
|
//$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
|
|
|
|
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;')
|
2023-02-01 10:31:28 +01:00
|
|
|
|
2023-02-23 10:27:17 +01:00
|
|
|
|
2023-03-15 10:03:56 +01:00
|
|
|
|
2023-03-21 15:20:01 +01:00
|
|
|
drawMinimap("#" + $(this).attr('name').replace(" ", "_"), false)
|
2023-03-09 12:49:29 +01:00
|
|
|
|
2023-02-23 10:27:17 +01:00
|
|
|
|
2023-02-22 14:57:21 +01:00
|
|
|
if (selectedVista=='frasi'){
|
|
|
|
loadFrasi();
|
|
|
|
}
|
2024-01-04 15:32:24 +01:00
|
|
|
if (selectedVista=='dialoghi'){
|
|
|
|
loadDialoghi();
|
|
|
|
}
|
2023-03-15 10:03:56 +01:00
|
|
|
|
2023-03-10 09:49:33 +01:00
|
|
|
addFormaListenersInCanto();
|
2023-03-16 17:10:26 +01:00
|
|
|
|
|
|
|
//se si sta arrivando al canto da un link della lista risultati
|
2023-03-15 10:03:56 +01:00
|
|
|
const callerid=$(this).attr('id');
|
|
|
|
if (callerid!=null && callerid.startsWith(idCitazione)){
|
|
|
|
const mypos=callerid.split('_')[2]
|
2023-03-16 16:14:16 +01:00
|
|
|
latestPhraseId = callerid.split('_')[0].replace("citazione", "")+callerid.split('_')[1];
|
2023-03-16 12:48:44 +01:00
|
|
|
$("#collapse"+parcid[0].replace("Canto", "")).collapse('show');
|
2023-03-16 16:14:16 +01:00
|
|
|
document.getElementById(mypos).scrollIntoView({
|
|
|
|
behavior: "smooth",
|
|
|
|
});
|
2023-03-15 10:03:56 +01:00
|
|
|
|
|
|
|
}
|
2024-01-03 17:39:36 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
});
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-02-22 14:57:21 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//Query
|
2022-12-06 11:25:04 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
jQuery(document).delegate('#searchcomm, #searchcomm2', 'click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
manageQuery()
|
|
|
|
});
|
|
|
|
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//Reset
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
|
|
|
console.log('clean')
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
$('#queryText').val("")
|
2022-12-09 10:45:43 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//Utility functions
|
|
|
|
|
2023-03-15 10:03:56 +01:00
|
|
|
|
2023-03-13 11:57:34 +01:00
|
|
|
/*
|
2023-03-13 09:24:31 +01:00
|
|
|
function addFormaListenersInRisultato(tmplist){
|
2023-03-09 17:41:52 +01:00
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
for (ris of tmplist) {
|
|
|
|
|
|
|
|
ele = $(ris)
|
|
|
|
$(ris).tooltip({
|
2023-03-10 09:49:33 +01:00
|
|
|
content: (function() { return formatTTContent(ele.attr('title'), ele.attr('class').split(' ')[1]); }),
|
|
|
|
classes: { "ui-tooltip": 'Nik_dropdown-content' },
|
|
|
|
//close: function(event, ui) { $(".ui-helper-hidden-accessible").remove(); },
|
|
|
|
//create: function(ev, ui) { $(this).data("ui-tooltip").liveRegion.remove(); },
|
|
|
|
hide: false,
|
2023-03-13 09:24:31 +01:00
|
|
|
show: { delay: 800, duration: 0 }
|
2023-03-10 09:49:33 +01:00
|
|
|
|
|
|
|
});
|
2023-03-13 09:24:31 +01:00
|
|
|
$(ris).hover(function(idx, element) {
|
2023-03-10 09:49:33 +01:00
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
var sentenceId = $(this).attr('class').split(' ')[0].split('_')
|
2023-03-10 09:49:33 +01:00
|
|
|
var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3]
|
|
|
|
lsentid = $(this).attr('class').split(' ')[0]
|
|
|
|
lisid = tmplisid
|
|
|
|
|
|
|
|
});
|
2023-03-13 09:24:31 +01:00
|
|
|
}
|
2023-03-10 09:49:33 +01:00
|
|
|
|
2023-03-13 11:57:34 +01:00
|
|
|
}*/
|
2023-03-10 09:49:33 +01:00
|
|
|
|
|
|
|
function addFormaListenersInCanto(){
|
|
|
|
let idn=0
|
|
|
|
$(cantoDisplayed).find(" ." + formaClass).each(function(idx, element) {
|
|
|
|
idn=idn+1
|
2023-03-09 17:41:52 +01:00
|
|
|
var ele = $(element);
|
2023-03-10 09:49:33 +01:00
|
|
|
|
|
|
|
$(element).tooltip({
|
2023-03-09 17:41:52 +01:00
|
|
|
content: (function() { return formatTTContent(ele.attr('title'), ele.attr('class').split(' ')[1]); }),
|
|
|
|
classes: { "ui-tooltip": 'Nik_dropdown-content' },
|
2023-03-10 09:49:33 +01:00
|
|
|
//close: function(event, ui) { $(".ui-helper-hidden-accessible").remove(); },
|
|
|
|
//create: function(ev, ui) { $(this).data("ui-tooltip").liveRegion.remove(); },
|
2023-03-09 17:41:52 +01:00
|
|
|
hide: false,
|
|
|
|
show: {delay: 800,duration: 0}
|
|
|
|
|
|
|
|
});
|
2023-03-10 09:49:33 +01:00
|
|
|
$(element).hover(function(idx, element) {
|
2023-03-09 17:41:52 +01:00
|
|
|
|
2023-03-13 09:24:31 +01:00
|
|
|
var sentenceId = $(this).attr('class').split(' ')[0].split('_')
|
2023-03-09 17:41:52 +01:00
|
|
|
var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3]
|
|
|
|
lsentid = $(this).attr('class').split(' ')[0]
|
|
|
|
lisid = tmplisid
|
2023-02-15 12:00:51 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2023-03-10 09:49:33 +01:00
|
|
|
console.log('nr forme '+idn)
|
2023-02-15 12:00:51 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-03-09 12:49:29 +01:00
|
|
|
|
|
|
|
function getRoman(numero) {
|
|
|
|
|
|
|
|
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"];
|
|
|
|
return (romani[numero-1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadPeriodo(idperiodo) {
|
|
|
|
|
|
|
|
|
|
|
|
$(cantoDisplayed).find(' .'+idperiodo).each(function() {
|
|
|
|
var pstp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[pstp]));
|
|
|
|
})
|
|
|
|
|
|
|
|
minim.contents().find(' .'+idperiodo).each(function() {
|
|
|
|
var mpstp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[mpstp]));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-04-21 14:07:28 +02:00
|
|
|
function isPeriodoInCanto(idperiodo, canto){
|
|
|
|
datiperiodo=idperiodo.split('_')
|
|
|
|
daticanto=canto.split('_')
|
|
|
|
canticaprd=datiperiodo[0]
|
|
|
|
cantoprd=datiperiodo[1]
|
|
|
|
if(canticaprd=='1' && daticanto[0].includes('Inferno'))
|
|
|
|
return(cantoprd==daticanto[1])
|
|
|
|
if(canticaprd=='2' && daticanto[0].includes('Purgatorio'))
|
|
|
|
return(cantoprd==daticanto[1])
|
|
|
|
if(canticaprd=='3' && daticanto[0].includes('Paradiso'))
|
|
|
|
return(cantoprd==daticanto[1])
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-03-09 12:49:29 +01:00
|
|
|
function loadFrase(idperiodo, funzionefrase) {
|
|
|
|
|
2023-04-21 14:07:28 +02:00
|
|
|
if (!isPeriodoInCanto(idperiodo, cantoDisplayed))
|
|
|
|
return
|
2023-03-09 12:49:29 +01:00
|
|
|
|
|
|
|
$(cantoDisplayed).find(' .'+idperiodo).each(function() {
|
|
|
|
var pstp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
if(pstp.trim()==funzionefrase)
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[pstp]));
|
|
|
|
})
|
|
|
|
|
|
|
|
minim.contents().find(' .'+idperiodo).each(function() {
|
|
|
|
var mpstp=$(this).attr('class').split(" ")[1]
|
|
|
|
if(mpstp.trim()==funzionefrase)
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[mpstp]));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-01-03 15:09:53 +01:00
|
|
|
function loadClausola(idperiodo, funzionefrase, fromn, ton) {
|
|
|
|
|
|
|
|
if (!isPeriodoInCanto(idperiodo, cantoDisplayed))
|
|
|
|
return
|
|
|
|
|
|
|
|
$(cantoDisplayed).find(' .'+idperiodo).each(function() {
|
|
|
|
if (parseInt($(this).attr('id'))>=parseInt(fromn)
|
|
|
|
&& parseInt($(this).attr('id'))<=parseInt(ton)){
|
|
|
|
var pstp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
if(pstp.trim()==funzionefrase)
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[pstp]));
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
minim.contents().find(' .'+idperiodo).each(function() {
|
|
|
|
if (parseInt($(this).attr('id'))>=parseInt(fromn)
|
|
|
|
&& parseInt($(this).attr('id'))<=parseInt(ton)){
|
|
|
|
var mpstp=$(this).attr('class').split(" ")[1]
|
|
|
|
if(mpstp.trim()==funzionefrase)
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[mpstp]));
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
2024-01-04 15:32:24 +01:00
|
|
|
function loadDialoghi() {
|
|
|
|
var aca='3'
|
|
|
|
if (cantoDisplayed.includes('Inferno'))
|
|
|
|
aca='1'
|
|
|
|
if (cantoDisplayed.includes('Purgatorio'))
|
|
|
|
aca='2'
|
|
|
|
for (const india in dialoghi){
|
|
|
|
//console.log(dialoghi[india]['Cnt'].replace('_so',''))
|
|
|
|
var diaclass=dialoghi[india]['Cnt'].replace('_so','')
|
|
|
|
if(diaclass.split('_')[0]!=aca)
|
|
|
|
continue;
|
2024-01-04 17:12:59 +01:00
|
|
|
if(diaclass.split('_')[1]!=cantoDisplayed.split('_')[1])
|
|
|
|
continue;
|
2024-01-05 13:20:10 +01:00
|
|
|
var csscl='diaDiretto '
|
|
|
|
var diaty=dialoghi[india]['Dty']
|
|
|
|
if (diaty=='SpeakableDiscourse')
|
|
|
|
csscl='diaSpeakable '
|
|
|
|
if (diaty=='ThoughtDiscourse')
|
|
|
|
csscl='diaPensato '
|
2024-01-04 15:32:24 +01:00
|
|
|
$(cantoDisplayed).find(' .'+diaclass).each(function() {
|
2024-01-05 13:20:10 +01:00
|
|
|
$(this).addClass(csscl)
|
|
|
|
//$(this).css('color', '#1f78b4');
|
|
|
|
//$(this).addClass("font-weight-bold ")
|
2024-01-04 15:32:24 +01:00
|
|
|
})
|
|
|
|
minim.contents().find(' .'+diaclass).each(function() {
|
2024-01-05 13:20:10 +01:00
|
|
|
$(this).addClass(csscl)
|
|
|
|
//$(this).css('color', '#1f78b4');
|
|
|
|
//$(this).addClass("font-weight-bold ")
|
2024-01-04 15:32:24 +01:00
|
|
|
})
|
2024-01-03 15:09:53 +01:00
|
|
|
|
2024-01-04 15:32:24 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
function loadFrasi() {
|
|
|
|
|
|
|
|
$(cantoDisplayed).find(' .sentencetag').each(function() {
|
|
|
|
$(this).attr('style', 'display: d-flex;');
|
|
|
|
})
|
|
|
|
$(cantoDisplayed).find(' .'+formaClass).each(function() {
|
|
|
|
stp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[stp]));
|
|
|
|
})
|
|
|
|
//let minim=$(" .minimap__content")
|
|
|
|
minim.contents().find(" .sentencetag").each(function(){
|
|
|
|
$(this).attr('style', 'display: d-flex;');
|
|
|
|
})
|
|
|
|
minim.contents().find(' .'+formaClass).each(function() {
|
|
|
|
stp=$(this).attr('class').split(" ")[1]
|
|
|
|
|
|
|
|
$(this).css('color', colorssp(mapsynttypestopalette[stp]));
|
|
|
|
})
|
|
|
|
}
|
|
|
|
function resetFrasi(){
|
|
|
|
|
2024-01-05 13:20:10 +01:00
|
|
|
$(cantoDisplayed).find(' .diaDiretto').each(function() {
|
|
|
|
$(this).removeClass('diaDiretto');
|
|
|
|
})
|
|
|
|
$(cantoDisplayed).find(' .diaPensato').each(function() {
|
|
|
|
$(this).removeClass('diaPensato');
|
|
|
|
})
|
|
|
|
$(cantoDisplayed).find(' .diaSpeakable').each(function() {
|
|
|
|
$(this).removeClass('diaSpeakable');
|
|
|
|
})
|
2023-03-09 12:49:29 +01:00
|
|
|
$(cantoDisplayed).find(' .sentencetag').each(function() {
|
|
|
|
$(this).css('display', 'none');
|
|
|
|
})
|
|
|
|
$(cantoDisplayed).find(' .'+formaClass).each(function() {
|
|
|
|
//console.log(colorssp(mapsynttypestopalette[stp]))
|
|
|
|
$(this).css('color', '');
|
2024-01-04 15:32:24 +01:00
|
|
|
$(this).removeClass('font-weight-bold')
|
2023-03-09 12:49:29 +01:00
|
|
|
})
|
|
|
|
//let minim=$(" .minimap__content")
|
2024-01-05 13:20:10 +01:00
|
|
|
minim.contents().find(" .diaDiretto").each(function(){
|
|
|
|
$(this).removeClass('diaDiretto');
|
|
|
|
})
|
|
|
|
minim.contents().find(" .diaPensato").each(function(){
|
|
|
|
$(this).removeClass('diaPensato');
|
|
|
|
})
|
|
|
|
minim.contents().find(" .diaSpeakable").each(function(){
|
|
|
|
$(this).removeClass('diaSpeakable');
|
|
|
|
})
|
2023-03-09 12:49:29 +01:00
|
|
|
minim.contents().find(" .sentencetag").each(function(){
|
|
|
|
$(this).css('display', 'none');
|
|
|
|
})
|
|
|
|
minim.contents().find(' .'+formaClass).each(function() {
|
|
|
|
$(this).css('color', '');
|
2024-01-04 15:32:24 +01:00
|
|
|
$(this).removeClass('font-weight-bold')
|
2023-03-09 12:49:29 +01:00
|
|
|
})
|
|
|
|
//evidenzio i periodi se unità di ricerca è impostato come periodo
|
|
|
|
if (listaPeriodiRisultato.length) {
|
|
|
|
for (msid of listaPeriodiRisultato) {
|
|
|
|
loadPeriodo(msid)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//evidenzio le frasi se unità di ricerca è frase
|
|
|
|
if (listaClausoleRisultato.length) {
|
|
|
|
for (clsid of listaClausoleRisultato) {
|
|
|
|
let tmpid = clsid.split('-')
|
2024-01-03 15:09:53 +01:00
|
|
|
//loadFrase(tmpid[0], tmpid[1])
|
|
|
|
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
2023-03-09 12:49:29 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2023-04-11 11:00:35 +02:00
|
|
|
//cancello il grafo sintattico
|
|
|
|
var periodograph=document.getElementById("periodograph");
|
|
|
|
if (periodograph!=null){
|
|
|
|
let showngr=periodograph.getAttribute('name').split("_")
|
|
|
|
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
|
|
|
|
|
|
|
|
resetSentenceStructure(tmpsent)
|
|
|
|
shownSentenceList.delete(tmpsent)
|
|
|
|
|
|
|
|
//$("#periodograph").empty()
|
|
|
|
periodograph.parentNode.removeChild(periodograph);
|
2023-04-19 16:55:30 +02:00
|
|
|
//$('#tab-list #vis0-tab').tab('show')
|
2023-04-11 11:00:35 +02:00
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
}
|
2023-11-06 13:45:20 +01:00
|
|
|
/*INIZIO GESTIONE CITAZIONI*/
|
|
|
|
|
2023-11-07 08:41:14 +01:00
|
|
|
function initCitazioni(){
|
2023-11-06 13:45:20 +01:00
|
|
|
//"#InfernoCanto_1"
|
2023-12-05 10:27:27 +01:00
|
|
|
//console.log('VISTA CITAZIONI!')
|
2023-11-06 13:45:20 +01:00
|
|
|
var mcanto=cantoDisplayed.replace("#",'')
|
|
|
|
cantica=''
|
|
|
|
if (mcanto.startsWith('Inf'))
|
|
|
|
cantica='Inferno'
|
|
|
|
if (mcanto.startsWith('Pur'))
|
|
|
|
cantica='Purgatorio'
|
|
|
|
if (mcanto.startsWith('Par'))
|
|
|
|
cantica='Paradiso'
|
|
|
|
canto=mcanto.split('_')[1]
|
2023-11-09 16:28:44 +01:00
|
|
|
if (canto.length==1)
|
2023-11-06 13:45:20 +01:00
|
|
|
canto='0'+canto
|
2023-12-17 18:21:04 +01:00
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
commentsArray=getVersiConCitazioni(cantica, canto)
|
2023-12-19 15:35:44 +01:00
|
|
|
commentsJson=getVersiConCitazioniJson (cantica, canto)
|
2023-12-05 10:27:27 +01:00
|
|
|
commentsArray.forEach(removeHtmlTags2)
|
2023-12-17 18:21:04 +01:00
|
|
|
|
2023-12-17 18:13:16 +01:00
|
|
|
var numVerso1;
|
|
|
|
var numVerso2;
|
2023-12-17 19:44:57 +01:00
|
|
|
var versoCitazione;
|
2023-12-17 18:13:16 +01:00
|
|
|
|
|
|
|
commentsArray.sort((p1, p2) => {
|
|
|
|
numVerso1 = p1.verso;
|
|
|
|
numVerso2 = p2.verso;
|
2023-12-17 19:44:57 +01:00
|
|
|
versoCitazione = (p1.VersoCitazione).replaceAll("-","");
|
|
|
|
numVerso1 = numVerso1 + versoCitazione;
|
|
|
|
versoCitazione = (p2.VersoCitazione).replaceAll("-","");
|
|
|
|
numVerso2 = numVerso2 + versoCitazione;
|
2023-12-17 18:21:04 +01:00
|
|
|
numVerso2 = parseInt(numVerso2.replaceAll("_",""));
|
|
|
|
numVerso1 = parseInt(numVerso1.replaceAll("_",""));
|
2023-12-17 18:13:16 +01:00
|
|
|
if (numVerso1 < numVerso2) return -1;
|
|
|
|
if (numVerso1 > numVerso2) return 1;
|
|
|
|
return 0;
|
|
|
|
});
|
2023-11-06 13:45:20 +01:00
|
|
|
}
|
2023-11-22 18:22:10 +01:00
|
|
|
|
|
|
|
/* Luca: removeHtmlTags2 e' la versione compatta di removeHtmlTags*/
|
|
|
|
function removeHtmlTags2(value){
|
|
|
|
var text = ""
|
|
|
|
for (const key in value) {
|
|
|
|
text = `${value[key]}`
|
|
|
|
if (text != null){
|
|
|
|
text = text.replace(/<(.|\n)*?>/g, '');
|
|
|
|
text = text.replace("«","");
|
|
|
|
text = text.replace("»","");
|
|
|
|
text = text.replace(/[\r\n]+/gm, ' ');
|
|
|
|
value[`${key}`] = text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-06 13:45:20 +01:00
|
|
|
|
2023-12-21 12:48:32 +01:00
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
function removeHtmlTags(value){
|
|
|
|
var text = value;
|
|
|
|
if (text != null){
|
|
|
|
text = text.replace(/<(.|\n)*?>/g, '');
|
|
|
|
text = text.replace("«","");
|
|
|
|
text = text.replace("»","");
|
2023-12-21 12:48:32 +01:00
|
|
|
text = text.replace(/\ /g, ' ');
|
2023-12-20 11:51:30 +01:00
|
|
|
text = text.replace(/[\r\n]+/gm, ' ');
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-10 17:14:48 +01:00
|
|
|
jQuery(document).delegate(' .showcomments', 'click', function() {
|
|
|
|
var cid = $(this).attr('id');
|
2023-12-19 15:35:44 +01:00
|
|
|
if(!hasCommentsJson(cid)){
|
|
|
|
return
|
|
|
|
}
|
2023-11-11 11:27:49 +01:00
|
|
|
var parcid=cid.split('_')
|
|
|
|
var cantica;
|
|
|
|
switch (parcid[1]){
|
|
|
|
case "1": cantica = "Inferno";
|
|
|
|
break;
|
|
|
|
case "2": cantica = "Purgatorio";
|
|
|
|
break;
|
|
|
|
case "3": cantica = "Paradiso";
|
|
|
|
}
|
2023-12-05 10:27:27 +01:00
|
|
|
var commentArea = $('#displaynote');
|
2023-12-07 16:37:37 +01:00
|
|
|
commentArea.empty()
|
2023-12-05 10:27:27 +01:00
|
|
|
if ($('#noteCard0').length ) {
|
|
|
|
$("#noteCard0")[0].remove();
|
|
|
|
}
|
2023-11-28 20:34:13 +01:00
|
|
|
var id = cid.substr(9);
|
|
|
|
var collapseNote;
|
2023-12-20 11:51:30 +01:00
|
|
|
var gruppoVersi;
|
|
|
|
var versText = "";
|
|
|
|
//var saveVersoCitazione = "";
|
2023-12-19 15:35:44 +01:00
|
|
|
var allGrouplKeys = Object.keys(commentsJson);
|
2023-12-20 11:51:30 +01:00
|
|
|
var currentGroup;
|
2023-12-19 15:35:44 +01:00
|
|
|
|
|
|
|
allGrouplKeys.sort().some(function(k){
|
2023-12-20 11:51:30 +01:00
|
|
|
if (k==id || ~k.indexOf(id+'-')){
|
|
|
|
//console.log('gruppo commenti '+k)
|
2023-12-20 18:05:49 +01:00
|
|
|
console.log (commentsJson[k].length)
|
2023-12-20 11:51:30 +01:00
|
|
|
gruppoVersi = k.split("_").slice(-1)[0]
|
|
|
|
if (gruppoVersi.includes("-")) {
|
|
|
|
versText = ", Versi " + gruppoVersi;
|
|
|
|
} else {
|
|
|
|
versText = ", Verso " + gruppoVersi;
|
|
|
|
}
|
2023-12-20 18:05:49 +01:00
|
|
|
currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsJson[k].length)
|
2023-12-20 11:51:30 +01:00
|
|
|
commentsJson[k].forEach(function (value, i) {
|
|
|
|
currentGroup.append(createNoteEntry(value,k,i))
|
|
|
|
});
|
|
|
|
commentArea.append(currentGroup);
|
|
|
|
}
|
|
|
|
$('#tab-list #vis0-tab').tab('show')
|
2023-12-19 15:35:44 +01:00
|
|
|
})
|
2023-11-29 12:52:34 +01:00
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
})
|
2023-11-29 12:52:34 +01:00
|
|
|
|
2023-12-20 18:05:49 +01:00
|
|
|
function createNoteGroup(cantica, canto, versi, id, len) {
|
|
|
|
var noteGroupCard = $('<div class="card card-body cardGroup well well-sm mx-1 my-2 p-0" id="noteGroupCard' + id + '" style="background-color: #cfdeec">');
|
|
|
|
|
|
|
|
var commentHeader = $('<div class="d-flex align-content-start flex-nowrap text-muted" id="commentoGruppoVersi' + id + '">')
|
|
|
|
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="closeNote'+id+'"'+
|
|
|
|
'class="btn btn-sm btn-outline-warning btn-outline-warning-mod closeNote rounded text-warning align-self-end px-1 pb-0 ml-1 mb-1">'+
|
|
|
|
'<ion-icon name="close-circle"></ion-icon>');
|
|
|
|
if (len > 1) {
|
|
|
|
closeButton.appendTo(buttons);
|
|
|
|
var commentiSP = " commenti su "
|
|
|
|
} else {
|
|
|
|
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);
|
|
|
|
buttons.appendTo(commentHeader);
|
|
|
|
commentHeader.appendTo(noteGroupCard);
|
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
return noteGroupCard;
|
|
|
|
}
|
|
|
|
|
|
|
|
function createNoteEntry(comments,id,pos) {
|
2023-12-20 12:48:06 +01:00
|
|
|
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos + '">');
|
2023-12-20 11:51:30 +01:00
|
|
|
//var noteCard = $('<div class="card card-body well well-sm m-1 mt-2 p-0" id="noteCard' + id + '">');
|
|
|
|
//var collapseCardBody = $('<div class="card-body px-0 py-2 mx-1 mb-1 mt-0 border-top rounded" >');
|
|
|
|
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">');
|
|
|
|
//createNoteHeader(noteCard, comments, id, pos, cantica, parcid, saveVersoCitazione);
|
|
|
|
createNoteHeader(noteCard, comments, id, pos);
|
|
|
|
|
|
|
|
collapseNote = $('<div class="collapse show">');
|
|
|
|
collapseNote.attr('id',"collapseNote"+id+ '_' + pos)
|
|
|
|
|
|
|
|
if (comments.TestoFonteCitazione != null && comments.TestoFonteCitazione != "nan"){
|
|
|
|
createModule(collapseCardBody,"Testo della fonte: ", removeHtmlTags(comments.TestoFonteCitazione), "1", id, pos)
|
|
|
|
}
|
|
|
|
if (comments.NaturaRiferimento != null){
|
|
|
|
createDivSingola(divCampiSingoli, "Tipo di riferimento: ", comments.NaturaRiferimento, false)
|
|
|
|
divCampiSingoli.appendTo(collapseCardBody);
|
|
|
|
if (comments.NaturaRiferimento == "CITAZIONE" || comments.NaturaRiferimento == "LOCI PARALLELI" ){
|
|
|
|
if (comments.TipoCitazione != null && comments.TipoCitazione != ""){
|
|
|
|
createDivSingola(divCampiSingoli, "Tipo citazione: ", comments.TipoCitazione, false)
|
|
|
|
divCampiSingoli.appendTo(collapseCardBody);
|
2023-12-12 18:34:02 +01:00
|
|
|
}
|
2023-12-20 11:51:30 +01:00
|
|
|
appendSpecifica(comments,divCampiSingoli,collapseCardBody)
|
2023-11-10 20:08:42 +01:00
|
|
|
}
|
2023-12-20 11:51:30 +01:00
|
|
|
}
|
|
|
|
if (comments.RapportoSoggettoOggetto != null){
|
|
|
|
createDivSingola(divCampiSingoli, "Rapporto testo/fonte: ", comments.RapportoSoggettoOggetto, false)
|
|
|
|
divCampiSingoli.appendTo(collapseCardBody);
|
2023-11-26 13:38:27 +01:00
|
|
|
}
|
2023-12-20 11:51:30 +01:00
|
|
|
if (comments.RapportoCommentoCommentatoreText != null && comments.RapportoCommentoCommentatoreText != "nan"){
|
|
|
|
createModuleCommentatore (collapseCardBody, comments.RapportoCommentoCommentatoreText, "5", id, pos)
|
|
|
|
}
|
|
|
|
if (comments.frammentoNota != null && comments.frammentoNota != "nan" && comments.annotazione != null && comments.annotazione != "nan") {
|
|
|
|
createModuleFrammAnnot(collapseCardBody, removeHtmlTags(comments.frammentoNota), removeHtmlTags(comments.annotazione), "6", id, pos)
|
|
|
|
} else {
|
|
|
|
if (comments.frammentoNota != null && comments.frammentoNota != "nan"){
|
|
|
|
createModule(collapseCardBody,"Nota: ", removeHtmlTags(comments.frammentoNota), "6", id, pos)
|
|
|
|
}
|
|
|
|
if (comments.annotazione != null && comments.annotazione != "nan"){
|
|
|
|
createModule(collapseCardBody,"Nota completa: ", removeHtmlTags(comments.annotazione), "7", id, pos)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (comments.NotaFonteCitazione != null && comments.NotaFonteCitazione != "nan" && comments.NotaFonteCitazione != ""){
|
|
|
|
createModule(collapseCardBody,"Nota dell'annotatore: ", comments.NotaFonteCitazione, "8", id, pos)
|
|
|
|
}
|
|
|
|
collapseCardBody.appendTo(collapseNote);
|
|
|
|
collapseNote.appendTo(noteCard);
|
|
|
|
return noteCard;
|
|
|
|
}
|
|
|
|
|
2023-11-28 20:34:13 +01:00
|
|
|
|
2023-12-12 18:34:02 +01:00
|
|
|
function appendSpecifica(commenti,cardBody, collapseCard){
|
|
|
|
var specifica = "";
|
|
|
|
|
|
|
|
if(commenti.CitEpisodi != null && commenti.CitEpisodi != ""){
|
|
|
|
specifica = commenti.CitEpisodi;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Episodio ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
if(commenti.CitImmagini != null && commenti.CitImmagini != ""){
|
|
|
|
specifica = commenti.CitImmagini;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Immagine ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
if(commenti.CitTeorie != null && commenti.CitTeorie != ""){
|
|
|
|
specifica = commenti.CitTeorie;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Teoria ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
if(commenti.CitMotivi != null && commenti.CitMotivi != ""){
|
|
|
|
specifica = commenti.CitMotivi;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Motivo ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
if(commenti.CitStilemi != null && commenti.CitStilemi != ""){
|
|
|
|
specifica = commenti.CitStilemi;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Stilema ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
if(commenti.CitTopografie != null && commenti.CitTopografie != ""){
|
|
|
|
specifica = commenti.CitTopografie;
|
2023-12-18 16:00:15 +01:00
|
|
|
createDivSingola(cardBody, "Contenuto del riferimento: ", "Topografia ("+specifica, true)
|
2023-12-12 18:34:02 +01:00
|
|
|
cardBody.appendTo(collapseCard);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
function createNoteHeader(noteCardX, comments, id, pos) { //, cantica, parcid, versoCitazionePrecedente){
|
2023-11-28 20:34:13 +01:00
|
|
|
var nomeAutore = "";
|
|
|
|
var titoloFonte = "";
|
|
|
|
var luogoFonte = "";
|
2023-12-05 10:27:27 +01:00
|
|
|
var commentHeader = $('<div class="d-flex align-content-start flex-nowrap text-muted" id="commentoVerso' + id + '_' + pos + '">')
|
2023-12-20 11:51:30 +01:00
|
|
|
var rigaNota = $('<div class="px-3 py-1 m-0">');
|
2023-12-05 10:27:27 +01:00
|
|
|
var buttons = $('<div class="d-flex flex-wrap-reverse ml-auto align-items-center justify-content-end p-1">')
|
|
|
|
var collapseButton = $('<button id="collapseBtnNote'+id+ '_' + pos +'"'+
|
2023-12-05 16:38:44 +01:00
|
|
|
'class="btn btn-sm btn-outline-primary bg-light collapseNote border rounded text-primary align-self-end px-1 pb-0"'+
|
2023-12-05 10:27:27 +01:00
|
|
|
'data-toggle="collapse" data-target="#collapseNote'+id+ '_' + pos +'"'+
|
|
|
|
'aria-expanded="true" aria-controls="collapseNote'+id+ '_' + pos +'">'+
|
2023-11-28 20:34:13 +01:00
|
|
|
'<ion-icon name="archive"></ion-icon>');
|
2023-12-05 10:27:27 +01:00
|
|
|
var closeButton = $('<button id="closeNote'+id+ '_' + pos +'"'+
|
2023-12-05 16:38:44 +01:00
|
|
|
'class="btn btn-sm btn-outline-primary bg-light closeNote border rounded text-primary align-self-end px-1 pb-0 ml-1 mb-1">'+
|
2023-11-28 20:34:13 +01:00
|
|
|
'<ion-icon name="close-circle"></ion-icon>');
|
2023-12-05 10:27:27 +01:00
|
|
|
collapseButton.appendTo(buttons);
|
|
|
|
closeButton.appendTo(buttons);
|
2023-12-06 16:24:03 +01:00
|
|
|
|
|
|
|
if (comments.commentario != null){
|
|
|
|
rigaNota.append('<b>Commentatore:</b> <i>' + comments.commentario + '</i><br>');
|
|
|
|
}
|
|
|
|
|
2023-11-28 20:34:13 +01:00
|
|
|
|
|
|
|
if (comments.NomeAutoreCitazione == null) {
|
|
|
|
nomeAutore = 'riferimento';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nomeAutore = comments.NomeAutoreCitazione;
|
|
|
|
}
|
2023-12-21 12:48:32 +01:00
|
|
|
if (comments.AutoreCitazione != null) {
|
2023-12-06 16:24:03 +01:00
|
|
|
rigaNota.append('<b>Autore della fonte:</b><a href="' + comments.AutoreCitazione + '" target="_blank"> <i>' + nomeAutore + '</i> </a>');
|
2023-11-28 20:34:13 +01:00
|
|
|
} else {
|
|
|
|
rigaNota.append('<b>Autore della fonte:</b> <i>' + nomeAutore + '</i>');
|
|
|
|
}
|
|
|
|
if (comments.TitoloFonteCitazione == null) {
|
|
|
|
titoloFonte = "riferimento";
|
|
|
|
} else {
|
|
|
|
titoloFonte = comments.TitoloFonteCitazione;
|
|
|
|
}
|
|
|
|
if (comments.FonteCitazione != null) {
|
2023-12-06 16:24:03 +01:00
|
|
|
rigaNota.append(' <b>Fonte:</b> <a href="' + comments.FonteCitazione + '" target="_blank"><i> ' + titoloFonte + '</i> </a>');
|
2023-11-28 20:34:13 +01:00
|
|
|
} else {
|
2023-12-06 16:24:03 +01:00
|
|
|
rigaNota.append(' <b>Fonte:</b><i> ' + titoloFonte + '</i>');
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
|
|
|
if (comments.LuogoFonteCitazione == null) {
|
|
|
|
luogoFonte = "riferimento";
|
|
|
|
} else {
|
|
|
|
luogoFonte = comments.LuogoFonteCitazione;
|
|
|
|
}
|
|
|
|
if (comments.URLFonteCitazione != null) {
|
2023-12-07 16:37:37 +01:00
|
|
|
rigaNota.append(' <b>Coordinate della fonte:</b><a href="' + comments.URLFonteCitazione + '"target="_blank"><i> ' + luogoFonte + '</i></a><br>');
|
2023-11-28 20:34:13 +01:00
|
|
|
} else {
|
2023-12-07 16:37:37 +01:00
|
|
|
rigaNota.append(' <b>Coordinate della fonte:</b><i> ' + luogoFonte + '</i><br>');
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
|
|
|
rigaNota.appendTo(commentHeader);
|
|
|
|
buttons.appendTo(commentHeader);
|
2023-12-05 10:27:27 +01:00
|
|
|
commentHeader.appendTo(noteCardX);
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
|
|
|
|
2023-12-13 16:09:38 +01:00
|
|
|
function createDivSingola(divCampi, campo, valore, specifica){
|
2023-12-07 16:37:37 +01:00
|
|
|
//var divSingola = $('<div class="px-3 py-1">');
|
|
|
|
var divSingola = $('<div class="pl-0 pr-3 py-1">');
|
2023-12-13 16:09:38 +01:00
|
|
|
if (specifica){
|
|
|
|
valore = valore.trim();
|
|
|
|
divSingola.append ('<b>'+campo+'</b><i>'+valore+')</i>');
|
|
|
|
}else {
|
|
|
|
divSingola.append ('<b>'+campo+'</b><i> '+valore+'</i>');
|
|
|
|
}
|
2023-11-29 12:52:34 +01:00
|
|
|
divSingola.appendTo(divCampi);
|
|
|
|
}
|
|
|
|
|
2023-12-05 10:27:27 +01:00
|
|
|
function createModule(collapse,label, testo, num, id, pos){
|
2023-12-20 11:51:30 +01:00
|
|
|
var minLength = (($('#displaynote').width() / ($('#Test').width() / 32)) * 2 * 1.63);
|
2023-12-07 16:37:37 +01:00
|
|
|
var divContent = $('<div class="text-muted p-0">');
|
|
|
|
//var divContent = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
|
|
|
//var divTesto = $('<div class="px-3 py-1">')
|
|
|
|
var nota = '<b>'+label+'</b><span class="blog-main-16">'+testo+'</span>';
|
|
|
|
//divTesto.append(nota);
|
|
|
|
//divContent.append(divTesto);
|
|
|
|
divContent.append(nota);
|
2023-12-20 11:51:30 +01:00
|
|
|
if (($('<textarea />').html(testo).text().length + label.length + 2) > minLength) {
|
2023-12-13 13:57:05 +01:00
|
|
|
//console.log((testo.length + label.length +2) +" "+($('#displaynote').width() / $('#Test').width() * 2 * 32))
|
2023-12-05 16:38:44 +01:00
|
|
|
var divModule = $('<div class="module pb-0">');
|
|
|
|
var divNote = $('<div class="collapse" id="collapse'+num+'Note'+id+ '_' + pos +'" aria-expanded="false">')
|
|
|
|
divModule.append('<a class="read-more collapsed" data-toggle="collapse" href="#collapse'+num+'Note'+id+ '_' + pos +'" role="button"></a>')
|
|
|
|
divNote.append(divContent)
|
|
|
|
divModule.append(divNote);
|
2023-12-13 13:57:05 +01:00
|
|
|
|
2023-12-05 16:38:44 +01:00
|
|
|
} else {
|
2023-12-18 12:28:11 +01:00
|
|
|
var divModule = $('<div class="py-1">');
|
2023-12-13 13:57:05 +01:00
|
|
|
divModule.append(divContent);
|
2023-12-05 16:38:44 +01:00
|
|
|
}
|
2023-12-13 13:57:05 +01:00
|
|
|
divModule.appendTo(collapse);
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
2023-12-05 10:27:27 +01:00
|
|
|
|
|
|
|
function createModuleCommentatore(collapse, commento, num, id, pos){
|
2023-12-18 09:19:22 +01:00
|
|
|
|
|
|
|
let tmpcomm='['+commento+']'
|
|
|
|
let jsonCommento=JSON.parse(tmpcomm.replaceAll("'", '"').replaceAll("+", '"'));
|
2023-12-20 11:51:30 +01:00
|
|
|
var minLength = (($('#displaynote').width() / ($('#Test').width() / 32)) * 2 * 1.63);
|
2023-11-28 20:34:13 +01:00
|
|
|
var divContent = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
2023-12-07 16:37:37 +01:00
|
|
|
var divTesto = $('<div class="pl-0 pr-3 py-1">')
|
2023-12-18 09:19:22 +01:00
|
|
|
var nota='';
|
|
|
|
var lenmod=0
|
|
|
|
for (el in jsonCommento){
|
|
|
|
var urlCommento = jsonCommento[el].Commento;
|
|
|
|
|
|
|
|
var esitoCommento = jsonCommento[el].Rapporto;
|
|
|
|
|
|
|
|
var autoreCommento = jsonCommento[el].Autore
|
|
|
|
if (autoreCommento == "") {
|
|
|
|
autoreCommento = "Commento"
|
|
|
|
}
|
|
|
|
if (esitoCommento == "") {
|
|
|
|
esitoCommento = "Rapporto nullo"
|
|
|
|
}
|
|
|
|
if (nota.length>0){
|
|
|
|
nota=nota+' - '
|
|
|
|
}
|
|
|
|
if (urlCommento == "") {
|
|
|
|
//nota = '<b>Rapporto commento/commentatore: </b>'+esitoCommento+' Commento nullo, '+'</b><br>';
|
|
|
|
nota = nota+'<i>'+esitoCommento+' Commento nullo'+'</i>'//+'<br>';
|
|
|
|
} else {
|
|
|
|
//nota = '<b>Rapporto commento/commentatore: </b><i>'+esitoCommento +' <a href="'+urlCommento+'"target="_blank">' + autoreCommento+ '</i></a> ' + '</b><br>';
|
|
|
|
nota = nota+'<i>'+esitoCommento +' <a href="'+urlCommento+'"target="_blank">' + autoreCommento+ '</i></a>' //+ '</b><br>';
|
|
|
|
}
|
|
|
|
lenmod=lenmod+esitoCommento.length + autoreCommento.length
|
|
|
|
//divTesto.append(nota);
|
|
|
|
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
2023-12-18 09:19:22 +01:00
|
|
|
nota='<b>Rapporto commento/commentatore:</b> '+nota
|
2023-12-05 16:38:44 +01:00
|
|
|
divTesto.append(nota);
|
2023-11-28 20:34:13 +01:00
|
|
|
divContent.append(divTesto);
|
2023-12-20 11:51:30 +01:00
|
|
|
var divModule = $('<div class="module py-1">');
|
|
|
|
divModule.append(divContent);
|
2023-12-13 13:57:05 +01:00
|
|
|
divModule.appendTo(collapse);
|
2023-11-28 20:34:13 +01:00
|
|
|
}
|
2023-11-10 17:14:48 +01:00
|
|
|
|
2023-12-18 12:28:11 +01:00
|
|
|
function createModuleFrammAnnot(collapse, testo1, testo2, num, id, pos){
|
2023-12-20 11:51:30 +01:00
|
|
|
var minLength = (($('#displaynote').width() / ($('#Test').width() / 32)) * 2 * 1.63);
|
2023-12-18 12:28:11 +01:00
|
|
|
var divFrammAnnot = $('<div class="py-1">');
|
|
|
|
var divContent1 = $('<div class="text-muted p-0">');
|
|
|
|
var divContent2 = $('<div class="text-muted p-0">');
|
2023-12-20 11:51:30 +01:00
|
|
|
var uniqueIdMulti1 = 'coll'+num+'SN'+id+'_'+pos;
|
|
|
|
var uniqueIdMulti2 = 'coll'+num+'CN'+id+'_'+pos;
|
|
|
|
var divMultiCollapse1 = $('<div class="collapse multi-collapse'+pos+' show text-muted p-0" id="' + uniqueIdMulti1 + '">');
|
|
|
|
var divMultiCollapse2 = $('<div class="collapse multi-collapse'+pos+' text-muted p-0" id="' + uniqueIdMulti2 + '">');
|
|
|
|
var label1 = '<b>Nota / <a href="" data-toggle="collapse" data-target=".multi-collapse'+pos+'" aria-controls="' + uniqueIdMulti1 + ' ' + uniqueIdMulti2 +'">Nota completa</a>: </b>'
|
|
|
|
var label2 = '<b><a href="" data-toggle="collapse" data-target=".multi-collapse'+pos+'" aria-controls="' + uniqueIdMulti1 + ' ' + uniqueIdMulti2 +'">Nota</a> / Nota completa: </b>'
|
2023-12-18 12:28:11 +01:00
|
|
|
var nota1 = '<span class="blog-main-16">'+testo1+'</span>';
|
|
|
|
var nota2 = '<span class="blog-main-16">'+testo2+'</span>';
|
|
|
|
|
|
|
|
divFrammAnnot.append(divMultiCollapse1);
|
|
|
|
divFrammAnnot.append(divMultiCollapse2);
|
|
|
|
divContent1.append(label1 + nota1);
|
|
|
|
divContent2.append(label2 + nota2);
|
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
if (($('<textarea />').html(testo1).text().length + 23) > minLength) {
|
2023-12-18 12:28:11 +01:00
|
|
|
var divModule1 = $('<div class="module pb-0">');
|
|
|
|
var divNote1 = $('<div class="collapse" id="collapse'+num+'Note'+id+ '_' + pos +'" aria-expanded="false">')
|
|
|
|
divModule1.append('<a class="read-more collapsed" data-toggle="collapse" href="#collapse'+num+'Note'+id+ '_' + pos +'" role="button"></a>')
|
|
|
|
divNote1.append(divContent1)
|
|
|
|
divModule1.append(divNote1);
|
|
|
|
divMultiCollapse1.append(divModule1);
|
|
|
|
} else {
|
|
|
|
divMultiCollapse1.append(divContent1);
|
|
|
|
}
|
|
|
|
|
2023-12-20 11:51:30 +01:00
|
|
|
if (($('<textarea />').html(testo2).text().length + 23) > minLength) {
|
2023-12-18 12:28:11 +01:00
|
|
|
var divModule2 = $('<div class="module pb-0">');
|
|
|
|
var divNote2 = $('<div class="collapse" id="collapse'+num+'Note'+(id + 1)+ '_' + pos +'" aria-expanded="false">')
|
|
|
|
divModule2.append('<a class="read-more collapsed" data-toggle="collapse" href="#collapse'+num+'Note'+(id + 1)+ '_' + pos +'" role="button"></a>')
|
|
|
|
divNote2.append(divContent2);
|
|
|
|
divModule2.append(divNote2);
|
|
|
|
divMultiCollapse2.append(divModule2);
|
|
|
|
} else {
|
|
|
|
divMultiCollapse2.append(divContent2);
|
|
|
|
}
|
|
|
|
|
|
|
|
divFrammAnnot.appendTo(collapse);
|
|
|
|
}
|
|
|
|
|
2023-11-10 17:14:48 +01:00
|
|
|
function hasComments(cid){
|
2023-11-07 15:25:50 +01:00
|
|
|
var id = cid.substr(9);
|
|
|
|
for (var pos in commentsArray){
|
|
|
|
var comments = commentsArray[pos]
|
|
|
|
if (comments.verso == id){
|
2023-12-19 15:35:44 +01:00
|
|
|
//console.log(comments)
|
2023-11-10 17:14:48 +01:00
|
|
|
return (true)
|
2023-11-07 15:25:50 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-10 17:14:48 +01:00
|
|
|
return false;
|
2023-11-07 15:25:50 +01:00
|
|
|
}
|
2023-12-19 15:35:44 +01:00
|
|
|
|
|
|
|
function hasCommentsJson(cid){
|
|
|
|
|
2023-12-20 14:44:57 +01:00
|
|
|
//return commentsJson.hasOwnProperty(cid.substr(9));
|
|
|
|
var id=cid.substr(9);
|
|
|
|
for (const [key, value] of Object.entries(commentsJson)) {
|
|
|
|
if(key==id || key.startsWith(id+'-'))
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
|
2023-12-19 15:35:44 +01:00
|
|
|
}
|
2023-11-22 18:22:10 +01:00
|
|
|
|
2023-11-21 10:11:33 +01:00
|
|
|
function numberOfComments(cid){
|
|
|
|
var id = cid.substr(9);
|
|
|
|
return commentsArray.filter(x => x.verso==id).length
|
|
|
|
}
|
2023-12-19 15:35:44 +01:00
|
|
|
|
|
|
|
function numberOfCommentsJson(cid){
|
|
|
|
var cntc=0
|
|
|
|
var id = cid.substr(9);
|
|
|
|
for (const [key, value] of Object.entries(commentsJson)) {
|
|
|
|
if(key==id || key.startsWith(id+'-'))
|
|
|
|
cntc+=commentsJson[key].length
|
|
|
|
}
|
|
|
|
return cntc
|
|
|
|
}
|
2023-12-05 16:38:44 +01:00
|
|
|
|
|
|
|
/*FINE GESTIONE CITAZIONI*/
|
|
|
|
|
2023-02-11 13:01:48 +01:00
|
|
|
function getCantica(numeroCantica){
|
|
|
|
|
|
|
|
switch (numeroCantica){
|
|
|
|
case 1: return("Inferno");
|
|
|
|
case 2: return("Purgatorio");
|
|
|
|
case 3: return("Paradiso");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-31 10:33:58 +02:00
|
|
|
//Visualizzazione lemma e categoria grammaticale
|
|
|
|
|
2023-02-08 17:07:49 +01:00
|
|
|
function formatTTContent(categ, syntType){
|
2023-02-02 13:43:55 +01:00
|
|
|
var details=[];
|
2023-08-31 10:33:58 +02:00
|
|
|
var lemma=categ.split('#')[1].replace("^", " ") //il lemma
|
2023-08-29 17:35:49 +02:00
|
|
|
var categoria=categ.split('#')[0] // la categoria
|
2023-08-31 10:33:58 +02:00
|
|
|
var details = getHoverContent(categoria);
|
2023-02-02 13:43:55 +01:00
|
|
|
|
|
|
|
var myitems;
|
2023-02-02 15:00:12 +01:00
|
|
|
var catgramm;
|
2023-02-02 13:43:55 +01:00
|
|
|
var subcatgramm = '';
|
|
|
|
var popoverText = '';
|
2023-02-08 17:07:49 +01:00
|
|
|
if (selectedVista=='frasi'){
|
2023-02-17 13:35:01 +01:00
|
|
|
return '<div class="ttContent"><b>'+maptypes[syntType]+'</b></div>';
|
2023-02-08 17:07:49 +01:00
|
|
|
}
|
2023-09-29 10:53:14 +02:00
|
|
|
|
2023-02-02 13:43:55 +01:00
|
|
|
for (detail of details){
|
2023-09-29 10:53:14 +02:00
|
|
|
|
2023-02-02 13:43:55 +01:00
|
|
|
myitems= detail.split(',');
|
2023-02-02 15:00:12 +01:00
|
|
|
|
2023-02-17 13:35:01 +01:00
|
|
|
catgramm='<div class="ttContent">';
|
2023-09-29 10:53:14 +02:00
|
|
|
subcatgramm='<p> <b> '+lemma+' - </b><i>'+myitems[0]+','+myitems.slice(1)+'</i></p></div>';
|
|
|
|
//subcatgramm='<p> <b> '+lemma+' - </b><i>'+myitems+'</i></p></div>';
|
2023-02-02 15:00:12 +01:00
|
|
|
popoverText = popoverText + catgramm + subcatgramm;
|
2023-02-02 13:43:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (popoverText);
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-01-10 10:45:18 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function getHoverContent(categ){
|
2023-02-08 17:07:49 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//console.log('Categoria '+categ)
|
2023-02-02 13:43:55 +01:00
|
|
|
var mycat=[];
|
2023-08-29 17:35:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
categ=categ.replace('%2A', '*')
|
|
|
|
categ=categ.replace('%2B', '+')
|
|
|
|
categ=categ.replace('%2C', ',')
|
|
|
|
categ=categ.replace('%2D', '-')
|
2023-01-24 15:40:28 +01:00
|
|
|
if(categ.includes('^')){
|
2023-02-02 13:43:55 +01:00
|
|
|
categs=categ.split('^')
|
2023-01-24 15:40:28 +01:00
|
|
|
for (cat of categs){
|
2023-02-02 13:43:55 +01:00
|
|
|
mycat.push(proprietaForma(cat))
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
//console.log(mycat.join('-'))
|
2023-02-02 13:43:55 +01:00
|
|
|
}else{
|
|
|
|
mycat.push(proprietaForma(categ));
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-02-02 13:43:55 +01:00
|
|
|
return(mycat);
|
|
|
|
}
|
|
|
|
|
|
|
|
function proprietaForma(categ){
|
2023-01-24 15:40:28 +01:00
|
|
|
if (categ[0]=='v'){
|
|
|
|
return parserVerbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='s'){
|
|
|
|
return parserSostantivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='e'){
|
|
|
|
return parserPreposizioni.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='b'){
|
|
|
|
return parserAvverbi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='p'){
|
|
|
|
return parserPronomi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='a'){
|
|
|
|
return parserAggettivi.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if(categ[0]=='r'){
|
|
|
|
return parserArticolo.parse(categ).split(',').filter(prop => prop.length > 0).join()
|
|
|
|
}
|
|
|
|
if (categ[0] == 'f') {
|
|
|
|
return parserCitazione.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
|
|
|
}
|
|
|
|
if (categ[0] == 'n') {
|
|
|
|
return parserOnomastica.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
|
|
|
}
|
|
|
|
if (categ[0] == 'c') {
|
|
|
|
return parserCongiunzione.parse(categ).split(',').filter(prop => prop.length > 0).join();
|
|
|
|
}
|
|
|
|
return categoriegrammaticali[categ[0]]
|
|
|
|
}
|
2023-02-08 17:07:49 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function cleanSearchResult() {
|
2023-03-20 18:08:05 +01:00
|
|
|
|
2023-02-24 20:07:03 +01:00
|
|
|
$("#headingZero").closest('.card').css("display", "none");
|
2023-03-15 18:37:58 +01:00
|
|
|
$("#collapseZero").collapse('hide');
|
2023-02-15 15:51:27 +01:00
|
|
|
$("#vistaFrasi").empty()
|
|
|
|
$("#vistaFrasi").css("display", "none");
|
2023-01-30 15:57:30 +01:00
|
|
|
for (msid of listaPeriodiRisultato){
|
2023-03-07 10:10:22 +01:00
|
|
|
$('.'+msid).each(function(){
|
|
|
|
//$(this).removeClass("font-weight-bold mark ")
|
|
|
|
$(this).css('color', '');
|
2023-01-30 15:57:30 +01:00
|
|
|
});
|
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
for (clsid of listaClausoleRisultato){
|
|
|
|
var tmpcl=clsid.split('-');
|
|
|
|
$('.'+tmpcl[0]).each(function(){
|
|
|
|
$(this).css('color', '');
|
|
|
|
});
|
|
|
|
}
|
2023-02-15 15:51:27 +01:00
|
|
|
|
2023-02-23 10:27:17 +01:00
|
|
|
//let minim=$(" .minimap__content")
|
2023-01-24 15:40:28 +01:00
|
|
|
for (forma of listarisultati) {
|
|
|
|
idforma = '#' + forma
|
|
|
|
$(idforma).removeClass("font-weight-bold mark ")
|
2023-02-22 14:57:21 +01:00
|
|
|
minim.contents().find(idforma).removeClass("font-weight-bold mark ")
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
|
2023-12-20 18:19:17 +01:00
|
|
|
$("#accordionNav .badge").remove();
|
2023-02-22 14:57:21 +01:00
|
|
|
//$("#headingZero").css("display", "none");
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
listarisultati = []
|
2023-01-30 15:57:30 +01:00
|
|
|
listaPeriodiRisultato=[]
|
2023-03-09 12:49:29 +01:00
|
|
|
listaClausoleRisultato=[]
|
2023-01-24 15:40:28 +01:00
|
|
|
resultSentences=new Set()
|
2023-03-20 18:08:05 +01:00
|
|
|
if(cantoDisplayed=='#vistaFrasi')
|
2023-02-27 09:40:26 +01:00
|
|
|
cantoDisplayed=prevCantoDisplayed
|
2023-02-15 15:40:01 +01:00
|
|
|
$(cantoDisplayed).attr('style', 'display: d-flex;');
|
2023-03-09 12:49:29 +01:00
|
|
|
//manageMM (cantoDisplayed)
|
2023-03-15 18:45:45 +01:00
|
|
|
currPage = 0;
|
2023-03-21 15:40:42 +01:00
|
|
|
latestPhraseId = "";
|
2023-03-20 18:08:05 +01:00
|
|
|
drawMinimap(cantoDisplayed, true)
|
2023-02-22 14:57:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function manageMM(name){
|
|
|
|
currentMinimap = name;
|
|
|
|
let testhtml = $(currentMinimap)[0].outerHTML;
|
2023-02-23 10:27:17 +01:00
|
|
|
//let minim=$(" .minimap__content")
|
2023-02-22 14:57:21 +01:00
|
|
|
let bm=minim.contents().find(' .blog-main')
|
|
|
|
bm.empty()
|
|
|
|
bm.append(testhtml)
|
2023-03-16 11:20:13 +01:00
|
|
|
getDimensionsDiv(true, true);
|
2023-02-22 14:57:21 +01:00
|
|
|
|
2023-02-21 16:30:02 +01:00
|
|
|
}
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var unitaRicerca='forma'
|
|
|
|
|
|
|
|
function manageQuery(){
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica = []
|
|
|
|
jsonQuery=getJsonQuery()
|
|
|
|
|
2023-03-08 10:02:21 +01:00
|
|
|
if(jsonQuery['QueryAvanzata']==0)
|
|
|
|
unitaRicerca='forma'
|
|
|
|
else
|
|
|
|
unitaRicerca=jsonQuery['unitaRicerca']
|
2023-01-24 15:40:28 +01:00
|
|
|
console.log("got json query, unita ricerca: "+unitaRicerca)
|
|
|
|
if(jsonQuery['QueryAvanzata']==0 && jsonQuery['Clausola0']['queryText']==''){
|
|
|
|
alert('Digitare una stringa da cercare')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
jsonQuery = buildSQ(jsonQuery)
|
|
|
|
|
|
|
|
myquery = new sparqlGenerator().stringify(jsonQuery)
|
|
|
|
console.log(myquery)
|
2024-01-04 17:12:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
executeQuerySearch(myquery)
|
2024-01-04 17:12:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//manage sentence and clauses
|
|
|
|
|
2023-03-13 11:57:34 +01:00
|
|
|
/* function showSentenceStructure(sentence) {
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
sid = '.' + sentence.toString()
|
|
|
|
//console.log(sid)
|
2023-02-01 17:46:32 +01:00
|
|
|
$(sid).addClass('text-info font-italic')
|
2022-12-06 17:39:52 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-03-13 11:57:34 +01:00
|
|
|
*/
|
2023-02-16 11:33:44 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function resetSentenceStructure(sentence) {
|
2023-02-01 17:46:32 +01:00
|
|
|
$(" ." + sentence).removeClass('text-info font-italic')
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2022-12-06 17:39:52 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//Cantica management functions
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
function showCanto(formecantica, idcantica, canto) {
|
|
|
|
var setVersiCanto = new Set()
|
2023-06-08 16:14:17 +02:00
|
|
|
var periodinum = {};
|
2023-01-30 15:57:30 +01:00
|
|
|
var cantica=cantiche[parseInt(idcantica)-1];
|
2023-02-08 17:07:49 +01:00
|
|
|
var elverso, formaItem, currSentenceId;
|
2023-06-08 16:14:17 +02:00
|
|
|
var ultimaFormaCanto;
|
|
|
|
let numeroPeriodo=1;
|
2023-01-30 15:57:30 +01:00
|
|
|
formecantica.map(function(item) {
|
|
|
|
formaItem = item.split("_");
|
|
|
|
var sentenceid=idcantica+"_"+formaItem[1]+"_s_"+formaItem[5]
|
|
|
|
if (formaItem[1]==canto){
|
|
|
|
if (! setVersiCanto.has(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])){
|
2023-05-23 18:27:35 +02:00
|
|
|
|
|
|
|
var verso = parseInt(formaItem[3]) - 1;
|
|
|
|
var idCommento = "Commento_"+idcantica+"_"+canto+"_"+verso;
|
2023-12-19 15:35:44 +01:00
|
|
|
//var commNumber = numberOfComments(idCommento);
|
|
|
|
var commNumber=numberOfCommentsJson(idCommento)
|
|
|
|
|
2023-11-21 10:11:33 +01:00
|
|
|
//if (hasComments(idCommento)){
|
2023-11-22 18:22:10 +01:00
|
|
|
if (commNumber>0){
|
|
|
|
createCommentSpan(idCommento, elverso, commNumber)
|
2023-12-05 10:27:27 +01:00
|
|
|
//console.log("Numero commenti: "+commNumber)
|
2023-05-23 18:27:35 +02:00
|
|
|
}
|
|
|
|
|
2023-02-08 17:07:49 +01:00
|
|
|
if(currSentenceId!=null && currSentenceId != sentenceid){
|
2023-06-08 16:14:17 +02:00
|
|
|
|
|
|
|
createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso, periodinum[currSentenceId])
|
2023-02-08 17:07:49 +01:00
|
|
|
currSentenceId=null
|
|
|
|
}
|
2023-02-27 09:03:20 +01:00
|
|
|
//elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1])
|
|
|
|
elverso=createDivVersoLI(cantica, formaItem[3], 'Canto_' + formaItem[1])
|
2023-01-30 15:57:30 +01:00
|
|
|
setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
|
|
|
|
}
|
2023-02-08 17:07:49 +01:00
|
|
|
if(currSentenceId==null || currSentenceId != sentenceid){
|
2023-06-08 16:14:17 +02:00
|
|
|
|
2023-02-08 17:07:49 +01:00
|
|
|
if (currSentenceId!=null){
|
2023-06-08 16:14:17 +02:00
|
|
|
createSpanPeriodiTag(closeSTag, 'c', formaItem[2]-1, currSentenceId, elverso, periodinum[currSentenceId])
|
2023-02-08 17:07:49 +01:00
|
|
|
}
|
|
|
|
currSentenceId=sentenceid;
|
2023-06-08 16:14:17 +02:00
|
|
|
if (periodinum[currSentenceId]==null){
|
|
|
|
periodinum[currSentenceId]=numeroPeriodo
|
|
|
|
numeroPeriodo=numeroPeriodo+1;
|
|
|
|
}
|
|
|
|
//periodinum[currSentenceId]=numeroPeriodo
|
|
|
|
//numeroPeriodo=numeroPeriodo+1;
|
|
|
|
createSpanPeriodiTag(openSTag, 'o', formaItem[2], sentenceid, elverso, periodinum[currSentenceId])
|
2023-02-08 17:07:49 +01:00
|
|
|
}
|
2023-01-30 15:57:30 +01:00
|
|
|
createSpanFormeNew(formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso)
|
2023-06-08 16:14:17 +02:00
|
|
|
ultimaFormaCanto=formaItem;
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
2023-06-08 16:14:17 +02:00
|
|
|
//crea tag di chiusura per l'ultimo periodo del canto
|
|
|
|
|
|
|
|
createSpanPeriodiTag(closeSTag, 'c', ultimaFormaCanto[2]-1, currSentenceId, elverso, periodinum[currSentenceId])
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-03-09 12:49:29 +01:00
|
|
|
//gestione risultati
|
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
if (listaPeriodiRisultato.length){
|
|
|
|
for (msid of listaPeriodiRisultato){
|
2023-03-07 10:10:22 +01:00
|
|
|
loadPeriodo(msid)
|
2023-03-08 09:31:58 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (listaClausoleRisultato.length){
|
|
|
|
for (clsid of listaClausoleRisultato){
|
|
|
|
let tmpid=clsid.split('-')
|
2024-01-03 15:09:53 +01:00
|
|
|
//loadFrase(tmpid[0], tmpid[1])
|
|
|
|
loadClausola(tmpid[0], tmpid[1], tmpid[2], tmpid[3])
|
2023-03-09 12:49:29 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2023-01-30 15:57:30 +01:00
|
|
|
|
|
|
|
if (listarisultati.length){
|
|
|
|
//evidenzia risultati
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-05-23 18:27:35 +02:00
|
|
|
|
2023-11-21 17:45:18 +01:00
|
|
|
function createCommentSpan(idVerso, elementoverso, numberOfComments) {
|
2023-05-23 18:27:35 +02:00
|
|
|
var spanoccorrenza = $('<button />')
|
|
|
|
spanoccorrenza.attr('id', idVerso)
|
2023-11-07 11:01:34 +01:00
|
|
|
//btn-sm btn-outline-secondary
|
2023-11-22 18:22:10 +01:00
|
|
|
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');
|
|
|
|
if (numberOfComments > 1){
|
2023-11-24 11:38:03 +01:00
|
|
|
var commentIcon = '<ion-icon name="document-attach"></ion-icon><ion-icon name="add-circle-outline"></ion-icon>';
|
2023-11-22 18:22:10 +01:00
|
|
|
} else {
|
2023-11-24 11:38:03 +01:00
|
|
|
var commentIcon = '<ion-icon name="document-attach"></ion-icon>';
|
2023-11-22 18:22:10 +01:00
|
|
|
}
|
|
|
|
//var commentIcon = '<ion-icon name="information"></ion-icon>';
|
2023-11-21 17:45:18 +01:00
|
|
|
//var number = " "+numberOfComments.toString();
|
2023-05-23 18:27:35 +02:00
|
|
|
spanoccorrenza.append(commentIcon)
|
2023-11-21 17:45:18 +01:00
|
|
|
//spanoccorrenza.append(number)
|
|
|
|
|
2023-05-23 18:27:35 +02:00
|
|
|
spanoccorrenza.appendTo(elementoverso)
|
|
|
|
}
|
|
|
|
|
2023-06-08 16:14:17 +02:00
|
|
|
function createSpanPeriodiTag(separator, catgramm, pos, sentenceid, elementoverso, pnum) {
|
2023-02-08 17:07:49 +01:00
|
|
|
var spanoccorrenza = $('<span />')
|
|
|
|
spanoccorrenza.attr('id', 'sep_'+pos)
|
|
|
|
spanoccorrenza.attr('title', catgramm)
|
|
|
|
spanoccorrenza.attr('class', sentenceid+' sentencetag')
|
|
|
|
spanoccorrenza.append(separator+" ")
|
|
|
|
if (separator==closeSTag){
|
|
|
|
varsupel=$('<sup />')
|
2023-06-08 16:14:17 +02:00
|
|
|
//varsupel.append(sentenceid.split('_')[3]+' ')
|
|
|
|
varsupel.append(pnum+' ')
|
2023-02-08 17:07:49 +01:00
|
|
|
varsupel.appendTo(spanoccorrenza)
|
|
|
|
}
|
|
|
|
spanoccorrenza.css("display", "none")
|
|
|
|
spanoccorrenza.appendTo(elementoverso)
|
|
|
|
|
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) {
|
2023-01-24 15:40:28 +01:00
|
|
|
var spanoccorrenza = $('<span />')
|
2023-03-13 09:24:31 +01:00
|
|
|
var nbsp=$('<span> </span>')
|
2023-01-24 15:40:28 +01:00
|
|
|
spanoccorrenza.attr('id', pos)
|
|
|
|
//spanoccorrenza.attr('data-cg', catgramm)
|
|
|
|
spanoccorrenza.attr('title', catgramm)
|
2023-02-03 15:42:34 +01:00
|
|
|
spanoccorrenza.attr('class', sentenceid+" "+clausefunct+' '+formaClass)
|
2023-03-13 09:24:31 +01:00
|
|
|
spanoccorrenza.append(forma)
|
2023-01-24 15:40:28 +01:00
|
|
|
spanoccorrenza.appendTo(elementoverso)
|
2023-03-13 09:24:31 +01:00
|
|
|
nbsp.appendTo(elementoverso)
|
2023-01-30 15:57:30 +01:00
|
|
|
}
|
2023-03-13 11:57:34 +01:00
|
|
|
/* function createDivVersoNew(cantica, num, canto) {
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-02-15 10:02:12 +01:00
|
|
|
var elementoverso = createDivVersoGeneric(cantica, num, canto)
|
|
|
|
|
|
|
|
elementoverso.appendTo('#' + cantica + canto)
|
|
|
|
return elementoverso
|
|
|
|
|
2023-03-13 11:57:34 +01:00
|
|
|
}*/
|
2023-02-15 10:02:12 +01:00
|
|
|
|
2023-02-24 18:06:26 +01:00
|
|
|
function createDivVersoLI(cantica, num, canto) {
|
2023-02-15 10:02:12 +01:00
|
|
|
|
2023-02-24 18:06:26 +01:00
|
|
|
var elementoverso = createDivVersoGenericLi(cantica, num, canto)
|
|
|
|
let cantoContainer=$('#' + cantica + canto);
|
|
|
|
elementoverso.appendTo(cantoContainer.find('ol'))
|
|
|
|
return elementoverso
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function createDivVersoGenericLi(cantica, num, canto) {
|
2023-02-27 09:03:20 +01:00
|
|
|
let digits=num.length
|
2023-02-24 18:06:26 +01:00
|
|
|
|
2023-02-27 09:03:20 +01:00
|
|
|
var spannum=$('<span />')
|
2023-02-24 18:06:26 +01:00
|
|
|
|
2023-02-27 09:03:20 +01:00
|
|
|
if (digits==1)
|
|
|
|
spannum.append('\xa0\xa0')
|
|
|
|
if (digits==2)
|
|
|
|
spannum.append('\xa0')
|
|
|
|
spannum.append(num+'. ')
|
|
|
|
var elementoverso = $('<li />')
|
|
|
|
//var elementoverso=$('<p />')
|
|
|
|
//elementoverso.append(spannum)
|
2023-02-24 18:06:26 +01:00
|
|
|
elementoverso.attr("value", num)
|
|
|
|
|
2023-02-27 09:03:20 +01:00
|
|
|
//elementoverso.attr("style", "line-height: 1.0em")
|
2023-02-24 18:06:26 +01:00
|
|
|
|
2023-03-06 20:35:15 +01:00
|
|
|
elementoverso.attr('class', 'f6 mb-0 text-muted text-nowrap font-weight-lighter ')//+cantica+' '+canto)
|
2023-02-24 20:07:03 +01:00
|
|
|
//elementoverso.attr('class', 'text-nowrap ')//+cantica+' '+canto)
|
2023-02-24 18:06:26 +01:00
|
|
|
|
|
|
|
elementoverso.attr('id', cantica + "_" + canto + "_" + num)
|
|
|
|
elementoverso.append('\xa0')
|
|
|
|
return elementoverso
|
|
|
|
}
|
|
|
|
|
2023-01-30 15:57:30 +01:00
|
|
|
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
function createAllDivCanti() {
|
|
|
|
var cantiche=["Inferno", "Purgatorio","Paradiso"]
|
2023-02-07 10:51:30 +01:00
|
|
|
var divFrasi = $('<div />')
|
|
|
|
var divDialoghi = $('<div />')
|
|
|
|
var divMetafore = $('<div />')
|
|
|
|
|
2023-02-11 13:01:48 +01:00
|
|
|
//var titoloFrasi = $('<h4 class="titolo-canto pb-2" />')
|
2023-02-07 10:51:30 +01:00
|
|
|
var titoloDialoghi = $('<h4 class="titolo-canto pb-2" />')
|
|
|
|
var titoloMetafore = $('<h4 class="titolo-canto pb-2" />')
|
|
|
|
|
2023-02-11 13:01:48 +01:00
|
|
|
//titoloFrasi.append("Frasi:");
|
2023-02-07 10:51:30 +01:00
|
|
|
titoloDialoghi.append("Dialoghi:");
|
|
|
|
titoloMetafore.append("Metafore:");
|
|
|
|
|
|
|
|
divFrasi.attr('id', "vistaFrasi")
|
2023-04-19 16:55:30 +02:00
|
|
|
divFrasi.attr('class', 'pb-4')
|
2023-02-07 10:51:30 +01:00
|
|
|
divDialoghi.attr('id', "vistaDialoghi")
|
2023-04-19 16:55:30 +02:00
|
|
|
divDialoghi.attr('class', 'pb-4')
|
2023-02-07 10:51:30 +01:00
|
|
|
divMetafore.attr('id', "vistaMetafore")
|
2023-04-19 16:55:30 +02:00
|
|
|
divMetafore.attr('class', 'pb-4')
|
2023-02-07 10:51:30 +01:00
|
|
|
|
|
|
|
divFrasi.appendTo('#displaycanto')
|
|
|
|
divDialoghi.appendTo('#displaycanto')
|
|
|
|
divMetafore.appendTo('#displaycanto')
|
|
|
|
|
|
|
|
divFrasi.css("display", "none")
|
|
|
|
divDialoghi.css("display", "none")
|
|
|
|
divMetafore.css("display", "none")
|
|
|
|
|
2023-02-11 13:01:48 +01:00
|
|
|
//titoloFrasi.appendTo(divFrasi)
|
2023-02-07 10:51:30 +01:00
|
|
|
titoloDialoghi.appendTo(divDialoghi)
|
|
|
|
titoloMetafore.appendTo(divMetafore)
|
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
for (cantica of cantiche){
|
|
|
|
for (var i=1; i<35; i++){
|
|
|
|
if(i==34 && cantica!=="Inferno"){
|
|
|
|
continue
|
|
|
|
}
|
2023-02-26 12:00:10 +01:00
|
|
|
canto= "Canto "+ i
|
|
|
|
cantoRomano= "Canto "+ getRoman(i)
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var divcanto = $('<div />')
|
|
|
|
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
|
2023-02-26 12:00:10 +01:00
|
|
|
titolocanto.append(cantica + ", " + cantoRomano)
|
2023-03-16 17:10:26 +01:00
|
|
|
divcanto.attr('class', 'canto pt-3')
|
2023-02-01 08:57:41 +01:00
|
|
|
divcanto.css("display", "none")
|
2023-02-15 12:00:51 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
|
|
|
titolocanto.appendTo(divcanto)
|
2023-02-24 18:06:26 +01:00
|
|
|
//nuovo
|
|
|
|
var olversi=$('<ol />')
|
2023-04-18 18:35:38 +02:00
|
|
|
olversi.attr('class', 'pb-4')
|
2023-02-24 18:06:26 +01:00
|
|
|
olversi.appendTo(divcanto)
|
|
|
|
//fine nuovo
|
2023-02-01 18:46:02 +01:00
|
|
|
divcanto.appendTo('#displaycanto')
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-01-22 17:38:22 +01:00
|
|
|
}
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//execute query
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
async function executeQuerySearch(query) {
|
|
|
|
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
|
|
|
//console.log(query)
|
|
|
|
alert(query)
|
2024-01-05 12:08:21 +01:00
|
|
|
$("#loader").fadeIn(300);
|
2023-01-24 15:40:28 +01:00
|
|
|
try {
|
|
|
|
var result = new Set()
|
|
|
|
var resultClauses = new Set()
|
|
|
|
|
|
|
|
var resultsInCantica = []
|
|
|
|
var resultsInCanto = []
|
|
|
|
seachbBindingsStream.on('data', (binding) => {
|
|
|
|
//cantica
|
|
|
|
if (binding.has('Cantica'))
|
|
|
|
cantica = binding.get('Cantica').value;
|
|
|
|
else
|
|
|
|
cantica='Nessuna'
|
|
|
|
|
|
|
|
|
|
|
|
//canto
|
|
|
|
if (binding.has('Canto'))
|
|
|
|
canto = binding.get('Canto').value;
|
|
|
|
else
|
|
|
|
canto='Canto 0'
|
|
|
|
|
|
|
|
//numero del verso
|
|
|
|
if (binding.has('NumeroVerso'))
|
|
|
|
numverso = binding.get('NumeroVerso').value;
|
|
|
|
else
|
|
|
|
numverso=0
|
|
|
|
//posizione del frammento
|
|
|
|
if (binding.has('pos'))
|
|
|
|
pos = binding.get('pos').value;
|
|
|
|
else{
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//regione della clausola
|
|
|
|
var clfrom=binding.get('clfr').value;
|
|
|
|
var clto=binding.get('clto').value;
|
2023-03-09 12:49:29 +01:00
|
|
|
var cltype=binding.get('clatype').value.replace('https://dantenetwork.it/ontology/syntit/current/','')
|
2023-04-21 10:45:17 +02:00
|
|
|
var clfunction=binding.get('clafunction').value.replace('https://dantenetwork.it/ontology/syntit/current/','')
|
2023-06-15 14:26:02 +02:00
|
|
|
var clocc=binding.get('clocc').value.replace('http://dantenetwork.it/data/commedia/','')
|
2023-04-21 10:45:17 +02:00
|
|
|
//var clfunction=binding.get('clf').value.replace('https://dantenetwork.it/ontology/syntit/current/','')
|
2023-01-24 15:40:28 +01:00
|
|
|
//id del periodo
|
|
|
|
var sentenceid=binding.get('sentence').value.replace('http://dantenetwork.it/data/commedia/','')
|
|
|
|
|
|
|
|
if (pos>0 && !result.has(pos)){
|
|
|
|
|
|
|
|
result.add(pos)
|
|
|
|
resultsInCantica.push(cantica);
|
|
|
|
resultsInCanto.push(cantica + canto)
|
|
|
|
}
|
2023-06-15 14:26:02 +02:00
|
|
|
resultClauses.add(sentenceid + "-" +clfrom+'-'+clto+"-"+clfunction.trim().replace('ordinateClause','').replace('MainClause', 'Ma')+'-'+cantica+'-'+canto+'-'+clocc)
|
2023-01-24 15:40:28 +01:00
|
|
|
resultSentences.add(sentenceid)
|
|
|
|
|
|
|
|
});
|
|
|
|
seachbBindingsStream.on('end', () => {
|
|
|
|
var resSent=new Set()
|
2024-01-03 15:09:53 +01:00
|
|
|
var resSentence=new Set()
|
2023-06-15 14:26:02 +02:00
|
|
|
var resClauses=[]
|
2023-02-23 10:27:17 +01:00
|
|
|
//let minim=$(" .minimap__content")
|
2023-01-24 15:40:28 +01:00
|
|
|
console.log('start rendering...')
|
|
|
|
listarisultati = Array.from(result)
|
|
|
|
var listaclausole=Array.from(resultClauses)
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
2023-03-09 12:49:29 +01:00
|
|
|
listaPeriodiRisultato=[]
|
|
|
|
listaClausoleRisultato=[]
|
|
|
|
//Unità di ricerca è 'frase'
|
2023-06-15 14:26:02 +02:00
|
|
|
|
2023-03-07 10:10:22 +01:00
|
|
|
if (!listarisultati.length || unitaRicerca == 'frase') {
|
|
|
|
|
|
|
|
resultsInCantica = []
|
|
|
|
resultsInCanto = []
|
2023-03-09 12:49:29 +01:00
|
|
|
//listaPeriodiRisultato = []
|
2023-03-07 10:10:22 +01:00
|
|
|
if (listaclausole.length) {
|
|
|
|
for (var frase of listaclausole) {
|
|
|
|
var fraseItems = frase.split('-');
|
|
|
|
|
2024-01-03 15:09:53 +01:00
|
|
|
//loadFrase(fraseItems[0].toString(), fraseItems[3].toString())
|
|
|
|
loadClausola(fraseItems[0].toString(), fraseItems[3].toString(), fraseItems[1], fraseItems[2])
|
2024-01-03 17:39:36 +01:00
|
|
|
resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]);
|
2023-06-15 14:26:02 +02:00
|
|
|
//if (!resSent.has(fraseItems[0] + '-' + fraseItems[3])) {
|
|
|
|
let tmpocc=fraseItems.slice(-1)
|
|
|
|
|
2023-11-26 13:38:27 +01:00
|
|
|
if (resClauses.filter(clocc => clocc==tmpocc[0]).length==0) {
|
|
|
|
resClauses.push(tmpocc[0]);
|
2024-01-03 17:39:36 +01:00
|
|
|
//resSent.add(fraseItems[0] + '-' + fraseItems[3]+'-'+fraseItems[1] + '-' + fraseItems[2]);
|
2024-01-03 15:09:53 +01:00
|
|
|
resSentence.add(fraseItems[1] + '-' + fraseItems[2]);
|
2023-06-15 14:26:02 +02:00
|
|
|
//resSent.add(fraseItems.slice(-1))
|
2023-01-24 15:40:28 +01:00
|
|
|
resultsInCantica.push(fraseItems[4]);
|
2023-11-26 13:38:27 +01:00
|
|
|
resultsInCanto.push(fraseItems[4] + fraseItems[5]);
|
2023-03-09 12:49:29 +01:00
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
2023-12-12 18:34:02 +01:00
|
|
|
listaClausoleRisultato=Array.from(resSent);
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
//Unità di ricerca è 'periodo'
|
2023-06-15 14:26:02 +02:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
if (unitaRicerca=='periodo' && listaclausole.length){
|
|
|
|
resultsInCantica=[]
|
|
|
|
resultsInCanto=[]
|
2023-03-09 12:49:29 +01:00
|
|
|
//listaPeriodiRisultato=[]
|
2023-01-24 15:40:28 +01:00
|
|
|
for (var frase of listaclausole){
|
|
|
|
var fraseItems=frase.split('-');
|
|
|
|
var mysid = '.' + fraseItems[0].toString()
|
|
|
|
console.log(mysid)
|
2023-01-30 15:57:30 +01:00
|
|
|
//$(mysid).addClass('font-italic')
|
|
|
|
//$(mysid).addClass("font-weight-bold mark ")
|
2023-03-07 10:10:22 +01:00
|
|
|
listaPeriodiRisultato.push(fraseItems[0].toString())
|
|
|
|
loadPeriodo(fraseItems[0].toString())
|
|
|
|
/*
|
2023-01-24 15:40:28 +01:00
|
|
|
$(mysid).each(function(){
|
2023-02-08 17:07:49 +01:00
|
|
|
//console.log('add id '+$(this).attr('id'));
|
2023-01-24 15:40:28 +01:00
|
|
|
listarisultati.push($(this).attr('id'))
|
2023-03-07 10:10:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
});
|
2023-03-07 10:10:22 +01:00
|
|
|
*/
|
2023-01-24 15:40:28 +01:00
|
|
|
if (!resSent.has(fraseItems[0])){
|
2023-11-10 17:14:48 +01:00
|
|
|
resSent.add(fraseItems[0]);
|
2023-01-24 15:40:28 +01:00
|
|
|
resultsInCantica.push(fraseItems[4]);
|
2023-11-10 17:14:48 +01:00
|
|
|
resultsInCanto.push(fraseItems[4] + fraseItems[5]);
|
|
|
|
}
|
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (listarisultati.length){
|
|
|
|
//evidenzia risultati
|
|
|
|
for (ris of listarisultati) {
|
|
|
|
idris = '#' + ris
|
|
|
|
$(idris).addClass("font-weight-bold mark ")
|
2023-02-23 10:27:17 +01:00
|
|
|
minim.contents().find(idris).addClass("font-weight-bold mark ")
|
2023-02-22 11:20:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-16 11:20:13 +01:00
|
|
|
//ordino la lista dei risultati
|
|
|
|
listarisultati.sort(function(a, b){return a - b});
|
2023-03-16 14:29:51 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
//aggiunge badge con totale risultati accanto alle cantiche
|
|
|
|
i = 0
|
2023-02-10 16:09:14 +01:00
|
|
|
var totResultN=0;
|
2023-02-11 13:01:48 +01:00
|
|
|
var listIcon = '<ion-icon name="list-outline"></ion-icon>';
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
for (cantica of cantiche) {
|
|
|
|
i += 1
|
|
|
|
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
|
|
|
if (count>0){
|
2023-02-10 16:09:14 +01:00
|
|
|
totResultN+=count
|
2023-01-24 15:40:28 +01:00
|
|
|
var spanbadgecantica = $('<span />');
|
2023-02-17 13:35:01 +01:00
|
|
|
spanbadgecantica.attr('class', 'badge badge-warning badge-pill mx-2');
|
2023-02-13 13:30:32 +01:00
|
|
|
spanbadgecantica.append(count)
|
2023-02-09 19:21:04 +01:00
|
|
|
spanbadgecantica.appendTo($('#cantica' + i + '-badge'))
|
|
|
|
//$('#cantica' + i).after(spanbadgecantica)
|
2023-01-24 15:40:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-22 14:57:21 +01:00
|
|
|
//aggiunge badge con totale risultati nel bottone lista risultati
|
2023-02-10 16:09:14 +01:00
|
|
|
if (totResultN>0){
|
2023-02-24 20:07:03 +01:00
|
|
|
$("#headingZero").closest('.card').attr('style', 'display: d-flex;')
|
2023-02-10 16:09:14 +01:00
|
|
|
var spanbadgelista = $('<span />');
|
2023-03-15 18:12:38 +01:00
|
|
|
spanbadgelista.attr('class', 'badge badge-warning badge-pill mx-2 ');
|
2023-02-11 13:01:48 +01:00
|
|
|
spanbadgelista.append(totResultN+listIcon)
|
2023-02-10 16:09:14 +01:00
|
|
|
spanbadgelista.appendTo($('#cantica0-badge'))
|
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
//aggiunge badge con totale risultati accanto ai canti
|
2023-02-10 16:09:14 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
console.log('results end...')
|
|
|
|
|
|
|
|
//console.log(sid)
|
|
|
|
var $nctags= $(' .navig-canto')
|
2023-06-15 14:26:02 +02:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
for (cantica of cantiche) {
|
|
|
|
for (k of Array(35).keys()) {
|
|
|
|
if (k == 0)
|
|
|
|
continue
|
2023-06-15 14:26:02 +02:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
let count = resultsInCanto.reduce((n, x) => n + (x === cantica + 'Canto ' + k), 0);
|
|
|
|
if (count>0){
|
|
|
|
var spanbadge = $('<span />');
|
|
|
|
spanbadge.attr('class', cantobadgeclass);
|
2023-02-13 13:30:32 +01:00
|
|
|
spanbadge.append(count)
|
2023-01-24 15:40:28 +01:00
|
|
|
//spanbadge.appendTo($('[name="' + cantica + 'Canto ' + k + '"]'))
|
|
|
|
spanbadge.appendTo($nctags.filter('[name="' + cantica + 'Canto ' + k + '"]'))
|
|
|
|
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-22 11:20:16 +01:00
|
|
|
console.log('badge end...')
|
2023-03-16 14:29:51 +01:00
|
|
|
//calcolo numero dei contesti
|
|
|
|
countResultContexts()
|
2024-01-05 12:08:21 +01:00
|
|
|
$("#loader").fadeOut(300);
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
});
|
2023-02-11 13:01:48 +01:00
|
|
|
queryExecuted = true;
|
|
|
|
$(cantoDisplayed).attr('style', 'display: d-flex;');
|
|
|
|
$("#vistaFrasi").css("display", "none");
|
2023-03-16 14:29:51 +01:00
|
|
|
|
2023-01-22 17:38:22 +01:00
|
|
|
}
|
2023-01-24 15:40:28 +01:00
|
|
|
catch (err) {
|
|
|
|
console.log(err.message);
|
2024-01-05 12:08:21 +01:00
|
|
|
$("#loader").fadeOut(300);
|
2023-01-24 15:40:28 +01:00
|
|
|
};
|
2024-01-04 17:12:59 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* REGOLE DI PARSING PER VISUALIZZAZIONE CATEGORIE GRAMMATICALI
|
|
|
|
*/
|
|
|
|
|
|
|
|
const categoriegrammaticali={"v":"Verbo", "s":"Sostantivo", "a":"Aggettivo", "p":"Pronome", "r":"Articolo", "b":"Avverbio","e":"Preposizione",
|
|
|
|
"c":"Congiunzione", "i":"Interiezione", "n":"Onomastica", "f":"Citazione", "l":"Locuzione",
|
|
|
|
"r-e":"Articolo, Preposizione", "b-v":"Avverbio, Verbo", "p-v":"Pronome, Verbo",
|
|
|
|
"b-p-v":"Avverbio, Pronome, Verbo", "b-p":"Avverbio, Pronome",
|
|
|
|
"e-p":"Preposizione, Pronome", "a-s":"Aggettivo, Sostantivo",
|
|
|
|
"e-r":"Preposizione, Articolo", "v-b":"Verbo, Avverbio", "v-p":"Verbo, Pronome",
|
|
|
|
"v-p-b":"Verbo, Pronome, Avverbio", "p-b":"Pronome, Avverbio",
|
|
|
|
"p-e":"Pronome, Preposizione", "s-a":"Sostantivo, Aggettivo",}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var categoriegrammaticaliGrammar=`Expression = head:(Filtro){return 'Verbo,'+head.join()}
|
|
|
|
Filtro= fhead:("v")? tail:( transitivita? diatesi? impersonalita?
|
|
|
|
coniugazione? modotempo?
|
|
|
|
persona? funzione? declinazione?
|
|
|
|
genere? numero? grado?){return tail}
|
|
|
|
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
diatesi= [a|p] {if (text()=='a') return ' Attivo'; else return ' Passivo';}
|
|
|
|
|
|
|
|
transitivita=[i|t]? {if (text()=='t') return ' Transitivo'; else if (text()=='i') return ' Intransitivo';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
impersonalita=([*|+])? {if (text()=='*') return ' Impersonale'; else if (text()=='+')return ' Riflessivo';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima coniugazione';
|
|
|
|
case(2): return ' Seconda coniugazione';
|
|
|
|
case(3): return ' Terza coniugazione';
|
|
|
|
case(4): return ' Ausiliare essere'
|
|
|
|
case(5): return ' Ausiliare avere'}}
|
|
|
|
modotempo=modo:"ip" {return(' Presente indicativo')}/
|
|
|
|
"ib" {return(" Passato Prossimo Indicativo")}/
|
|
|
|
"ii" {return(" Imperfetto Indicativo")}/
|
|
|
|
"ir" {return(" Passato Remoto Indicativo")}/
|
|
|
|
"is" {return( " Trapassato Prossimo Indicativo")}/
|
|
|
|
"it" {return( " Trapassato Remoto Indicativo")}/
|
|
|
|
"if" {return(" Futuro Semplice Indicativo")}/
|
|
|
|
"ia" {return(" Futuro Anteriore Indicativo")}/
|
|
|
|
"cp" {return( " Presente Congiuntivo")}/
|
|
|
|
"ci" {return( " Imperfetto Congiuntivo")}/
|
|
|
|
"cr" {return( " Passato Congiuntivo")}/
|
|
|
|
"ct" {return( " Trapassato Congiuntivo")}/
|
|
|
|
"dp" {return( " Presente Condizionale")}/
|
|
|
|
"dr" {return( " Passato Condizionale")}/
|
|
|
|
"mp" {return( " Presente Imperativo")}/
|
|
|
|
"fp" {return( " Presente Infinito")}/
|
|
|
|
"fr" {return( " Passato Infinito")}/
|
|
|
|
"pp" {return( " Presente Participio")}/
|
|
|
|
"pr" {return( " Passato Participio")}/
|
|
|
|
"gp" {return( " Presente Gerundio")}/
|
|
|
|
"gr" {return( " Passato Gerundio")}/
|
|
|
|
"pf" {return( " Participio Futuro")}
|
|
|
|
persona="s1" {return(' Prima persona singolare')}/
|
|
|
|
"s2" {return(' Seconda persona singolare')}/
|
|
|
|
"s3" {return(' Terza persona singolare')}/
|
|
|
|
"p1" {return(' Prima persona plurale')}/
|
|
|
|
"p2" {return(' Seconda persona plurale')}/
|
|
|
|
"p3" {return(' Terza persona plurale')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
funzione="a" {return(' Verbo Funzione Aggettivo')}/
|
|
|
|
"sm" {return(' Verbo Funzione Sostantivo maschile')}/
|
|
|
|
"sf" {return(' Verbo Funzione Sostantivo femminile')}/
|
|
|
|
"b" {return(' Verbo Funzione Avverbio')}/
|
|
|
|
"l" {return(' Verbo Funzione Locuzione')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
declinazione=[1|2|3|4|5] {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima declinazione';
|
|
|
|
case(2): return ' Seconda declinazione';
|
|
|
|
case(3): return ' Terza declinazione';
|
|
|
|
case(4): return ' nd'
|
|
|
|
case(5): return ' nd'}}
|
|
|
|
|
|
|
|
genere=[f|m] {if (text()=='f') return ' Femminile'; else if (text()=='m') return ' Maschile';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
numero=[s|p] {if (text()=='s') return ' Singolare'; else if (text()=='p') return ' Plurale';}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
grado="c+" {return(' Grado c+ singolare')}/
|
|
|
|
"c-" {return(' Grado c-')}/
|
|
|
|
"c=" {return(' Grado c=')}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var categoriaGrammaticaleSostantivo = `
|
|
|
|
Expression = head:(Filtro){return 'Sostantivo,'+head.join()}
|
|
|
|
Filtro= fhead:("s")? tail:( genereforma? declinazionesostantivo? generelemma?
|
|
|
|
numersingolareplurale? locuzione?){return tail}
|
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
declinazionesostantivo= [1|2|3]? {switch(parseInt(text())){
|
|
|
|
case(1): return ' Prima declinazione';
|
|
|
|
case(2): return ' Seconda declinazione';
|
|
|
|
case(3): return ' Terza declinazione'}}
|
|
|
|
|
|
|
|
genereforma=[m|f]? {if (text()=='m') return ' forma maschile'; else if (text()=='f') return ' forma femminile';}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
generelemma=[m|f]? {if (text()=='m') return ' lemma maschile'; else if (text()=='f') return ' lemma femminile';}
|
|
|
|
|
|
|
|
numersingolareplurale=[s|p]? {if (text()=='s') return ' numero singolare'; else if (text()=='p') return ' numero plurale';}
|
|
|
|
|
|
|
|
locuzione="Iv" {return('In Locuzione verbo');}
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
|
|
|
|
|
|
|
_ "whitespace"= " "*
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
var categoriaGrammaticalePreposizione = `
|
|
|
|
Expression = head:(Filtro){return 'Preposizione,'+head.join()}
|
|
|
|
Filtro= fhead:("e")? tail:( tipo1? tipo2? sintassi? complemento1? complemento2?){return tail}
|
|
|
|
|
|
|
|
|
|
|
|
tipo1=[p|i] {if (text()=='i') return ' Impropria'; else if (text()=='p') return ' Impropria';}
|
|
|
|
tipo2=modo:"a" {return(' Articolata')}/
|
|
|
|
"lx" {return(" In locuzione separata")}/
|
|
|
|
"l" {return(" In locuzione")} /
|
|
|
|
"s" {return(" Semplice")}
|
|
|
|
|
|
|
|
sintassi=[sodbfcnutmezlpa] {if (text()=='s') return ' Soggettiva';
|
|
|
|
if (text()=='o') return ' Oggettiva';
|
|
|
|
if (text()=='d') return ' Dichiarativa';
|
|
|
|
if (text()=='b') return ' Completiva obliqua';
|
|
|
|
if (text()=='f') return ' Finale';
|
|
|
|
if (text()=='c') return ' Causale';
|
|
|
|
if (text()=='n') return ' Concessiva';
|
|
|
|
if (text()=='u') return ' Consecutiva';
|
|
|
|
if (text()=='t') return ' Temporale';
|
|
|
|
if (text()=='m') return ' Modale';
|
|
|
|
if (text()=='e') return ' Eccettuativa';
|
|
|
|
if (text()=='z') return ' Esclusiva';
|
|
|
|
if (text()=='l') return ' Limitativa';
|
|
|
|
if (text()=='p') return ' Comparativa';
|
|
|
|
if (text()=='a') return ' Avversativa';}
|
|
|
|
|
|
|
|
complemento1="ktd" {return(" Di tempo determinato")} /
|
|
|
|
"ktc" {return(" Di tempo continuato")} /
|
|
|
|
"kt" {return(' Di tempo')}/
|
|
|
|
"kdl" {return(" Di moto da luogo")} /
|
|
|
|
"kd" {return(" Di termine")}/
|
|
|
|
"kv" {return(" Di vantaggio")} /
|
|
|
|
"ksl" {return(" Di stato in luogo")} /
|
|
|
|
"ks" {return(" Di svantaggio")} /
|
|
|
|
"kg" {return(" Di specificazione")} /
|
|
|
|
"kml" {return(" Di moto a luogo")} /
|
|
|
|
"km" {return(" Di modo")} /
|
|
|
|
"kw" {return(" Di mezzo")} /
|
|
|
|
"kc" {return(" Di compagnia")} /
|
|
|
|
"ku" {return(" Di unione")} /
|
|
|
|
"ka" {return(" Di allontanamento/separazione")} /
|
|
|
|
"kz" {return(" Di materia")} /
|
|
|
|
"kl" {return(" Di luogo")} /
|
|
|
|
"ko" {return(" Di sostanza")} /
|
|
|
|
"kpl" {return(" Di moto per luogo")} /
|
|
|
|
"kps" {return(" Predicativa del soggetto")} /
|
|
|
|
"kpo" {return(" Predicativa dell'oggetto")}
|
|
|
|
|
|
|
|
|
|
|
|
complemento2=
|
|
|
|
"kp" {return(" Di Limitazione")} /
|
|
|
|
"kq" {return(" Di Qualità")} /
|
|
|
|
"kr" {return(" Di Causa")} /
|
|
|
|
"ki" {return(" Di Agente")} /
|
|
|
|
"ke" {return(" Di Causa Efficiente")} /
|
|
|
|
"kf" {return(" Di Fine Scopo")} /
|
|
|
|
"ky" {return(" Di Paragone")} /
|
|
|
|
"kx" {return(" Di Argomento")} /
|
|
|
|
"kb" {return(" Distributivo")} /
|
|
|
|
"kj" {return(" Di Sostituzione")} /
|
|
|
|
"kn" {return(" Di Estensione")} /
|
|
|
|
"k1b" {return(" Indiretta Benefattiva")} /
|
|
|
|
"k1p" {return(" Indiretta Possessore")} /
|
|
|
|
"k1o" {return(" Indiretta Oggetto")} /
|
|
|
|
"k1d" {return(" Indiretta Dativo")} /
|
|
|
|
"k1e" {return(" Indiretta Esperiente")} /
|
|
|
|
"k2" {return(" Simmetrica")} /
|
|
|
|
"k3" {return(" Di Pena")} /
|
|
|
|
"k4" {return(" Di Effetto")} /
|
|
|
|
"k5" {return(" Concessiv")} /
|
|
|
|
"k6" {return(" Di Origine Provenienza")} /
|
|
|
|
"k7" {return(" Di Abbondanza/Privazione")} /
|
|
|
|
"k8" {return(" Partitiva")} /
|
|
|
|
"k9" {return(" Di Denominazione")} /
|
|
|
|
"k10" {return(" Di Colpa")} /
|
|
|
|
"k11" {return(" Di Quantità")} /
|
|
|
|
"k12" {return(" Di Peso")} /
|
|
|
|
"k13" {return(" Di Esclusione")} /
|
|
|
|
"k14" {return(" Di Rapporto")}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var avverbio = ` Expression = head:(Filtro){return 'Avverbio,'+head.join()}
|
|
|
|
Filtro= fhead:("b")? tail:( fake? tipo?){return tail}
|
|
|
|
|
|
|
|
fake= ""
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo="c+" {return(' Avverbio al Comparativo di Maggioranza')}/
|
|
|
|
"c-" {return(' Avverbio al Comparativo di Minoranza')}/
|
|
|
|
"sa" {return(' Avverbio al Superlativo Assoluto')}/
|
|
|
|
"sr" {return(' Avverbio al Superlativo Relativo')}/
|
|
|
|
"lz" {return(' Avverbio in Locuzione Separato')}/
|
|
|
|
"l" {return(' Avverbio in Locuzione')}/
|
|
|
|
"y" {return(' Avverbio Proclitico')}/
|
|
|
|
"x" {return(' Avverbio Enclitico')}/
|
|
|
|
"c" {return(' Avverbio al Comparativo di Uguaglianza')}
|
2023-01-10 15:26:58 +01:00
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
var pronome = `
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Expression = head:(Filtro){return 'Pronome,'+head.join()}
|
|
|
|
Filtro= fhead:("p")? tail:( tipo_pronome? classe_pronome? genere_pronome?
|
|
|
|
numero_pronome? forma_pronome? funzione_pronome? tiporiflessivi?){return tail}
|
|
|
|
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_pronome= "p" {return(' Pronome Personale')}/
|
|
|
|
"f" {return(" Pronome Riflessivo")}/
|
|
|
|
"s" {return(" Pronome Possessivo")}/
|
|
|
|
"d" {return(" Pronome Dimostrativo")}/
|
|
|
|
"i" {return(" Pronome Indefinito")}/
|
|
|
|
"r" {return(" Pronome Relativo")}/
|
|
|
|
"t" {return(" Pronome Interrogativo")}/
|
|
|
|
"e" {return(" Pronome Esclamativo")}/
|
|
|
|
"n" {return(" Pronome Numerale")}
|
|
|
|
|
|
|
|
classe_pronome= "1" {return(" Prima Classe Persona")}/
|
|
|
|
"2" {return(" Seconda Classe Persona")}/
|
|
|
|
"3" {return(" Terza Classe Persona")}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere_pronome= "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}/
|
|
|
|
"n" {return(" Neutro")}
|
|
|
|
numero_pronome= "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
forma_pronome= "l" {return(" Pronome Libero")}/
|
|
|
|
"i" {return(" Pronome Libero In Composizione")}/
|
|
|
|
"y" {return(" Pronome Proclitico")}/
|
|
|
|
"x" {return(" Pronome Enclitico")}
|
|
|
|
funzione_pronome="so" {return(' Libero Soggetto')}/
|
|
|
|
"soi" {return(' Libero Soggetto Impersonale')}/
|
|
|
|
"co" {return(' Libero Complemento')}/
|
|
|
|
"ra" {return(' Libero Rafforzativo')}/
|
|
|
|
"ac" {return(' Clitico Accusativo')}/
|
|
|
|
"da" {return(' Clitico Dativo')}/
|
|
|
|
"pt" {return(' Clitico Partitivo')}
|
2022-12-17 19:42:44 +01:00
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tiporiflessivi="pr" {return(' Proprio')}/
|
|
|
|
"le" {return(' Lessicalizzato')}/
|
|
|
|
"im" {return(' Impersonale')}/
|
|
|
|
"pa" {return(' Passivo')}/
|
|
|
|
"re" {return(' Reciproco')}
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var categoriaGrammaticaleAggettivo = `
|
|
|
|
Expression = head:(Filtro){return 'Aggettivo,'+head.join()}
|
|
|
|
Filtro= fhead:("a")? tail:( tipo_aggettivo classe_aggettivo? genere_aggettivo?
|
|
|
|
numero_aggettivo? grado_aggettivo? tipo_complemento? tipo_frase?
|
|
|
|
oggetto_indiretto?){return tail}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_aggettivo =
|
|
|
|
"i" {return(" Indefinito")}/
|
|
|
|
"t" {return(" Interrogativo")}/
|
|
|
|
"e" {return(" Esclamativo")}/
|
|
|
|
"n" {return(" Numerale")}/
|
|
|
|
"d" {return(" Dimostrativo")}/
|
|
|
|
"r" {return(" Relativo")}/
|
|
|
|
"s" {return(" Possessivo")}/
|
|
|
|
"l" {return(" In locuzione")}/
|
|
|
|
"" {return(" Qualificativo")}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
|
|
|
classe_aggettivo = "1" {return(" Prima Classe")}/
|
|
|
|
"2" {return(" Seconda Classe")}
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere_aggettivo= "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}/
|
|
|
|
"n" {return(" Neutro")}
|
|
|
|
|
|
|
|
numero_aggettivo= "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
|
|
|
|
grado_aggettivo = "c+" {return(" Comparativo Di Maggioranza")}/
|
|
|
|
"c-" {return(" Comparativo Di Minoranza")}/
|
|
|
|
"c=" {return(" Comparativo Di Uguaglianza")}/
|
|
|
|
"sr" {return(" Superlativo Relativo")}/
|
|
|
|
"sa" {return(" Superlativo Assoluto")}
|
|
|
|
|
|
|
|
tipo_complemento ="xc10" {return(" Introdotto Da VERSO")}/
|
|
|
|
"xc11" {return(" Introdotto Da SOPRA")}/
|
|
|
|
"xc12" {return(" Introdotto Da SOTTO")}/
|
|
|
|
"xc13" {return(" Introdotto Da DINANZI")}/
|
|
|
|
"xc1" {return(" Introdotto Da A")}/
|
|
|
|
"xc2" {return(" Introdotto Da CON")}/
|
|
|
|
"xc3" {return(" Introdotto Da CONTRO")}/
|
|
|
|
"xc4" {return(" Introdotto Da DA")}/
|
|
|
|
"xc5" {return(" Introdotto Da DI")}/
|
|
|
|
"xc6" {return(" Introdotto Da IN")}/
|
|
|
|
"xc7" {return(" Introdotto Da PER")}/
|
|
|
|
"xc8" {return(" Introdotto Da SU")}/
|
|
|
|
"xc9" {return(" Introdotto Da TRA")}/
|
|
|
|
"xc" {return(" Introdotto Da Preposizione")}/
|
|
|
|
"xo1" {return(" Oggetto Ind")}/
|
|
|
|
"xo5" {return(" Oggetto Ind Compl Con DI")}/
|
|
|
|
"xo" {return(" Oggetto Ind Pronom")}
|
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo_frase =
|
|
|
|
"xf1" {return("Con Infinito Retto Da A")}/
|
|
|
|
"xf2" {return("Con Infinito Retto Da DA")}/
|
|
|
|
"xf3" {return("Con Infinito Retto Da DI")}/
|
|
|
|
"xf4" {return("Con Infinito Retto Da PER")}/
|
|
|
|
"xf5" {return("Con Infinito Retto Da SE")}/
|
|
|
|
"xh1" {return("Con Subordinata All Indicativo")}/
|
|
|
|
"xh2" {return("Con Subordinata Al Congiuntivo")}/
|
|
|
|
"xz1" {return("In Locuzione Imp Infinito")}/
|
|
|
|
"xz2" {return("In LocuzioneImp Che Indicativo")}/
|
|
|
|
"xz3" {return("In Locuzione Imp Che Congiuntivo")}/
|
|
|
|
"xz4" {return("In Locuzione Imp Se Indicativo")}/
|
|
|
|
"xz5" {return("In Locuzione Imp Se Congiuntivo")}/
|
|
|
|
"xz6" {return("In Locuzione Imp Come Indicativo")}/
|
|
|
|
"xz7" {return("In Locuzione Imp Quando Indicativo")}/
|
|
|
|
"xz8" {return("In Locuzione Imp Perché Congiuntivo")}/
|
|
|
|
"xz9" {return("In Locuzione Imp A Infinito")}
|
|
|
|
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
oggetto_indiretto =
|
|
|
|
",o" {return(" Con Oggetto Indiretto")}
|
|
|
|
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
|
|
|
|
`
|
|
|
|
var categoriaGrammaticaleArticolo = `
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Expression = head:(Filtro){return 'Articolo,'+head.join()}
|
|
|
|
Filtro= fhead:("r")? tail:( tipo? genere? numero?){return tail}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo =
|
|
|
|
"d" {return(" Determinativo")}/
|
|
|
|
"i" {return(" Indeterminativo")}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
genere = "m" {return(" Maschile")}/
|
|
|
|
"f" {return(" Femminile")}
|
|
|
|
|
|
|
|
numero = "s" {return(" Singolare")}/
|
|
|
|
"p" {return(" Plurale")}
|
|
|
|
|
|
|
|
|
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-19 19:19:20 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-19 19:19:20 +01:00
|
|
|
|
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var citazione = `
|
|
|
|
Expression = head:(Filtro){return 'Citazione,'+head.join()}
|
|
|
|
Filtro= fhead:("f") tail:( fake? tipo?){return tail}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
fake = ""
|
|
|
|
tipo="l" {return(' Citazione Latina')}/
|
|
|
|
"p" {return(' Citazione Provenzale')}/
|
|
|
|
"r" {return(' Citazione Francese')}/
|
|
|
|
"s" {return(' Citazione Spagnola')}/
|
|
|
|
"e" {return(' Citazione Ebraica')}/
|
|
|
|
"g" {return(' Citazione Greca')}
|
2022-12-19 19:35:41 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
`
|
|
|
|
var onomastica = `Expression = head:(Filtro){return 'Onomastica,'+head.join()}
|
|
|
|
Filtro= fhead:("n") tail:( proprio tipo?){return tail}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo="x" {return(' Separato')}/
|
|
|
|
"t" {return(' Titolo')}
|
|
|
|
proprio = "p" {return("Nome Proprio")}
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
`
|
|
|
|
var congiunzione = `
|
|
|
|
Expression = head:(Filtro){return 'Congiunzione,'+head.join()}
|
|
|
|
Filtro= fhead:("c") tail:( tipo? cordinativasubordinativa? tipocoordinativa?
|
|
|
|
tiposubordinativa* complementodue?){return tail}
|
|
|
|
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipo = "lx" {return(' LocuzioneSeparata')}/
|
|
|
|
"c" {return(" Composta")}/
|
|
|
|
"l" {return(" Locuzione")}/
|
|
|
|
"s" {return(" Semplice")}
|
|
|
|
|
|
|
|
cordinativasubordinativa = "c" {return(" Coordinativa")}/
|
|
|
|
"s" {return(" Subordinativa")}
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
tipocoordinativa = "c" {return(" Copulativa")}/
|
|
|
|
"d" {return(" Disgiuntiva")}/
|
|
|
|
"a" {return(" Avversativa")}/
|
|
|
|
"n" {return(" Conclusiva")}/
|
|
|
|
"e" {return(" Esplicativa")}/
|
|
|
|
"r" {return(" Correlativa")}
|
|
|
|
tiposubordinativa = "s" {return(" Soggettiva")}/
|
|
|
|
"o" {return(" Oggettiva")}/
|
|
|
|
"d" {return(" Dichiarativa")}/
|
|
|
|
"b" {return(" Completiva Obliqua")}/
|
|
|
|
"i" {return(" Interrogativa")}/
|
|
|
|
"f" {return(" Finali")}/
|
|
|
|
"c" {return(" Causali")}/
|
|
|
|
"n" {return(" Concessiva")}/
|
|
|
|
"u" {return(" Consecutiva")}/
|
|
|
|
"t" {return(" Temporale")}/
|
|
|
|
"m" {return(" Modale")}/
|
|
|
|
"e" {return(" Eccettuativa")}/
|
|
|
|
"p" {return(" Comparativa")}/
|
|
|
|
"v" {return(" Condizionale")}/
|
|
|
|
"z" {return(" Esclusiva")}/
|
|
|
|
"l" {return(" Limitativa")}
|
|
|
|
complementodue =
|
|
|
|
"x" {return(" Locuzione Separata")}
|
2022-12-22 16:00:13 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
Integer "integer"
|
|
|
|
= _ [0-9]+ { return parseInt(text(), 10); }
|
2022-12-22 15:08:16 +01:00
|
|
|
|
2023-01-24 15:40:28 +01:00
|
|
|
_ "whitespace"= " "*
|
|
|
|
`
|
|
|
|
//parser per categorie grammaticali
|
|
|
|
var parserVerbi = peg.generate(categoriegrammaticaliGrammar);
|
|
|
|
var parserSostantivi = peg.generate(categoriaGrammaticaleSostantivo);
|
|
|
|
var parserPreposizioni = peg.generate(categoriaGrammaticalePreposizione);
|
|
|
|
var parserAvverbi = peg.generate(avverbio);
|
|
|
|
var parserPronomi = peg.generate(pronome);
|
|
|
|
var parserAggettivi = peg.generate(categoriaGrammaticaleAggettivo);
|
|
|
|
var parserArticolo = peg.generate(categoriaGrammaticaleArticolo);
|
|
|
|
var parserCitazione = peg.generate(citazione);
|
|
|
|
var parserOnomastica = peg.generate(onomastica);
|
|
|
|
var parserCongiunzione = peg.generate(congiunzione);
|
2023-01-22 17:38:22 +01:00
|
|
|
|
2022-12-16 14:05:59 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|