2022-11-06 17:12:56 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2022-11-08 10:44:20 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
2022-11-18 12:48:53 +01:00
|
|
|
const cantobadgeclass='badge badge-outline-info badge-pill'
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
const sparqlGenerator = sparqljs.Generator;
|
|
|
|
const myEngine = new Comunica.QueryEngine();
|
|
|
|
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
|
2022-11-08 10:44:20 +01:00
|
|
|
var primaCanticaLoaded = false;
|
|
|
|
var secondaCanticaLoaded = false;
|
|
|
|
var terzaCanticaLoaded = false;
|
2022-11-06 17:12:56 +01:00
|
|
|
var listaVersi = new Set()
|
2022-11-11 22:11:22 +01:00
|
|
|
const ddmenus={"Inferno":"#dmc1",
|
|
|
|
"Purgatorio": "#dmc2",
|
|
|
|
"Paradiso": "#dmc3"}
|
2022-11-18 11:13:18 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
var currentMinimap=''
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
//caricamento prima cantica
|
2022-11-06 17:12:56 +01:00
|
|
|
$('#cantica1').on('click', function() {
|
2022-11-11 22:11:22 +01:00
|
|
|
hideMinimap();
|
2022-11-08 10:44:20 +01:00
|
|
|
activateMenuItem('#cantica1')
|
|
|
|
if (!(primaCanticaLoaded)) {
|
2022-11-10 15:41:43 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
jsonQuery = versiCantica("Inferno");
|
|
|
|
execQuery = new sparqlGenerator().stringify(jsonQuery);
|
2022-11-08 10:44:20 +01:00
|
|
|
executeQueryVersi(execQuery);
|
|
|
|
primaCanticaLoaded = true;
|
2022-11-17 17:49:34 +01:00
|
|
|
$(".labelCantica").attr('style', "display: block;");
|
2022-11-08 10:44:20 +01:00
|
|
|
}
|
|
|
|
else {
|
2022-11-10 15:41:43 +01:00
|
|
|
//$("#InfernoCanto_1").attr('style', 'display:block')
|
2022-11-08 10:44:20 +01:00
|
|
|
$("#CantiInferno").attr('style', 'display:block')
|
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:13:18 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
//caricamento seconda cantica
|
|
|
|
$('#cantica2').on('click', function() {
|
2022-11-11 22:11:22 +01:00
|
|
|
hideMinimap();
|
2022-11-08 10:44:20 +01:00
|
|
|
activateMenuItem('#cantica2')
|
|
|
|
if (!(secondaCanticaLoaded)) {
|
2022-11-10 15:41:43 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
jsonQuery = versiCantica("Purgatorio");
|
|
|
|
execQuery = new sparqlGenerator().stringify(jsonQuery);
|
2022-11-08 10:44:20 +01:00
|
|
|
executeQueryVersi(execQuery);
|
|
|
|
secondaCanticaLoaded = true;
|
2022-11-17 17:49:34 +01:00
|
|
|
$(".labelCantica").attr('style', "display: block;");
|
2022-11-07 11:52:54 +01:00
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
else {
|
2022-11-10 15:41:43 +01:00
|
|
|
//$("#PurgatorioCanto_1").attr('style', 'display:block')
|
2022-11-08 10:44:20 +01:00
|
|
|
$("#CantiPurgatorio").attr('style', 'display:block')
|
|
|
|
|
|
|
|
}
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-18 11:13:18 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
//caricamento terza cantica
|
|
|
|
$('#cantica3').on('click', function() {
|
2022-11-11 22:11:22 +01:00
|
|
|
hideMinimap();
|
2022-11-08 10:44:20 +01:00
|
|
|
activateMenuItem('#cantica3')
|
|
|
|
if (!(terzaCanticaLoaded)) {
|
2022-11-10 15:41:43 +01:00
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
jsonQuery = versiCantica("Paradiso");
|
|
|
|
execQuery = new sparqlGenerator().stringify(jsonQuery);
|
2022-11-08 10:44:20 +01:00
|
|
|
executeQueryVersi(execQuery);
|
|
|
|
terzaCanticaLoaded = true;
|
2022-11-17 17:49:34 +01:00
|
|
|
$(".labelCantica").attr('style', "display: block;");
|
2022-11-07 11:52:54 +01:00
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
else {
|
2022-11-10 15:41:43 +01:00
|
|
|
//$("#ParadisoCanto_1").attr('style', 'display:block')
|
2022-11-08 10:44:20 +01:00
|
|
|
$("#CantiParadiso").attr('style', 'display:block')
|
|
|
|
|
|
|
|
}
|
2022-11-18 11:13:18 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|
2022-11-15 10:41:16 +01:00
|
|
|
var mmih=0
|
|
|
|
var mmiw=0
|
2022-11-17 10:15:29 +01:00
|
|
|
var minimapScrolling=false;
|
2022-11-15 16:01:23 +01:00
|
|
|
var displayId='displaycanto'
|
2022-11-17 10:15:29 +01:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
});
|
2022-11-06 17:12:56 +01:00
|
|
|
jQuery(document).delegate('.navig-canto', 'click', function(e) {
|
|
|
|
$('.canto').each(function() {
|
2022-11-08 10:44:20 +01:00
|
|
|
$(this).attr("style", 'display:none');
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block')
|
2022-11-15 16:01:23 +01:00
|
|
|
|
|
|
|
mmiw=$("#"+displayId).innerWidth();
|
|
|
|
mmih=$("#"+displayId).innerHeight();
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
showMinimap($(this).attr('name').replace(" ", "_"))
|
2022-11-11 22:11:22 +01:00
|
|
|
currentMinimap=$(this).attr('name').replace(" ", "_");
|
2022-11-17 10:15:29 +01:00
|
|
|
//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);
|
2022-11-17 10:56:33 +01:00
|
|
|
//trackScrollViewer(ui.offset.top);
|
|
|
|
console.log(ui);
|
2022-11-17 10:15:29 +01:00
|
|
|
//document.getElementById(displayId).style.transform=`translateY(${viewer.scrollTop * realScale}px)`;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//$('#minimapviewer').on('drag', trackScrollViewer)
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
//Query
|
|
|
|
|
|
|
|
|
|
|
|
//$('#searchcomm').on('click', function() {
|
|
|
|
jQuery(document).delegate('#searchcomm', 'click', function(e) {
|
|
|
|
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica=[]
|
|
|
|
|
|
|
|
esprlogica.push('Clausola1')
|
|
|
|
condizioni={"EsprLogica": esprlogica}
|
|
|
|
clausola={}
|
|
|
|
clausola['typeGramm0']=$('#queryText').val()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clausola['queryText']=""
|
|
|
|
condizioni['Clausola1']=clausola
|
|
|
|
jsonQuery=buildSQ(condizioni)
|
|
|
|
myquery =new sparqlGenerator().stringify(jsonQuery)
|
|
|
|
|
|
|
|
executeQuerySearch(myquery)
|
2022-11-12 19:45:14 +01:00
|
|
|
|
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-14 09:22:00 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
//Reset
|
|
|
|
|
|
|
|
jQuery(document).delegate('#cleanresult', 'click', function(e) {
|
|
|
|
|
|
|
|
cleanSearchResult()
|
|
|
|
esprlogica=[]
|
|
|
|
$('#queryText').val("")
|
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
});
|
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
//Utility functions
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
//activate navigation menu items
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
function activateMenuItem(menuItem) {
|
2022-11-11 22:11:22 +01:00
|
|
|
//$('.blog-nav-item').each(function() {
|
|
|
|
// $(this).attr("class", $(this).attr("class").replace(' active', ''));
|
|
|
|
//});
|
|
|
|
//$(menuItem).attr("class", $(menuItem).attr("class") + ' active');
|
2022-11-06 17:12:56 +01:00
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-08 12:25:59 +01:00
|
|
|
function managePunctuation(stringa) {
|
|
|
|
var tempstringa=stringa.replaceAll(" ,", ",")
|
|
|
|
tempstringa=tempstringa.replaceAll(" .", ".")
|
|
|
|
tempstringa=tempstringa.replaceAll(" :", ":")
|
|
|
|
tempstringa=tempstringa.replaceAll(" !", "!")
|
|
|
|
tempstringa=tempstringa.replaceAll(" ?", "?")
|
|
|
|
tempstringa=tempstringa.replaceAll(" ;", ";")
|
2022-11-12 19:45:14 +01:00
|
|
|
tempstringa=tempstringa.replaceAll("%20", " ")
|
2022-11-08 12:25:59 +01:00
|
|
|
return tempstringa
|
|
|
|
}
|
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
function cleanSearchResult(){
|
|
|
|
|
2022-11-18 11:13:18 +01:00
|
|
|
for (verso of listarisultati){
|
2022-11-11 22:11:22 +01:00
|
|
|
idverso='#'+verso
|
2022-11-18 11:13:18 +01:00
|
|
|
//console.log(idverso)
|
2022-11-12 19:45:14 +01:00
|
|
|
$(idverso).attr('class', 'f6 font-weight-lighter')
|
2022-11-11 22:11:22 +01:00
|
|
|
}
|
2022-11-18 11:13:18 +01:00
|
|
|
$( ".badge" ).remove();
|
|
|
|
listarisultati=[]
|
2022-11-11 22:11:22 +01:00
|
|
|
if (currentMinimap!='')
|
|
|
|
showMinimap(currentMinimap)
|
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-15 10:41:16 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
//minimap management
|
|
|
|
let minimap = document.createElement('div');
|
|
|
|
let minimapSize = document.createElement('div');
|
|
|
|
let viewer = document.createElement('div');
|
|
|
|
let minimapContent = document.createElement('iframe');
|
|
|
|
let scale=0.1;
|
|
|
|
let realScale;
|
|
|
|
|
|
|
|
function showMinimap(element) {
|
|
|
|
|
2022-11-15 10:41:16 +01:00
|
|
|
mmplace=document.getElementById('displayminimap')
|
2022-11-15 16:01:23 +01:00
|
|
|
minimap.className = 'minimap_container'
|
2022-11-08 10:44:20 +01:00
|
|
|
minimapSize.className = 'minimap_size'
|
|
|
|
viewer.className = 'minimap_viewer'
|
2022-11-10 15:41:43 +01:00
|
|
|
viewer.id='minimapviewer'
|
2022-11-08 10:44:20 +01:00
|
|
|
minimapContent.className = 'minimap_content'
|
2022-11-15 10:41:16 +01:00
|
|
|
//class="col-3 px-0"
|
2022-11-08 10:44:20 +01:00
|
|
|
minimap.append(minimapSize, viewer, minimapContent);
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-15 10:41:16 +01:00
|
|
|
//document.body.appendChild(minimap)
|
|
|
|
if (mmplace!=null)
|
2022-11-15 16:01:23 +01:00
|
|
|
mmplace.appendChild(minimap)
|
|
|
|
//document.body.appendChild(minimap)
|
2022-11-15 10:41:16 +01:00
|
|
|
else{
|
|
|
|
minimap.style.position = 'fixed';
|
|
|
|
document.body.appendChild(minimap)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-15 13:23:59 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
|
|
|
|
let html = document.getElementById(element).outerHTML//innerHTML
|
2022-11-15 16:01:23 +01:00
|
|
|
//console.log(html)
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
let iFrameDoc = minimapContent.contentWindow.document;
|
2022-11-17 16:37:08 +01:00
|
|
|
var cssLink = document.createElement("link");
|
|
|
|
cssLink.href = "https://unpkg.com/tachyons/css/tachyons.min.css";
|
|
|
|
cssLink.rel = "stylesheet";
|
|
|
|
cssLink.type = "text/css";
|
|
|
|
|
|
|
|
var cssLinkb = document.createElement("link");
|
|
|
|
cssLinkb.href = "https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css";
|
|
|
|
cssLinkb.rel = "stylesheet";
|
|
|
|
cssLinkb.type = "text/css";
|
|
|
|
|
2022-11-18 14:55:06 +01:00
|
|
|
var cssLinkscroll = document.createElement("link");
|
|
|
|
cssLinkscroll.href = "./css/browsingldc.css";
|
|
|
|
cssLinkscroll.rel = "stylesheet";
|
|
|
|
cssLinkscroll.type = "text/css";
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
iFrameDoc.open();
|
|
|
|
iFrameDoc.write(html);
|
|
|
|
iFrameDoc.close();
|
2022-11-17 16:37:08 +01:00
|
|
|
iFrameDoc.head.appendChild(cssLink);
|
|
|
|
iFrameDoc.head.appendChild(cssLinkb);
|
2022-11-18 14:55:06 +01:00
|
|
|
iFrameDoc.head.appendChild(cssLinkscroll);
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
getDimensionsDiv()
|
2022-11-15 10:41:16 +01:00
|
|
|
|
2022-11-15 16:01:23 +01:00
|
|
|
if (document.getElementById(displayId).getAttribute('target')==null)
|
|
|
|
window.addEventListener('scroll', trackScroll)
|
2022-11-17 10:15:29 +01:00
|
|
|
/*else{
|
|
|
|
//document.getElementById(displayId).addEventListener('scroll', trackScrollCanto)
|
|
|
|
|
|
|
|
}*/
|
2022-11-15 16:01:23 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
document.getElementById(displayId).addEventListener('resize', getDimensionsDiv)
|
2022-11-15 10:41:16 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
window.addEventListener('resize', getDimensionsDiv)
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-11-07 11:52:54 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
function getDimensions(){
|
|
|
|
|
2022-11-15 16:01:23 +01:00
|
|
|
|
|
|
|
cantoplace=document.getElementById(displayId)
|
|
|
|
mmplace=document.getElementById('displayminimap')
|
2022-11-17 16:37:08 +01:00
|
|
|
isnick=mmplace=document.getElementById('apricerca')
|
2022-11-08 10:44:20 +01:00
|
|
|
let bodyWidth = document.body.clientWidth;
|
2022-11-15 10:41:16 +01:00
|
|
|
|
2022-11-17 10:15:29 +01:00
|
|
|
let bodyRatio = document.body.clientHeight / bodyWidth;
|
2022-11-08 10:44:20 +01:00
|
|
|
let winRatio = window.innerHeight / window.innerWidth;
|
2022-11-15 16:01:23 +01:00
|
|
|
//test
|
|
|
|
|
2022-11-17 10:15:29 +01:00
|
|
|
//if(cantoplace!=null & mmplace!=null){
|
|
|
|
if(mmplace!=null){
|
2022-11-17 16:37:08 +01:00
|
|
|
//winRatio = mmih / mmiw;//window.innerWidth;
|
|
|
|
//bodyRatio = mmih / mmiw;//mmplace.clientHeight/cantoplace.clientWidth;
|
2022-11-17 10:15:29 +01:00
|
|
|
}
|
2022-11-17 16:37:08 +01:00
|
|
|
viewer.style.width='50%'
|
|
|
|
/*if(mmplace!=null){
|
|
|
|
//minimap.style.width = '75%';
|
|
|
|
//viewer.style.width='45%'
|
2022-11-17 10:15:29 +01:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
minimap.style.width = '15%';
|
|
|
|
viewer.style.width='25%'
|
2022-11-17 16:37:08 +01:00
|
|
|
}*/
|
|
|
|
if(isnick!=null){
|
|
|
|
minimap.style.width = '40%';
|
|
|
|
viewer.style.width='15%'
|
2022-11-17 10:15:29 +01:00
|
|
|
}
|
2022-11-15 17:38:18 +01:00
|
|
|
|
|
|
|
//end test
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
|
|
|
|
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
realScale = minimap.clientWidth / mmih;//bodyWidth;
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-17 16:37:08 +01:00
|
|
|
console.log(' cw ' +minimap.clientWidth+" bw "+ bodyWidth +" br "+bodyRatio+ ' rs '+realScale)
|
|
|
|
//realScale=scale
|
2022-11-15 10:41:16 +01:00
|
|
|
|
2022-11-15 17:38:18 +01:00
|
|
|
minimapSize.style.paddingTop = `${bodyRatio * 100}%`
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-15 17:38:18 +01:00
|
|
|
viewer.style.paddingTop = `${(winRatio) * 100}%`;
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-15 10:41:16 +01:00
|
|
|
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
minimapContent.style.transform = `scale(${realScale})`;
|
2022-11-17 10:15:29 +01:00
|
|
|
minimapContent.style.width = `${(100 / realScale)}%`
|
2022-11-08 10:44:20 +01:00
|
|
|
minimapContent.style.height = `${(100 / realScale)}%`
|
2022-11-17 10:15:29 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
}
|
2022-11-17 16:37:08 +01:00
|
|
|
function getInnerHeight( elm ){
|
|
|
|
var computed = getComputedStyle(elm),
|
|
|
|
padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
|
|
|
|
|
|
|
|
return elm.clientHeight - padding
|
|
|
|
}
|
|
|
|
function getDimensionsDiv(){
|
|
|
|
|
|
|
|
|
|
|
|
cantoplace=document.getElementById(displayId)
|
|
|
|
mmplace=document.getElementById('displayminimap')
|
|
|
|
isnick=mmplace=document.getElementById('apricerca')
|
|
|
|
cpmaxh=cantoplace.style.maxHeight
|
|
|
|
cpmaxh=cpmaxh.replace('px','')
|
|
|
|
cpbw=cantoplace.style.width
|
|
|
|
let tebodyWidth = document.body.clientWidth;
|
|
|
|
|
|
|
|
let tebodyRatio = (document.body.clientHeight) / tebodyWidth;
|
|
|
|
let tewinRatio = window.innerHeight / window.innerWidth;
|
|
|
|
|
|
|
|
let bodyWidth = mmiw;
|
|
|
|
|
|
|
|
let bodyRatio = parseInt(cpmaxh) / bodyWidth;
|
|
|
|
|
|
|
|
elmih=getInnerHeight(cantoplace)
|
|
|
|
|
|
|
|
let winRatio = elmih / (mmiw-32);
|
|
|
|
|
2022-11-18 14:55:06 +01:00
|
|
|
minimap.style.width = '70%';
|
|
|
|
viewer.style.width='40%'
|
2022-11-17 16:37:08 +01:00
|
|
|
|
|
|
|
if(isnick!=null){
|
2022-11-18 17:26:12 +01:00
|
|
|
//minimap.style.width = '90%';
|
|
|
|
//viewer.style.width='20%'
|
2022-11-17 16:37:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
realScale = minimap.clientWidth / cpmaxh;//bodyWidth;
|
|
|
|
|
|
|
|
console.log(' cw ' +minimap.clientWidth+" bw "+ bodyWidth +" br "+bodyRatio+ ' rs '+realScale)
|
|
|
|
//realScale=scale
|
|
|
|
|
2022-11-18 14:55:06 +01:00
|
|
|
minimapSize.style.paddingTop = `${bodyRatio * 100}%`
|
2022-11-17 16:37:08 +01:00
|
|
|
|
|
|
|
console.log (minimapSize.style.paddingTop)
|
|
|
|
|
2022-11-18 14:55:06 +01:00
|
|
|
viewer.style.paddingTop = `${(winRatio) * 50}%`;
|
2022-11-17 16:37:08 +01:00
|
|
|
|
|
|
|
|
2022-11-18 15:17:25 +01:00
|
|
|
//test
|
2022-11-17 16:37:08 +01:00
|
|
|
minimapContent.style.transform = `scale(${realScale})`;
|
|
|
|
minimapContent.style.width = `${(100 / realScale)}%`
|
|
|
|
minimapContent.style.height = `${(100 / realScale)}%`
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
function trackScroll(){
|
2022-11-15 16:01:23 +01:00
|
|
|
//console.log(window.scrollY)
|
2022-11-08 10:44:20 +01:00
|
|
|
viewer.style.transform=`translateY(${window.scrollY * realScale}px)`
|
2022-11-07 11:52:54 +01:00
|
|
|
}
|
2022-11-15 10:41:16 +01:00
|
|
|
function trackScrollCanto(){
|
2022-11-17 10:15:29 +01:00
|
|
|
console.log('cantoscrollT*realscale '+document.getElementById(displayId).scrollTop * realScale+' top: ' +document.getElementById(displayId).scrollTop )
|
2022-11-15 16:01:23 +01:00
|
|
|
viewer.style.transform=`translateY(${document.getElementById(displayId).scrollTop * realScale}px)`
|
2022-11-17 10:15:29 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
function trackScrollViewer(toppos){
|
|
|
|
console.log('scrollMMView top*1/realScale: '+toppos*(1/realScale)+' top pos: '+toppos)
|
|
|
|
did=document.getElementById(displayId)
|
|
|
|
|
|
|
|
did.scrollTop=(toppos*(1/realScale))
|
|
|
|
|
|
|
|
|
2022-11-15 10:41:16 +01:00
|
|
|
}
|
2022-11-11 22:11:22 +01:00
|
|
|
|
|
|
|
function hideMinimap(){
|
|
|
|
$('.canto').each(function() {
|
|
|
|
$(this).attr("style", 'display:none');
|
|
|
|
});
|
|
|
|
$( ".minimap_container" ).remove();
|
|
|
|
currentMinimap=''
|
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-17 10:15:29 +01:00
|
|
|
// fa diventare draggable il minimapviewer
|
|
|
|
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
//end minimap management
|
|
|
|
|
2022-11-18 11:13:18 +01:00
|
|
|
// Search functions
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
async function executeQueryVersi(query) {
|
|
|
|
bindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
2022-11-06 17:12:56 +01:00
|
|
|
alert(query)
|
|
|
|
try {
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
var listaCanti = new Set()
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
listaVersi = new Set()
|
2022-11-12 19:45:14 +01:00
|
|
|
listaForme = new Set()
|
2022-11-08 10:44:20 +01:00
|
|
|
let cantica = 0;
|
2022-11-06 17:12:56 +01:00
|
|
|
bindingsStream.on('data', (binding) => {
|
2022-11-11 22:11:22 +01:00
|
|
|
//cantica
|
|
|
|
cantica = binding.get('Cantica').value;
|
|
|
|
//la lista dei canti
|
|
|
|
listaCanti.add(binding.get('Canto').value)
|
|
|
|
//la lista dei versi
|
|
|
|
var obj = new Object();
|
2022-11-12 19:45:14 +01:00
|
|
|
var forma=new Object()
|
2022-11-11 22:11:22 +01:00
|
|
|
obj.numverso = binding.get('NumeroVerso').value;
|
|
|
|
obj.verso = binding.get('Verso').value;
|
|
|
|
obj.canto = binding.get('Canto').value;
|
2022-11-12 19:45:14 +01:00
|
|
|
//obj.pos = binding.get('pos').value;
|
|
|
|
//obj.form = binding.get('textform').value;
|
2022-11-11 22:11:22 +01:00
|
|
|
obj.cantica = cantica;
|
|
|
|
listaVersi.add(obj)
|
2022-11-12 19:45:14 +01:00
|
|
|
forma.numverso = binding.get('NumeroVerso').value;
|
|
|
|
forma.canto = binding.get('Canto').value;
|
|
|
|
forma.pos = binding.get('pos').value;
|
|
|
|
forma.form = binding.get('textform').value;
|
|
|
|
forma.cantica = cantica;
|
2022-11-15 13:23:59 +01:00
|
|
|
|
2022-11-12 19:45:14 +01:00
|
|
|
listaForme.add(forma)
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|
|
|
|
bindingsStream.on('end', () => {
|
2022-11-11 22:11:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var orderedListaCanti = Array.from(listaCanti)
|
|
|
|
orderedListaCanti = orderedListaCanti.sort((a, b) => {
|
2022-11-18 16:36:24 +01:00
|
|
|
return parseInt(a.split(" ")[1], 10)-parseInt(b.split(" ")[1], 10)
|
|
|
|
//if (parseInt(a.split(" ")[1], 10) < parseInt(b.split(" ")[1]), 10) {
|
|
|
|
// return -1;
|
|
|
|
//}
|
2022-11-11 22:11:22 +01:00
|
|
|
});
|
2022-11-18 16:36:24 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
var orderedListaVersi = Array.from(listaVersi)
|
2022-11-18 16:36:24 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
orderedListaVersi = orderedListaVersi.sort((a, b) => {
|
2022-11-18 16:36:24 +01:00
|
|
|
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;
|
|
|
|
//}
|
2022-11-12 19:45:14 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
orderedListaVersi = orderedListaVersi.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) => {
|
2022-11-18 16:36:24 +01:00
|
|
|
return parseInt(a.pos, 10)-parseInt(b.pos, 10)
|
|
|
|
//if (parseInt(a.pos) < parseInt(b.pos)) {
|
|
|
|
// return -1;
|
|
|
|
//}
|
2022-11-12 19:45:14 +01:00
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
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")
|
2022-11-14 12:29:23 +01:00
|
|
|
numcanto=canto.split(" ")[1]
|
|
|
|
licanto.append(numcanto)
|
2022-11-11 22:11:22 +01:00
|
|
|
|
|
|
|
//licanto.appendTo('#listacanti')
|
|
|
|
licanto.appendTo(divListaCanti)
|
|
|
|
var divcanto = $('<div />')
|
2022-11-18 12:48:53 +01:00
|
|
|
var titolocanto = $('<h1 class="f3 titolo-canto" />')
|
|
|
|
titolocanto.append(cantica+", "+canto)
|
2022-11-11 22:11:22 +01:00
|
|
|
divcanto.attr('class', 'canto')
|
|
|
|
divcanto.attr('style', 'display:none')
|
|
|
|
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
|
|
|
|
titolocanto.appendTo(divcanto)
|
|
|
|
divcanto.appendTo(' .blog-main')
|
2022-11-08 10:44:20 +01:00
|
|
|
}
|
2022-11-11 22:11:22 +01:00
|
|
|
//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")
|
2022-11-18 16:36:24 +01:00
|
|
|
elementoverso.attr('class', 'f6 font-weight-lighter nowrap')
|
2022-11-11 22:11:22 +01:00
|
|
|
elementoverso.attr('id', verso.cantica+"_"+ verso.canto.replace(" ", "_")+"_"+verso.numverso)
|
|
|
|
elementoverso.appendTo('#' + cantica + verso.canto.replace(" ", "_"))
|
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
}
|
2022-11-12 19:45:14 +01:00
|
|
|
|
|
|
|
orderedListaForme.forEach((element) => {
|
|
|
|
var spanoccorrenza=$('<span />')
|
|
|
|
var pos=parseInt(element.pos)
|
|
|
|
spanoccorrenza.attr('id', element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso+"_"+pos)
|
2022-11-18 17:26:12 +01:00
|
|
|
if (listarisultati.length>0 && listarisultati.includes(spanoccorrenza.attr('id')))
|
2022-11-18 11:13:18 +01:00
|
|
|
spanoccorrenza.attr('class', "f6 b dark-blue ")
|
2022-11-12 19:45:14 +01:00
|
|
|
spanoccorrenza.append(managePunctuation(element.form))
|
|
|
|
elementoverso=$('#'+element.cantica+"_"+ element.canto.replace(" ", "_")+"_"+element.numverso)
|
|
|
|
spanoccorrenza.appendTo(elementoverso)
|
|
|
|
elementoverso.append(' ')
|
|
|
|
})
|
2022-11-11 22:11:22 +01:00
|
|
|
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
|
2022-11-11 22:11:22 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
console.log(err.message);
|
|
|
|
$("#loader").hide();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//execute query
|
2022-11-18 11:13:18 +01:00
|
|
|
var listarisultati=[];
|
2022-11-11 22:11:22 +01:00
|
|
|
async function executeQuerySearch(query) {
|
|
|
|
seachbBindingsStream = await myEngine.queryBindings(query, { sources: [{ type: 'sparql', value: sparqlEndpoint },], });
|
2022-11-12 19:45:14 +01:00
|
|
|
//console.log(query)
|
2022-11-11 22:11:22 +01:00
|
|
|
alert(query)
|
|
|
|
try {
|
2022-11-18 11:13:18 +01:00
|
|
|
var result = new Set()
|
|
|
|
var resultsInCantica=[]
|
|
|
|
var resultsInCanto=[]
|
2022-11-11 22:11:22 +01:00
|
|
|
seachbBindingsStream.on('data', (binding) => {
|
|
|
|
//cantica
|
|
|
|
cantica = binding.get('Cantica').value;
|
2022-11-18 11:13:18 +01:00
|
|
|
resultsInCantica.push(cantica);
|
2022-11-11 22:11:22 +01:00
|
|
|
//canto
|
|
|
|
canto=binding.get('Canto').value;
|
2022-11-18 11:13:18 +01:00
|
|
|
resultsInCanto.push(cantica+canto)
|
2022-11-11 22:11:22 +01:00
|
|
|
//numero del verso
|
|
|
|
numverso=binding.get('NumeroVerso').value;
|
2022-11-11 22:26:10 +01:00
|
|
|
//posizione delframmento
|
|
|
|
pos=binding.get('pos').value;
|
2022-11-18 11:13:18 +01:00
|
|
|
result.add(cantica+"_"+canto.replace(" ", "_")+"_"+numverso+"_"+pos)
|
2022-11-11 22:11:22 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
seachbBindingsStream.on('end', () => {
|
2022-11-18 11:13:18 +01:00
|
|
|
listarisultati = Array.from(result)
|
|
|
|
cantiche=["Inferno", "Purgatorio", "Paradiso"]
|
|
|
|
|
|
|
|
//evidenzia risultati
|
|
|
|
for (ris of listarisultati){
|
|
|
|
idris='#'+ris
|
|
|
|
$(idris).attr('class', "f6 b dark-blue ")
|
2022-11-12 19:45:14 +01:00
|
|
|
|
|
|
|
}
|
2022-11-18 11:13:18 +01:00
|
|
|
//aggiunge badge con totale risultati accanto alle cantiche
|
|
|
|
i=0
|
|
|
|
for(cantica of cantiche){
|
|
|
|
i+=1
|
|
|
|
let count = resultsInCantica.reduce((n, x) => n + (x === cantica), 0);
|
2022-11-18 11:19:06 +01:00
|
|
|
var spanbadgecantica=$('<span />');
|
2022-11-18 12:48:53 +01:00
|
|
|
spanbadgecantica.attr('class', 'badge badge-primary badge-pill ml-1');
|
2022-11-18 11:19:06 +01:00
|
|
|
spanbadgecantica.append(count)
|
|
|
|
spanbadgecantica.appendTo($('#cantica'+i))
|
2022-11-18 11:13:18 +01:00
|
|
|
}
|
|
|
|
//aggiunge badge con totale risultati accanto ai canti
|
|
|
|
|
|
|
|
for(cantica of cantiche){
|
|
|
|
for( k of Array(35).keys()){
|
|
|
|
if (k==0)
|
|
|
|
continue
|
|
|
|
let count = resultsInCanto.reduce((n, x) => n + (x === cantica+'Canto '+k), 0);
|
|
|
|
|
|
|
|
var spanbadge=$('<span />');
|
2022-11-18 12:48:53 +01:00
|
|
|
spanbadge.attr('class', cantobadgeclass);
|
|
|
|
spanbadge.append(count)
|
2022-11-18 11:13:18 +01:00
|
|
|
//$("[name='nameofobject']")
|
|
|
|
spanbadge.appendTo($('[name="'+cantica+'Canto '+k+'"]'))
|
|
|
|
//spanbadge.insertAfter($('[name="'+cantica+'Canto '+k+'"]'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//aggiorna minimap
|
2022-11-12 19:45:14 +01:00
|
|
|
if (currentMinimap!=''){
|
|
|
|
|
|
|
|
showMinimap(currentMinimap)
|
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|
|
|
|
}
|
2022-11-08 10:44:20 +01:00
|
|
|
catch (err) {
|
|
|
|
console.log(err.message);
|
|
|
|
$("#loader").hide();
|
2022-11-06 17:12:56 +01:00
|
|
|
};
|
|
|
|
};
|
2022-11-08 10:44:20 +01:00
|
|
|
|
|
|
|
|
2022-11-06 17:12:56 +01:00
|
|
|
});
|