Cantiche caricate all'apertura e pulizia di cesareBrowse.js
This commit is contained in:
parent
bd3e535b6d
commit
e822c88f28
|
@ -23,6 +23,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$("#cla_Grammaticale").attr('style', "display: none;");
|
$("#cla_Grammaticale").attr('style', "display: none;");
|
||||||
$("#cla-Sintattico").attr('style', "display: none;");
|
$("#cla-Sintattico").attr('style', "display: none;");
|
||||||
|
$("#filtri").attr('style', "display: none;");
|
||||||
|
|
||||||
$('.tabs__menu-item').on('click', function() {
|
$('.tabs__menu-item').on('click', function() {
|
||||||
$(this).addClass('bg-white').addClass('red');
|
$(this).addClass('bg-white').addClass('red');
|
||||||
|
@ -92,6 +93,8 @@ $(document).ready(function() {
|
||||||
$("#DoveInferno").attr('style', "display: none;");
|
$("#DoveInferno").attr('style', "display: none;");
|
||||||
$("#cla_Grammaticale").attr('style', "display: none;");
|
$("#cla_Grammaticale").attr('style', "display: none;");
|
||||||
$("#cla-Sintattico").attr('style', "display: none;");
|
$("#cla-Sintattico").attr('style', "display: none;");
|
||||||
|
$("#filtri").attr('style', "display: none;");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -106,6 +109,7 @@ $(document).ready(function() {
|
||||||
$("#cla_Grammaticale").attr('style', "display: none;");
|
$("#cla_Grammaticale").attr('style', "display: none;");
|
||||||
$("#DoveInferno").attr('style', "display: block;");
|
$("#DoveInferno").attr('style', "display: block;");
|
||||||
$("#cla-Sintattico").attr('style', "display: none;");
|
$("#cla-Sintattico").attr('style', "display: none;");
|
||||||
|
$("#filtri").attr('style', "display: none;");
|
||||||
|
|
||||||
});
|
});
|
||||||
jQuery(document).delegate('#tab_grammaticale', 'click', function(e) {
|
jQuery(document).delegate('#tab_grammaticale', 'click', function(e) {
|
||||||
|
@ -119,6 +123,7 @@ $(document).ready(function() {
|
||||||
$("#DoveInferno").attr('style', "display: none;");
|
$("#DoveInferno").attr('style', "display: none;");
|
||||||
$("#cla_Grammaticale").attr('style', "display: block;");
|
$("#cla_Grammaticale").attr('style', "display: block;");
|
||||||
$("#cla-Sintattico").attr('style', "display: none;");
|
$("#cla-Sintattico").attr('style', "display: none;");
|
||||||
|
$("#filtri").attr('style', "display: none;");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -133,6 +138,7 @@ $(document).ready(function() {
|
||||||
$("#DoveInferno").attr('style', "display: none;");
|
$("#DoveInferno").attr('style', "display: none;");
|
||||||
$("#cla_Grammaticale").attr('style', "display: none;");
|
$("#cla_Grammaticale").attr('style', "display: none;");
|
||||||
$("#cla-Sintattico").attr('style', "display: block;");
|
$("#cla-Sintattico").attr('style', "display: block;");
|
||||||
|
$("#filtri").attr('style', "display: none;");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -146,7 +152,8 @@ $(document).ready(function() {
|
||||||
$("#cla-TabContent").attr('style', "display: none;");
|
$("#cla-TabContent").attr('style', "display: none;");
|
||||||
$("#DoveInferno").attr('style', "display: none;");
|
$("#DoveInferno").attr('style', "display: none;");
|
||||||
$("#cla_Grammaticale").attr('style', "display: none;");
|
$("#cla_Grammaticale").attr('style', "display: none;");
|
||||||
$("#cla-Sintattico").attr('style', "display: block;");
|
$("#cla-Sintattico").attr('style', "display: none;");
|
||||||
|
$("#filtri").attr('style', "display: block;");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -274,6 +281,109 @@ $(document).ready(function() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jQuery(document).delegate('a.set-filterGram', 'click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var content = jQuery('#filtro'),
|
||||||
|
size = jQuery('#filtri >div').length + 1,
|
||||||
|
element = null,
|
||||||
|
element = content.clone();
|
||||||
|
if (size == 1) {
|
||||||
|
filterconditions = 1;
|
||||||
|
jQuery('#filtri').attr('style', "display:block;")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
filterconditions = filterconditions + 1;
|
||||||
|
|
||||||
|
let filtroId = 'filtro-' + filterconditions;
|
||||||
|
element.attr('id', filtroId);
|
||||||
|
element.find('.delete-written-filter').attr('target', filtroId);
|
||||||
|
element.find('.edit-written-filter').attr('target', filtroId);
|
||||||
|
|
||||||
|
//trasformo il filtro espresso nella clausola in un oggetto JSON
|
||||||
|
|
||||||
|
//var condizioni = $("#filterform").serialize().split('&');
|
||||||
|
//alert (condizioni)
|
||||||
|
|
||||||
|
|
||||||
|
// Creare Condizioni
|
||||||
|
|
||||||
|
var categoriaSelectedValue = $('select.catgram').val(); // categoria grammaticale
|
||||||
|
var lemma_formaValue = $('#lemma_forma').val();
|
||||||
|
var queryText = $('#queryText').val();
|
||||||
|
var opzioni_testoValue = $('#opzioni_testo').val();
|
||||||
|
|
||||||
|
var cla1DiatesiValue = $('input[name=cla1Diatesi]:checked', '#dettaglifiltriVerboVolgare').val(); //$('#cla1Diatesi').val();
|
||||||
|
// alert(cla1DiatesiValue)
|
||||||
|
|
||||||
|
var condizioni = ["lemma_forma="+lemma_formaValue+",query="+queryText+",categoria="+categoriaSelectedValue+",Genere=Femminile"];
|
||||||
|
|
||||||
|
filtro = {}
|
||||||
|
$('.dettaglifiltriVerboVolgare').attr('style', "display:none;")
|
||||||
|
$('.dettaglifiltriSostantivoVolgare').attr('style', "display:none;")
|
||||||
|
$('.savecondition').attr('style', "display:none;")
|
||||||
|
|
||||||
|
for (cond in condizioni) {
|
||||||
|
|
||||||
|
liscond = condizioni[cond].split('=')
|
||||||
|
if (liscond[1].trim() != '' & liscond[1].trim() != liscond[0].trim())
|
||||||
|
filtro[liscond[0]] = liscond[1].replaceAll('%20', ' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//mostro il filtro nella GUI
|
||||||
|
let tuttiFiltri = "";
|
||||||
|
var keys = Object.keys(filtro)//condizioniFiltro)
|
||||||
|
for (key in keys) {
|
||||||
|
var dlclass = $('<dl class="flex mb0 pa0 f6 lh-title mv0" />'),
|
||||||
|
dtclass = $('<dt class="flex mb0 pa0 b mainflabel" />'),
|
||||||
|
ddclass = $('<dd class="flex mb0 pa0 ml0 gray mainfvalue"/>');
|
||||||
|
tuttiFiltri = tuttiFiltri + filtro[[keys[key]]] + ", ";
|
||||||
|
}
|
||||||
|
//element.find('.listacondizioni').append(dlclass);
|
||||||
|
let virgola = tuttiFiltri.lastIndexOf(',');
|
||||||
|
//tuttiFiltri = tuttiFiltri.substring(0, virgola);
|
||||||
|
tuttiFiltri = condizioni;
|
||||||
|
let txtAreaFiltri = '<textarea id = ' + 'textarea-' + filterconditions +
|
||||||
|
' readonly style="resize:none" class="flex mb0 pb0 bg-washed-blue bn" rows="3" cols="60" name="usrtxt" wrap="hard">' +
|
||||||
|
tuttiFiltri + "</textarea>"
|
||||||
|
ddclass.append(txtAreaFiltri);
|
||||||
|
dlclass.append(dtclass);
|
||||||
|
dlclass.append(ddclass);
|
||||||
|
element.find('.listacondizioni').append(dlclass);
|
||||||
|
element.attr('style', 'display.block');
|
||||||
|
element.appendTo('#filtri');
|
||||||
|
|
||||||
|
if (size > 1) {
|
||||||
|
element.find('.andorconditions').attr('style', 'display.block');
|
||||||
|
}
|
||||||
|
|
||||||
|
//$('a.remove-filter').trigger('click');
|
||||||
|
var targetDiv = jQuery(this).attr('targetfilter');
|
||||||
|
|
||||||
|
rmel = jQuery('#' + targetDiv)
|
||||||
|
rmeldetail = jQuery('#' + 'dettaglio_' + targetDiv)
|
||||||
|
jQuery(rmel).remove();
|
||||||
|
jQuery(rmeldetail).remove();
|
||||||
|
clausolaVisibile = false;
|
||||||
|
|
||||||
|
//aggiungo il filtro a quelli esistenti nel json
|
||||||
|
|
||||||
|
filtro['tipoClausola'] = tipoClausola
|
||||||
|
var clausolaquery = $("#searchValue").val()
|
||||||
|
filtro['query'] = clausolaquery.trim();
|
||||||
|
|
||||||
|
// eventualmente le 2 seguenti non funzionano Nicola
|
||||||
|
// checkedField = $('#lemma_forma').val();
|
||||||
|
// filtro['lemma_forma'] = checkedField
|
||||||
|
|
||||||
|
condizioniFiltro['filtro-' + filterconditions] = filtro
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
// Da Luca
|
// Da Luca
|
||||||
var iconReset = '<div class="text-right text-primary radioReset"><ion-icon name="refresh-circle"></ion-icon></div>';
|
var iconReset = '<div class="text-right text-primary radioReset"><ion-icon name="refresh-circle"></ion-icon></div>';
|
||||||
|
|
||||||
|
|
|
@ -3,252 +3,196 @@
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
const cantobadgeclass='badge badge-outline-info badge-pill'
|
const cantobadgeclass = 'badge badge-outline-info badge-pill'
|
||||||
|
|
||||||
const sparqlGenerator = sparqljs.Generator;
|
const sparqlGenerator = sparqljs.Generator;
|
||||||
const myEngine = new Comunica.QueryEngine();
|
const myEngine = new Comunica.QueryEngine();
|
||||||
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
|
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
|
||||||
//const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/hdntest/query";
|
|
||||||
var primaCanticaLoaded = false;
|
|
||||||
var secondaCanticaLoaded = false;
|
|
||||||
var terzaCanticaLoaded = false;
|
|
||||||
var listaVersi = new Set()
|
|
||||||
const ddmenus={"Inferno":"#dmc1",
|
|
||||||
"Purgatorio": "#dmc2",
|
|
||||||
"Paradiso": "#dmc3"}
|
|
||||||
|
|
||||||
var currentMinimap=''
|
var listaVersi = new Set()
|
||||||
|
const ddmenus = {
|
||||||
|
"Inferno": "#dmc1",
|
||||||
|
"Purgatorio": "#dmc2",
|
||||||
|
"Paradiso": "#dmc3"
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentMinimap = ''
|
||||||
|
var listarisultati = [];
|
||||||
|
|
||||||
|
|
||||||
|
hideMinimap();
|
||||||
|
showCantica('Inferno')
|
||||||
|
|
||||||
|
$('#cantica2').css({ 'opacity': 0.40 });
|
||||||
|
$('#cantica3').css({ 'opacity': 0.40 });
|
||||||
|
$("#CantiInferno").attr('style', 'display:block')
|
||||||
|
$("#InfernoCanto_1").attr('style', 'display:block')
|
||||||
|
|
||||||
|
showCantica('Purgatorio')
|
||||||
|
showCantica('Paradiso')
|
||||||
|
|
||||||
|
|
||||||
//caricamento prima cantica
|
//caricamento prima cantica
|
||||||
$('#cantica1').on('click', function() {
|
$('#cantica1').on('click', function() {
|
||||||
hideMinimap();
|
|
||||||
activateMenuItem('#cantica1')
|
|
||||||
if (!(primaCanticaLoaded)) {
|
|
||||||
|
|
||||||
//jsonQuery = versiCantica("Inferno");
|
|
||||||
//execQuery = new sparqlGenerator().stringify(jsonQuery);
|
|
||||||
//executeQueryVersi(execQuery);
|
|
||||||
showCantica('Inferno')
|
|
||||||
primaCanticaLoaded = true;
|
|
||||||
$(".labelCantica").attr('style', "display: block;");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//$("#InfernoCanto_1").attr('style', 'display:block')
|
|
||||||
$("#CantiInferno").attr('style', 'display:block')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#CantiInferno").attr('style', 'display:block')
|
||||||
|
$('#cantica1').css({ 'opacity': 1 });
|
||||||
|
$('#cantica2').css({ 'opacity': 0.40 });
|
||||||
|
$('#cantica3').css({ 'opacity': 0.40 });
|
||||||
});
|
});
|
||||||
|
|
||||||
//caricamento seconda cantica
|
//caricamento seconda cantica
|
||||||
$('#cantica2').on('click', function() {
|
$('#cantica2').on('click', function() {
|
||||||
hideMinimap();
|
//hideMinimap();
|
||||||
activateMenuItem('#cantica2')
|
$("#CantiPurgatorio").attr('style', 'display:block')
|
||||||
if (!(secondaCanticaLoaded)) {
|
$('#cantica1').css({ 'opacity': 0.40 });
|
||||||
|
$('#cantica2').css({ 'opacity': 1 });
|
||||||
//jsonQuery = versiCantica("Purgatorio");
|
$('#cantica3').css({ 'opacity': 0.40 });
|
||||||
//execQuery = new sparqlGenerator().stringify(jsonQuery);
|
|
||||||
//executeQueryVersi(execQuery);
|
|
||||||
showCantica('Purgatorio')
|
|
||||||
secondaCanticaLoaded = true;
|
|
||||||
$(".labelCantica").attr('style', "display: block;");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//$("#PurgatorioCanto_1").attr('style', 'display:block')
|
|
||||||
$("#CantiPurgatorio").attr('style', 'display:block')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//caricamento terza cantica
|
//caricamento terza cantica
|
||||||
$('#cantica3').on('click', function() {
|
$('#cantica3').on('click', function() {
|
||||||
hideMinimap();
|
//hideMinimap();
|
||||||
activateMenuItem('#cantica3')
|
$("#CantiParadiso").attr('style', 'display:block')
|
||||||
if (!(terzaCanticaLoaded)) {
|
$('#cantica1').css({ 'opacity': 0.40 });
|
||||||
showCantica('Paradiso')
|
$('#cantica2').css({ 'opacity': 0.40 });
|
||||||
terzaCanticaLoaded = true;
|
$('#cantica3').css({ 'opacity': 1 });
|
||||||
$(".labelCantica").attr('style', "display: block;");
|
});
|
||||||
|
var mmih = 0
|
||||||
|
var mmiw = 0
|
||||||
|
var minimapScrolling = false;
|
||||||
|
var displayId = 'displaycanto'
|
||||||
|
var minimapTopPos;
|
||||||
|
|
||||||
|
$("#" + displayId).scroll(function() {
|
||||||
|
if (minimapScrolling) {
|
||||||
|
minimapScrolling = false
|
||||||
|
console.log('no scroll')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//$("#ParadisoCanto_1").attr('style', 'display:block')
|
console.log('yes scrolling')
|
||||||
$("#CantiParadiso").attr('style', 'display:block')
|
console.log("viewer top pos before: " + $('#minimapviewer').offset().top)
|
||||||
|
trackScrollCanto()
|
||||||
|
console.log("viewer top pos after: " + $('#minimapviewer').offset().top)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
var mmih=0
|
|
||||||
var mmiw=0
|
|
||||||
var minimapScrolling=false;
|
|
||||||
var displayId='displaycanto'
|
|
||||||
var minimapTopPos;
|
|
||||||
$( "#"+displayId).scroll(function() {
|
|
||||||
if (minimapScrolling){
|
|
||||||
minimapScrolling=false
|
|
||||||
console.log ('no scroll')
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
console.log ('yes scrolling')
|
|
||||||
console.log("viewer top pos before: "+$('#minimapviewer').offset().top)
|
|
||||||
trackScrollCanto()
|
|
||||||
console.log("viewer top pos after: "+$('#minimapviewer').offset().top)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
jQuery(document).delegate('.navig-canto', 'click', function(e) {
|
jQuery(document).delegate('.navig-canto', 'click', function(e) {
|
||||||
$('.canto').each(function() {
|
$('.canto').each(function() {
|
||||||
$(this).attr("style", 'display:none');
|
$(this).attr("style", 'display:none');
|
||||||
});
|
});
|
||||||
|
// Crea id per la div che contiene il canto
|
||||||
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block')
|
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block')
|
||||||
|
manageMiniMap(this);
|
||||||
mmiw=$("#"+displayId).innerWidth();
|
|
||||||
mmih=$("#"+displayId).innerHeight();
|
|
||||||
|
|
||||||
showMinimap($(this).attr('name').replace(" ", "_"))
|
|
||||||
|
|
||||||
currentMinimap=$(this).attr('name').replace(" ", "_");
|
|
||||||
//mmviewer diventa draggable
|
|
||||||
minimapTopPos=$('#minimapviewer').offset().top
|
|
||||||
console.log("top viewer init "+minimapTopPos)
|
|
||||||
|
|
||||||
$('#minimapviewer').draggable({
|
|
||||||
axis: "y",
|
|
||||||
containment : $('#displayminimap'),
|
|
||||||
scroll : false,
|
|
||||||
stop: function( event, ui ) {minimapScrolling=true;},
|
|
||||||
stop: function( event, ui ) {minimapScrolling=false;},
|
|
||||||
drag: function( event, ui ) {
|
|
||||||
|
|
||||||
minimapScrolling=true;
|
|
||||||
trackScrollViewer(ui.offset.top-minimapTopPos);
|
|
||||||
//trackScrollViewer(ui.offset.top);
|
|
||||||
console.log(ui);
|
|
||||||
//document.getElementById(displayId).style.transform=`translateY(${viewer.scrollTop * realScale}px)`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//$('#minimapviewer').on('drag', trackScrollViewer)
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function manageMiniMap(divElem) {
|
||||||
|
mmiw = $("#" + displayId).innerWidth();
|
||||||
|
mmih = $("#" + displayId).innerHeight();
|
||||||
|
|
||||||
|
showMinimap($(divElem).attr('name').replace(" ", "_"))
|
||||||
|
currentMinimap = $(divElem).attr('name').replace(" ", "_");
|
||||||
|
|
||||||
|
//mmviewer diventa draggable
|
||||||
|
minimapTopPos = $('#minimapviewer').offset().top
|
||||||
|
console.log("top viewer init " + minimapTopPos)
|
||||||
|
|
||||||
|
$('#minimapviewer').draggable({
|
||||||
|
axis: "y",
|
||||||
|
containment: $('#displayminimap'),
|
||||||
|
scroll: false,
|
||||||
|
stop: function(event, ui) { minimapScrolling = true; },
|
||||||
|
stop: function(event, ui) { minimapScrolling = false; },
|
||||||
|
drag: function(event, ui) {
|
||||||
|
|
||||||
|
minimapScrolling = true;
|
||||||
|
trackScrollViewer(ui.offset.top - minimapTopPos);
|
||||||
|
console.log(ui);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//Query
|
//Query
|
||||||
|
|
||||||
|
|
||||||
//$('#searchcomm').on('click', function() {
|
jQuery(document).delegate('#searchcomm', 'click', function(e) {
|
||||||
jQuery(document).delegate('#searchcomm', 'click', function(e) {
|
cleanSearchResult()
|
||||||
|
esprlogica = []
|
||||||
|
|
||||||
cleanSearchResult()
|
esprlogica.push('Clausola1')
|
||||||
esprlogica=[]
|
condizioni = { "EsprLogica": esprlogica }
|
||||||
|
clausola = {}
|
||||||
|
clausola['typeGramm0'] = $('#queryText').val()
|
||||||
|
clausola['queryText'] = ""
|
||||||
|
condizioni['Clausola1'] = clausola
|
||||||
|
jsonQuery = buildSQ(condizioni)
|
||||||
|
myquery = new sparqlGenerator().stringify(jsonQuery)
|
||||||
|
|
||||||
esprlogica.push('Clausola1')
|
executeQuerySearch(myquery)
|
||||||
condizioni={"EsprLogica": esprlogica}
|
});
|
||||||
clausola={}
|
|
||||||
clausola['typeGramm0']=$('#queryText').val()
|
|
||||||
|
|
||||||
|
//Reset
|
||||||
|
|
||||||
|
jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
console.log('clean')
|
||||||
|
cleanSearchResult()
|
||||||
|
esprlogica = []
|
||||||
|
$('#queryText').val("")
|
||||||
|
|
||||||
clausola['queryText']=""
|
});
|
||||||
condizioni['Clausola1']=clausola
|
|
||||||
jsonQuery=buildSQ(condizioni)
|
|
||||||
myquery =new sparqlGenerator().stringify(jsonQuery)
|
|
||||||
|
|
||||||
executeQuerySearch(myquery)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//Reset
|
|
||||||
|
|
||||||
jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
|
||||||
console.log('clean')
|
|
||||||
cleanSearchResult()
|
|
||||||
esprlogica=[]
|
|
||||||
$('#queryText').val("")
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//Utility functions
|
//Utility functions
|
||||||
|
|
||||||
//activate navigation menu items
|
|
||||||
|
|
||||||
function activateMenuItem(menuItem) {
|
|
||||||
//$('.blog-nav-item').each(function() {
|
|
||||||
// $(this).attr("class", $(this).attr("class").replace(' active', ''));
|
|
||||||
//});
|
|
||||||
//$(menuItem).attr("class", $(menuItem).attr("class") + ' active');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function managePunctuation(stringa) {
|
function managePunctuation(stringa) {
|
||||||
var tempstringa=stringa.replaceAll(" ,", ",")
|
var tempstringa = stringa.replaceAll(" ,", ",")
|
||||||
tempstringa=tempstringa.replaceAll(" .", ".")
|
tempstringa = tempstringa.replaceAll(" .", ".")
|
||||||
tempstringa=tempstringa.replaceAll(" :", ":")
|
tempstringa = tempstringa.replaceAll(" :", ":")
|
||||||
tempstringa=tempstringa.replaceAll(" !", "!")
|
tempstringa = tempstringa.replaceAll(" !", "!")
|
||||||
tempstringa=tempstringa.replaceAll(" ?", "?")
|
tempstringa = tempstringa.replaceAll(" ?", "?")
|
||||||
tempstringa=tempstringa.replaceAll(" ;", ";")
|
tempstringa = tempstringa.replaceAll(" ;", ";")
|
||||||
tempstringa=tempstringa.replaceAll("%20", " ")
|
tempstringa = tempstringa.replaceAll("%20", " ")
|
||||||
return tempstringa
|
return tempstringa
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanSearchResult(){
|
function cleanSearchResult() {
|
||||||
|
|
||||||
for (verso of listarisultati){
|
for (verso of listarisultati) {
|
||||||
idverso='#'+verso
|
idverso = '#' + verso
|
||||||
//console.log(idverso)
|
$(idverso).attr('class', 'f6text-secondary text-nowrap font-weight-lighter')
|
||||||
//$(idverso).attr('class', 'f6 font-weight-lighter')
|
}
|
||||||
$(idverso).attr('class', 'f6text-secondary text-nowrap font-weight-lighter')
|
$(".badge").remove();
|
||||||
}
|
listarisultati = []
|
||||||
$( ".badge" ).remove();
|
if (currentMinimap != '')
|
||||||
listarisultati=[]
|
showMinimap(currentMinimap)
|
||||||
if (currentMinimap!='')
|
|
||||||
showMinimap(currentMinimap)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//minimap management
|
//minimap management
|
||||||
let minimap = document.createElement('div');
|
let minimap = document.createElement('div');
|
||||||
let minimapSize = document.createElement('div');
|
let minimapSize = document.createElement('div');
|
||||||
let viewer = document.createElement('div');
|
let viewer = document.createElement('div');
|
||||||
let minimapContent = document.createElement('iframe');
|
let minimapContent = document.createElement('iframe');
|
||||||
let scale=0.1;
|
let scale = 0.1;
|
||||||
let realScale;
|
let realScale;
|
||||||
let mappedElement=''
|
let mappedElement = '';
|
||||||
|
|
||||||
function showMinimap(element) {
|
function showMinimap(element) {
|
||||||
|
mmplace = document.getElementById('displayminimap')
|
||||||
|
|
||||||
mmplace=document.getElementById('displayminimap')
|
|
||||||
//mmplace=document.getElementById('displaycanto')
|
|
||||||
|
|
||||||
minimap.className = 'minimap__container'
|
minimap.className = 'minimap__container'
|
||||||
minimapSize.className = 'minimap__size'
|
minimapSize.className = 'minimap__size'
|
||||||
viewer.className = 'minimap__viewer'
|
viewer.className = 'minimap__viewer'
|
||||||
viewer.id='minimapviewer'
|
viewer.id = 'minimapviewer'
|
||||||
minimapContent.className = 'minimap__content'
|
minimapContent.className = 'minimap__content'
|
||||||
//class="col-3 px-0"
|
|
||||||
minimap.append(minimapSize, viewer, minimapContent);
|
minimap.append(minimapSize, viewer, minimapContent);
|
||||||
|
|
||||||
//document.body.appendChild(minimap)
|
|
||||||
mmplace.appendChild(minimap)
|
mmplace.appendChild(minimap)
|
||||||
|
|
||||||
|
|
||||||
let html = document.getElementById(element).outerHTML//innerHTML
|
let html = document.getElementById(element).outerHTML//innerHTML
|
||||||
//console.log(html)
|
if (html == null | html == '')
|
||||||
if (html==null | html=='')
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let iFrameDoc = minimapContent.contentWindow.document;
|
let iFrameDoc = minimapContent.contentWindow.document;
|
||||||
|
|
||||||
|
|
||||||
var cssLinkb = document.createElement("link");
|
var cssLinkb = document.createElement("link");
|
||||||
cssLinkb.href = "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css";
|
cssLinkb.href = "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css";
|
||||||
cssLinkb.rel = "stylesheet";
|
cssLinkb.rel = "stylesheet";
|
||||||
|
@ -265,164 +209,135 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
iFrameDoc.head.appendChild(cssLinkb);
|
iFrameDoc.head.appendChild(cssLinkb);
|
||||||
iFrameDoc.head.appendChild(cssLinkscroll);
|
iFrameDoc.head.appendChild(cssLinkscroll);
|
||||||
mappedElement=element
|
mappedElement = element
|
||||||
|
|
||||||
getDimensionsDiv()
|
getDimensionsDiv()
|
||||||
|
|
||||||
window.addEventListener('scroll', trackScroll)
|
window.addEventListener('scroll', trackScroll)
|
||||||
|
|
||||||
|
|
||||||
//document.getElementById(displayId).addEventListener('resize', getDimensionsDiv)
|
|
||||||
|
|
||||||
window.addEventListener('resize', getDimensionsDiv)
|
window.addEventListener('resize', getDimensionsDiv)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
function getDimensions(){
|
function getDimensions() {
|
||||||
cantoplace=document.getElementById(displayId)
|
cantoplace = document.getElementById(displayId)
|
||||||
let bodyWidth= cantoplace.clientWidth;
|
let bodyWidth = cantoplace.clientWidth;
|
||||||
let bodyRatio= bodyWidth/cantoplace.clientHeight
|
let bodyRatio = bodyWidth / cantoplace.clientHeight
|
||||||
//let winRatio=cantoplace.clientWidth / getInnerHeight(cantoplace)
|
//let winRatio=cantoplace.clientWidth / getInnerHeight(cantoplace)
|
||||||
let winRatio= window.innerHeight / window.innerWidth;
|
let winRatio = window.innerHeight / window.innerWidth;
|
||||||
|
|
||||||
|
|
||||||
minimap.style.width='55%';
|
minimap.style.width = '55%';
|
||||||
viewer.style.width='55%'
|
viewer.style.width = '55%'
|
||||||
|
|
||||||
realScale=minimap.clientWidth / bodyWidth;
|
realScale = minimap.clientWidth / bodyWidth;
|
||||||
|
|
||||||
minimapSize.style.paddingTop=`${bodyRatio * 100}%`
|
minimapSize.style.paddingTop = `${bodyRatio * 100}%`
|
||||||
viewer.style.paddingTop=`${winRatio * 100}%`;
|
viewer.style.paddingTop = `${winRatio * 100}%`;
|
||||||
minimapContent.style.transform=`scale(${realScale})`;
|
minimapContent.style.transform = `scale(${realScale})`;
|
||||||
minimapContent.style.width=`${(100/realScale)}%`;
|
minimapContent.style.width = `${(100 / realScale)}%`;
|
||||||
minimapContent.style.height=`${(100 / realScale)}%`;
|
minimapContent.style.height = `${(100 / realScale)}%`;
|
||||||
|
|
||||||
}
|
}*/
|
||||||
function getInnerHeight( elm ){
|
|
||||||
var computed = getComputedStyle(elm),
|
|
||||||
padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
|
|
||||||
|
|
||||||
return elm.clientHeight - padding
|
function getInnerHeight(elm) {
|
||||||
|
var computed = getComputedStyle(elm),
|
||||||
|
padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
|
||||||
|
|
||||||
|
return elm.clientHeight - padding
|
||||||
}
|
}
|
||||||
function getDimensionsDiv(){
|
|
||||||
|
|
||||||
|
function getDimensionsDiv() {
|
||||||
|
cantoplace = document.getElementById(displayId)
|
||||||
|
elementplace = document.getElementById(mappedElement)
|
||||||
|
|
||||||
cantoplace=document.getElementById(displayId)
|
bodyWidth = elementplace.clientWidth;
|
||||||
|
bodyRatio = elementplace.clientHeight / bodyWidth;
|
||||||
elementplace=document.getElementById(mappedElement)
|
|
||||||
|
|
||||||
bodyWidth= elementplace.clientWidth;
|
|
||||||
bodyRatio= elementplace.clientHeight / bodyWidth;
|
|
||||||
//let bodyWidth= cantoplace.clientWidth;
|
|
||||||
//let bodyRatio= cantoplace.clientHeight / bodyWidth;
|
|
||||||
//let winRatio= window.innerHeight / (window.innerWidth);
|
|
||||||
let winRatio= getInnerHeight(cantoplace) / (cantoplace.clientWidth);
|
|
||||||
|
|
||||||
|
let winRatio = getInnerHeight(cantoplace) / (cantoplace.clientWidth);
|
||||||
|
|
||||||
//minimap.style.width='15%';
|
//minimap.style.width='15%';
|
||||||
minimap.style.width='100%';
|
minimap.style.width = '100%';
|
||||||
|
|
||||||
|
realScale = minimap.clientWidth / bodyWidth;
|
||||||
|
|
||||||
realScale=minimap.clientWidth / bodyWidth;
|
minimapSize.style.paddingTop = `${bodyRatio * 100}%`
|
||||||
|
viewer.style.paddingTop = `${winRatio * 100}%`;
|
||||||
minimapSize.style.paddingTop=`${bodyRatio * 100}%`
|
minimapContent.style.transform = `scale(${realScale})`;
|
||||||
viewer.style.paddingTop=`${winRatio * 100}%`;
|
minimapContent.style.width = `${(100 / realScale)}%`;
|
||||||
minimapContent.style.transform=`scale(${realScale})`;
|
minimapContent.style.height = `${(100 / realScale)}%`;
|
||||||
minimapContent.style.width=`${(100/realScale)}%`;
|
|
||||||
minimapContent.style.height=`${(100 / realScale)}%`;
|
|
||||||
//minimapContent.style.height=`100%`;
|
//minimapContent.style.height=`100%`;
|
||||||
minimapContent.style.float='right';
|
minimapContent.style.float = 'right';
|
||||||
|
}
|
||||||
|
|
||||||
|
function trackScroll() {
|
||||||
}
|
|
||||||
|
|
||||||
function trackScroll(){
|
|
||||||
//console.log(window.scrollY)
|
//console.log(window.scrollY)
|
||||||
viewer.style.transform=`translateY(${window.scrollY * realScale}px)`
|
viewer.style.transform = `translateY(${window.scrollY * realScale}px)`
|
||||||
}
|
}
|
||||||
function trackScrollCanto(){
|
function trackScrollCanto() {
|
||||||
console.log('cantoscrollT*realscale '+document.getElementById(displayId).scrollTop * realScale+' top: ' +document.getElementById(displayId).scrollTop )
|
console.log('cantoscrollT*realscale ' + document.getElementById(displayId).scrollTop * realScale + ' top: ' + document.getElementById(displayId).scrollTop)
|
||||||
viewer.style.transform=`translateY(${document.getElementById(displayId).scrollTop * realScale}px)`
|
viewer.style.transform = `translateY(${document.getElementById(displayId).scrollTop * realScale}px)`
|
||||||
|
|
||||||
}
|
}
|
||||||
function trackScrollViewer(toppos){
|
function trackScrollViewer(toppos) {
|
||||||
console.log('scrollMMView top*1/realScale: '+toppos*(1/realScale)+' top pos: '+toppos)
|
console.log('scrollMMView top*1/realScale: ' + toppos * (1 / realScale) + ' top pos: ' + toppos)
|
||||||
did=document.getElementById(displayId)
|
did = document.getElementById(displayId)
|
||||||
|
|
||||||
did.scrollTop=(toppos*(1/realScale))
|
|
||||||
|
|
||||||
|
|
||||||
|
did.scrollTop = (toppos * (1 / realScale))
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideMinimap(){
|
function hideMinimap() {
|
||||||
$('.canto').each(function() {
|
$('.canto').each(function() {
|
||||||
$(this).attr("style", 'display:none');
|
$(this).attr("style", 'display:none');
|
||||||
});
|
});
|
||||||
$( ".minimap__container" ).remove();
|
$(".minimap__container").remove();
|
||||||
currentMinimap=''
|
currentMinimap = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// fa diventare draggable il minimapviewer
|
|
||||||
|
|
||||||
|
|
||||||
//end minimap management
|
|
||||||
//Cantica management functions
|
//Cantica management functions
|
||||||
|
|
||||||
function showCantica(cantica){
|
function showCantica(cantica) {
|
||||||
var listaCanti = new Set()
|
var listaCanti = new Set()
|
||||||
var setVersi = new Set()
|
var setVersi = new Set()
|
||||||
var listaVersi = []
|
|
||||||
var listaForme =[]
|
|
||||||
containerForme=formeterza
|
|
||||||
if(cantica=='Inferno')
|
|
||||||
containerForme=formeprima
|
|
||||||
if(cantica=='Purgatorio')
|
|
||||||
containerForme=formeseconda
|
|
||||||
for (cmpItem of containerForme){
|
|
||||||
formaItem=cmpItem[0].split("_")
|
|
||||||
listaCanti=createDivCanti(listaCanti, cantica, 'Canto '+formaItem[1])
|
|
||||||
|
|
||||||
var obj = new Object();
|
containerForme = formeterza
|
||||||
var forma=new Object()
|
if (cantica == 'Inferno')
|
||||||
setVersi=createDivVersi(setVersi, cantica, formaItem[3], 'Canto '+formaItem[1])
|
containerForme = formeprima
|
||||||
/*
|
if (cantica == 'Purgatorio')
|
||||||
obj.numverso = formaItem[3];
|
containerForme = formeseconda
|
||||||
|
for (cmpItem of containerForme) {
|
||||||
obj.canto = 'Canto '+formaItem[1];
|
formaItem = cmpItem[0].split("_")
|
||||||
obj.cantica = cantica;
|
listaCanti = createDivCanti(listaCanti, cantica, 'Canto ' + formaItem[1])
|
||||||
listaVersi.push(obj)
|
var forma = new Object()
|
||||||
*/
|
setVersi = createDivVersi(setVersi, cantica, formaItem[3], 'Canto ' + formaItem[1])
|
||||||
|
|
||||||
forma.numverso = formaItem[3];
|
forma.numverso = formaItem[3];
|
||||||
forma.canto = 'Canto '+formaItem[1];
|
forma.canto = 'Canto ' + formaItem[1];
|
||||||
forma.pos = formaItem[2];
|
forma.pos = formaItem[2];
|
||||||
forma.form = formaItem[0];
|
forma.form = formaItem[0];
|
||||||
forma.cantica = cantica;
|
forma.cantica = cantica;
|
||||||
createSpanForme(forma)
|
createSpanForme(forma)
|
||||||
//listaForme.push(forma)
|
|
||||||
}
|
}
|
||||||
//renderData(cantica, listaCanti, listaVersi, listaForme);
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSpanForme(element){
|
function createSpanForme(element) {
|
||||||
var spanoccorrenza=$('<span />')
|
var spanoccorrenza = $('<span />')
|
||||||
var pos=parseInt(element.pos)
|
var pos = parseInt(element.pos)
|
||||||
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
spanoccorrenza.attr('id', element.cantica + "_" + element.canto.replace(" ", "_") + "_" + element.numverso + "_" + pos)
|
||||||
if (listarisultati.length>0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
if (listarisultati.length > 0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
||||||
spanoccorrenza.attr('class', "f6 mark ")
|
spanoccorrenza.attr('class', "f6 mark ")
|
||||||
spanoccorrenza.append(element.form.replaceAll("%20", " "))
|
spanoccorrenza.append(element.form.replaceAll("%20", " "))
|
||||||
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
elementoverso = $('#' + element.cantica + "_" + element.canto.replace(" ", "_") + "_" + element.numverso)
|
||||||
spanoccorrenza.appendTo(elementoverso)
|
spanoccorrenza.appendTo(elementoverso)
|
||||||
elementoverso.append(' ')
|
elementoverso.append(' ')
|
||||||
|
|
||||||
}
|
}
|
||||||
function createDivVersi(setVersi, cantica, num, canto){
|
|
||||||
if(setVersi.has(cantica+"_"+num+"_"+canto))
|
function createDivVersi(setVersi, cantica, num, canto) {
|
||||||
|
if (setVersi.has(cantica + "_" + num + "_" + canto))
|
||||||
return setVersi
|
return setVersi
|
||||||
else{
|
else {
|
||||||
var elementoverso = $('<p />')
|
var elementoverso = $('<p />')
|
||||||
|
|
||||||
elementoverso.append(num + ". ")
|
elementoverso.append(num + ". ")
|
||||||
|
@ -430,21 +345,21 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
elementoverso.attr('class', 'f6 text-secondary text-nowrap font-weight-lighter')
|
elementoverso.attr('class', 'f6 text-secondary text-nowrap font-weight-lighter')
|
||||||
|
|
||||||
elementoverso.attr('id', cantica+"_"+ canto.replace(" ", "_")+"_"+num)
|
elementoverso.attr('id', cantica + "_" + canto.replace(" ", "_") + "_" + num)
|
||||||
elementoverso.appendTo('#' + cantica +canto.replace(" ", "_"))
|
elementoverso.appendTo('#' + cantica + canto.replace(" ", "_"))
|
||||||
setVersi.add(cantica+"_"+num+"_"+canto)
|
setVersi.add(cantica + "_" + num + "_" + canto)
|
||||||
return setVersi
|
return setVersi
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDivCanti(orderedListaCanti, cantica, canto){
|
function createDivCanti(orderedListaCanti, cantica, canto) {
|
||||||
if (orderedListaCanti.has(canto)){
|
if (orderedListaCanti.has(canto)) {
|
||||||
return orderedListaCanti
|
return orderedListaCanti
|
||||||
}
|
}
|
||||||
var divcanto = $('<div />')
|
var divcanto = $('<div />')
|
||||||
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
|
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
|
||||||
titolocanto.append(cantica+", "+canto)
|
titolocanto.append(cantica + ", " + canto)
|
||||||
divcanto.attr('class', 'canto')
|
divcanto.attr('class', 'canto')
|
||||||
divcanto.attr('style', 'display:none')
|
divcanto.attr('style', 'display:none')
|
||||||
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
||||||
|
@ -454,79 +369,8 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
return orderedListaCanti
|
return orderedListaCanti
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderData(cantica, listaCanti, listaVersi, listaForme){
|
|
||||||
//var orderedListaCanti = Array.from(listaCanti)
|
|
||||||
//orderedListaCanti = orderedListaCanti.sort((a, b) => {
|
|
||||||
// return parseInt(a.split(" ")[1], 10)-parseInt(b.split(" ")[1], 10)
|
|
||||||
//});
|
|
||||||
//var orderedListaVersi = Array.from(listaVersi)
|
|
||||||
//orderedListaVersi = orderedListaVersi.sort((a, b) => {
|
|
||||||
// return parseInt(a.numverso, 10)-parseInt(b.numverso, 10)
|
|
||||||
|
|
||||||
//});
|
|
||||||
|
|
||||||
/*
|
|
||||||
listaVersi = listaVersi.filter((value, index, self) =>
|
|
||||||
index === self.findIndex((t) => (
|
|
||||||
t.numverso === value.numverso && t.canto === value.canto && t.cantica===value.cantica
|
|
||||||
))
|
|
||||||
)*/
|
|
||||||
|
|
||||||
//var orderedListaForme = Array.from(listaForme)
|
|
||||||
//orderedListaForme = orderedListaForme.sort((a, b) => {
|
|
||||||
// return parseInt(a.pos, 10)-parseInt(b.pos, 10)
|
|
||||||
|
|
||||||
//});
|
|
||||||
|
|
||||||
//var divListaCanti = $('<DIV id="Canti' + cantica + '" />')
|
|
||||||
/*
|
|
||||||
for (canto of orderedListaCanti) {
|
|
||||||
|
|
||||||
|
|
||||||
var divcanto = $('<div />')
|
|
||||||
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
|
|
||||||
titolocanto.append(cantica+", "+canto)
|
|
||||||
divcanto.attr('class', 'canto')
|
|
||||||
divcanto.attr('style', 'display:none')
|
|
||||||
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
|
||||||
titolocanto.appendTo(divcanto)
|
|
||||||
divcanto.appendTo(' .blog-main')
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//divListaCanti.appendTo('#listacanti')
|
|
||||||
//divListaCanti.appendTo(ddmenus[cantica])
|
|
||||||
/*
|
|
||||||
for (verso of listaVersi) {
|
|
||||||
|
|
||||||
|
|
||||||
var elementoverso = $('<p />')
|
|
||||||
//vartestoverso=verso.numverso;
|
|
||||||
elementoverso.append(verso.numverso + ". ")
|
|
||||||
elementoverso.attr("style", "line-height: 0.5em")
|
|
||||||
|
|
||||||
elementoverso.attr('class', 'f6 text-secondary text-nowrap font-weight-lighter')
|
|
||||||
//elementoverso.attr('class', 'f6 font-weight-lighter nowrap')
|
|
||||||
elementoverso.attr('id', verso.cantica+"_"+ verso.canto.replace(" ", "_")+"_"+verso.numverso)
|
|
||||||
elementoverso.appendTo('#' + cantica + verso.canto.replace(" ", "_"))
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
listaForme.forEach((element) => {
|
|
||||||
var spanoccorrenza=$('<span />')
|
|
||||||
var pos=parseInt(element.pos)
|
|
||||||
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
|
||||||
if (listarisultati.length>0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
|
||||||
spanoccorrenza.attr('class', "f6 mark ")
|
|
||||||
spanoccorrenza.append(element.form)
|
|
||||||
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
|
||||||
spanoccorrenza.appendTo(elementoverso)
|
|
||||||
elementoverso.append(' ')
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
// Search functions
|
// Search functions
|
||||||
|
/* async function executeQueryVersi(query) {
|
||||||
async function executeQueryVersi(query) {
|
|
||||||
bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||||
alert(query)
|
alert(query)
|
||||||
try {
|
try {
|
||||||
|
@ -537,27 +381,25 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
listaForme = new Set()
|
listaForme = new Set()
|
||||||
let cantica = 0;
|
let cantica = 0;
|
||||||
bindingsStream.on('data', (binding) => {
|
bindingsStream.on('data', (binding) => {
|
||||||
//cantica
|
//cantica
|
||||||
cantica = binding.get('Cantica').value;
|
cantica = binding.get('Cantica').value;
|
||||||
//la lista dei canti
|
//la lista dei canti
|
||||||
listaCanti.add(binding.get('Canto').value)
|
listaCanti.add(binding.get('Canto').value)
|
||||||
//la lista dei versi
|
//la lista dei versi
|
||||||
var obj = new Object();
|
var obj = new Object();
|
||||||
var forma=new Object()
|
var forma = new Object()
|
||||||
obj.numverso = binding.get('NumeroVerso').value;
|
obj.numverso = binding.get('NumeroVerso').value;
|
||||||
obj.verso = binding.get('Verso').value;
|
obj.verso = binding.get('Verso').value;
|
||||||
obj.canto = binding.get('Canto').value;
|
obj.canto = binding.get('Canto').value;
|
||||||
//obj.pos = binding.get('pos').value;
|
obj.cantica = cantica;
|
||||||
//obj.form = binding.get('textform').value;
|
listaVersi.add(obj)
|
||||||
obj.cantica = cantica;
|
forma.numverso = binding.get('NumeroVerso').value;
|
||||||
listaVersi.add(obj)
|
forma.canto = binding.get('Canto').value;
|
||||||
forma.numverso = binding.get('NumeroVerso').value;
|
forma.pos = binding.get('pos').value;
|
||||||
forma.canto = binding.get('Canto').value;
|
forma.form = binding.get('textform').value;
|
||||||
forma.pos = binding.get('pos').value;
|
forma.cantica = cantica;
|
||||||
forma.form = binding.get('textform').value;
|
|
||||||
forma.cantica = cantica;
|
|
||||||
|
|
||||||
listaForme.add(forma)
|
listaForme.add(forma)
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -565,82 +407,66 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var orderedListaCanti = Array.from(listaCanti)
|
var orderedListaCanti = Array.from(listaCanti)
|
||||||
orderedListaCanti = orderedListaCanti.sort((a, b) => {
|
orderedListaCanti = orderedListaCanti.sort((a, b) => {
|
||||||
return parseInt(a.split(" ")[1], 10)-parseInt(b.split(" ")[1], 10)
|
return parseInt(a.split(" ")[1], 10) - parseInt(b.split(" ")[1], 10)
|
||||||
//if (parseInt(a.split(" ")[1], 10) < parseInt(b.split(" ")[1]), 10) {
|
});
|
||||||
// return -1;
|
|
||||||
//}
|
|
||||||
});
|
|
||||||
|
|
||||||
var orderedListaVersi = Array.from(listaVersi)
|
var orderedListaVersi = Array.from(listaVersi)
|
||||||
|
|
||||||
orderedListaVersi = orderedListaVersi.sort((a, b) => {
|
orderedListaVersi = orderedListaVersi.sort((a, b) => {
|
||||||
return parseInt(a.numverso, 10)-parseInt(b.numverso, 10)
|
return parseInt(a.numverso, 10) - parseInt(b.numverso, 10)
|
||||||
//if (parseInt(a.numverso, 10) < parseInt(b.numverso, 10)) {
|
});
|
||||||
// console.log(parseInt(a.numverso, 10)+' '+parseInt(b.numverso, 10))
|
|
||||||
// return -1;
|
|
||||||
//}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
orderedListaVersi = orderedListaVersi.filter((value, index, self) =>
|
orderedListaVersi = orderedListaVersi.filter((value, index, self) =>
|
||||||
index === self.findIndex((t) => (
|
index === self.findIndex((t) => (
|
||||||
t.numverso === value.numverso && t.canto === value.canto && t.cantica===value.cantica
|
t.numverso === value.numverso && t.canto === value.canto && t.cantica === value.cantica
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
var orderedListaForme = Array.from(listaForme)
|
||||||
|
orderedListaForme = orderedListaForme.sort((a, b) => {
|
||||||
|
return parseInt(a.pos, 10) - parseInt(b.pos, 10)
|
||||||
|
});
|
||||||
|
|
||||||
|
var divListaCanti = $('<DIV id="Canti' + cantica + '" />')
|
||||||
|
for (canto of orderedListaCanti) {
|
||||||
|
var licanto = $('<li class="navig-canto"/>')
|
||||||
|
licanto.attr('name', cantica + canto)
|
||||||
|
licanto.attr('href', "#")
|
||||||
|
licanto.attr("style", "line-height: 1.2em")
|
||||||
|
numcanto = canto.split(" ")[1]
|
||||||
|
licanto.append(numcanto)
|
||||||
|
|
||||||
|
//licanto.appendTo('#listacanti')
|
||||||
|
licanto.appendTo(divListaCanti)
|
||||||
|
var divcanto = $('<div />')
|
||||||
|
var titolocanto = $('<h1 class="f3 titolo-canto" />')
|
||||||
|
titolocanto.append(cantica + ", " + canto)
|
||||||
|
divcanto.attr('class', 'canto')
|
||||||
|
divcanto.attr('style', 'display:none')
|
||||||
|
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
||||||
|
titolocanto.appendTo(divcanto)
|
||||||
|
divcanto.appendTo(' .blog-main')
|
||||||
|
}
|
||||||
|
divListaCanti.appendTo(ddmenus[cantica])
|
||||||
|
for (verso of orderedListaVersi) {
|
||||||
|
|
||||||
|
|
||||||
var orderedListaForme = Array.from(listaForme)
|
var elementoverso = $('<p />')
|
||||||
orderedListaForme = orderedListaForme.sort((a, b) => {
|
vartestoverso = verso.numverso;
|
||||||
return parseInt(a.pos, 10)-parseInt(b.pos, 10)
|
elementoverso.append(verso.numverso + ". ")
|
||||||
//if (parseInt(a.pos) < parseInt(b.pos)) {
|
elementoverso.attr("style", "line-height: 0.5em")
|
||||||
// return -1;
|
elementoverso.attr('class', 'f6 font-weight-lighter nowrap')
|
||||||
//}
|
elementoverso.attr('id', verso.cantica + "_" + verso.canto.replace(" ", "_") + "_" + verso.numverso)
|
||||||
|
elementoverso.appendTo('#' + cantica + verso.canto.replace(" ", "_"))
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
var divListaCanti = $('<DIV id="Canti' + cantica + '" />')
|
orderedListaForme.forEach((element) => {
|
||||||
for (canto of orderedListaCanti) {
|
var spanoccorrenza=$('<span />')
|
||||||
var licanto = $('<li class="navig-canto"/>')
|
|
||||||
licanto.attr('name', cantica + canto)
|
|
||||||
licanto.attr('href', "#")
|
|
||||||
licanto.attr("style", "line-height: 1.2em")
|
|
||||||
numcanto=canto.split(" ")[1]
|
|
||||||
licanto.append(numcanto)
|
|
||||||
|
|
||||||
//licanto.appendTo('#listacanti')
|
|
||||||
licanto.appendTo(divListaCanti)
|
|
||||||
var divcanto = $('<div />')
|
|
||||||
var titolocanto = $('<h1 class="f3 titolo-canto" />')
|
|
||||||
titolocanto.append(cantica+", "+canto)
|
|
||||||
divcanto.attr('class', 'canto')
|
|
||||||
divcanto.attr('style', 'display:none')
|
|
||||||
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
|
||||||
titolocanto.appendTo(divcanto)
|
|
||||||
divcanto.appendTo(' .blog-main')
|
|
||||||
}
|
|
||||||
//divListaCanti.appendTo('#listacanti')
|
|
||||||
divListaCanti.appendTo(ddmenus[cantica])
|
|
||||||
for (verso of orderedListaVersi) {
|
|
||||||
|
|
||||||
|
|
||||||
var elementoverso = $('<p />')
|
|
||||||
vartestoverso=verso.numverso;
|
|
||||||
elementoverso.append(verso.numverso + ". ")
|
|
||||||
//elementoverso.append(verso.numverso + ". " + managePunctuation(verso.verso))
|
|
||||||
elementoverso.attr("style", "line-height: 0.5em")
|
|
||||||
elementoverso.attr('class', 'f6 font-weight-lighter nowrap')
|
|
||||||
elementoverso.attr('id', verso.cantica+"_"+ verso.canto.replace(" ", "_")+"_"+verso.numverso)
|
|
||||||
elementoverso.appendTo('#' + cantica + verso.canto.replace(" ", "_"))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
orderedListaForme.forEach((element) => {
|
|
||||||
var spanoccorrenza=$('<span />')
|
|
||||||
var pos=parseInt(element.pos)
|
var pos=parseInt(element.pos)
|
||||||
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
||||||
if (listarisultati.length>0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
if (listarisultati.length>0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
||||||
|
@ -649,7 +475,7 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
||||||
spanoccorrenza.appendTo(elementoverso)
|
spanoccorrenza.appendTo(elementoverso)
|
||||||
elementoverso.append(' ')
|
elementoverso.append(' ')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -659,72 +485,72 @@ jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
$("#loader").hide();
|
$("#loader").hide();
|
||||||
};
|
};
|
||||||
};
|
};*/
|
||||||
|
|
||||||
//execute query
|
//execute query
|
||||||
var listarisultati=[];
|
|
||||||
async function executeQuerySearch(query) {
|
async function executeQuerySearch(query) {
|
||||||
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
||||||
console.log(query)
|
//console.log(query)
|
||||||
alert(query)
|
alert(query)
|
||||||
try {
|
try {
|
||||||
var result = new Set()
|
var result = new Set()
|
||||||
var resultsInCantica=[]
|
var resultsInCantica = []
|
||||||
var resultsInCanto=[]
|
var resultsInCanto = []
|
||||||
seachbBindingsStream.on('data', (binding) => {
|
seachbBindingsStream.on('data', (binding) => {
|
||||||
//cantica
|
//cantica
|
||||||
cantica = binding.get('Cantica').value;
|
cantica = binding.get('Cantica').value;
|
||||||
resultsInCantica.push(cantica);
|
resultsInCantica.push(cantica);
|
||||||
//canto
|
//canto
|
||||||
canto=binding.get('Canto').value;
|
canto = binding.get('Canto').value;
|
||||||
resultsInCanto.push(cantica+canto)
|
resultsInCanto.push(cantica + canto)
|
||||||
//numero del verso
|
//numero del verso
|
||||||
numverso=binding.get('NumeroVerso').value;
|
numverso = binding.get('NumeroVerso').value;
|
||||||
//posizione delframmento
|
//posizione delframmento
|
||||||
pos=binding.get('pos').value;
|
pos = binding.get('pos').value;
|
||||||
result.add(cantica+"_"+canto.replace(" ", "_")+"_"+numverso+"_"+pos)
|
result.add(cantica + "_" + canto.replace(" ", "_") + "_" + numverso + "_" + pos)
|
||||||
|
|
||||||
});
|
});
|
||||||
seachbBindingsStream.on('end', () => {
|
seachbBindingsStream.on('end', () => {
|
||||||
listarisultati = Array.from(result)
|
listarisultati = Array.from(result)
|
||||||
cantiche=["Inferno", "Purgatorio", "Paradiso"]
|
cantiche = ["Inferno", "Purgatorio", "Paradiso"]
|
||||||
|
|
||||||
//evidenzia risultati
|
//evidenzia risultati
|
||||||
for (ris of listarisultati){
|
for (ris of listarisultati) {
|
||||||
idris='#'+ris
|
idris = '#' + ris
|
||||||
$(idris).attr('class', "f6 mark ")
|
$(idris).attr('class', "f6 mark ")
|
||||||
|
|
||||||
}
|
}
|
||||||
//aggiunge badge con totale risultati accanto alle cantiche
|
//aggiunge badge con totale risultati accanto alle cantiche
|
||||||
i=0
|
i = 0
|
||||||
for(cantica of cantiche){
|
for (cantica of cantiche) {
|
||||||
i+=1
|
i += 1
|
||||||
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
||||||
var spanbadgecantica=$('<span />');
|
var spanbadgecantica = $('<span />');
|
||||||
spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
|
spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
|
||||||
spanbadgecantica.append(count)
|
spanbadgecantica.append(count)
|
||||||
spanbadgecantica.appendTo($('#cantica'+i))
|
spanbadgecantica.appendTo($('#cantica' + i))
|
||||||
}
|
}
|
||||||
//aggiunge badge con totale risultati accanto ai canti
|
//aggiunge badge con totale risultati accanto ai canti
|
||||||
|
|
||||||
for(cantica of cantiche){
|
for (cantica of cantiche) {
|
||||||
for( k of Array(35).keys()){
|
for (k of Array(35).keys()) {
|
||||||
if (k==0)
|
if (k == 0)
|
||||||
continue
|
continue
|
||||||
let count = resultsInCanto.reduce((n, x) => n + (x === cantica+'Canto '+k), 0);
|
let count = resultsInCanto.reduce((n, x) => n + (x === cantica + 'Canto ' + k), 0);
|
||||||
|
|
||||||
var spanbadge=$('<span />');
|
var spanbadge = $('<span />');
|
||||||
spanbadge.attr('class', cantobadgeclass);
|
spanbadge.attr('class', cantobadgeclass);
|
||||||
spanbadge.append(count)
|
spanbadge.append(count)
|
||||||
//$("[name='nameofobject']")
|
//$("[name='nameofobject']")
|
||||||
spanbadge.appendTo($('[name="'+cantica+'Canto '+k+'"]'))
|
spanbadge.appendTo($('[name="' + cantica + 'Canto ' + k + '"]'))
|
||||||
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//aggiorna minimap
|
//aggiorna minimap
|
||||||
if (currentMinimap!=''){
|
if (currentMinimap != '') {
|
||||||
|
|
||||||
showMinimap(currentMinimap)
|
showMinimap(currentMinimap)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue