caricamento dei canti modificato

This commit is contained in:
cesare 2023-01-30 15:57:30 +01:00
parent 76e98e2320
commit b52daf643d
2 changed files with 135 additions and 16 deletions

View File

@ -11,7 +11,7 @@
*/ */
.blog-main{ .blog-main{
font-size: 13px; font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue,
Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell,
Fira Sans, Droid Sans, Fira Sans, Droid Sans,
@ -79,7 +79,7 @@ Minimap
left: 0; left: 0;
width:100%; width:100%;
height: 100%; height: 100%;
z-index: -1; z-index: 10;
transform-origin: 0 0; transform-origin: 0 0;
border: 1px solid white; border: 1px solid white;
} }
@ -112,5 +112,5 @@ Minimap
.Nik_dropdown:hover .Nik_dropdown-content { .Nik_dropdown:hover .Nik_dropdown-content {
display: block; display: block;
} }
iframe { background-color:orange; }

View File

@ -6,6 +6,7 @@
var resetResult; var resetResult;
var lsid; var lsid;
$(document).ready(function() { $(document).ready(function() {
lsid=''; lsid='';
const posyntstruct=`<div > const posyntstruct=`<div >
@ -24,10 +25,12 @@ $(document).ready(function() {
var currentMinimap = '' var currentMinimap = ''
var listarisultati = []; var listarisultati = [];
var listaPeriodiRisultato = [];
var resultSentences = new Set() var resultSentences = new Set()
var minimapScrolling = false; var minimapScrolling = false;
var displayId = 'displaycanto' var displayId = 'displaycanto'
var minimapTopPos; var cantiche=["Inferno", "Purgatorio","Paradiso"]
var loadedCanti=new Set();
var purgatorioLoaded = false; var purgatorioLoaded = false;
var paradisoLoaded = false; var paradisoLoaded = false;
@ -49,11 +52,13 @@ $(document).ready(function() {
hideMinimap(); hideMinimap();
createAllDivCanti() createAllDivCanti()
const start = performance.now(); const start = performance.now();
showCantica('Inferno') showCanto(formeprima, '1','1')
showCantica('Purgatorio') //showCantica('Inferno')
showCantica('Paradiso') //showCantica('Purgatorio')
//showCantica('Paradiso')
$("#InfernoCanto_1").attr('style', 'display:block') $("#InfernoCanto_1").attr('style', 'display:block')
drawMinimap("InfernoCanto_1") drawMinimap("InfernoCanto_1")
const end = performance.now(); const end = performance.now();
console.log(`Load cantiche time: ${end - start} ms`); console.log(`Load cantiche time: ${end - start} ms`);
@ -74,6 +79,19 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
}); });
}); });
$(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
sentenceId=$(this).attr('class').split(' ')[0].split('_')
var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3]
lisid=tmplisid
console.log('show '+tmplisid)
$(this).trigger('drawSynt');
//$(this).trigger('drawSynt')
});
/* /*
$(" .Ma, .Co, .Su, .Pa").tooltip({ $(" .Ma, .Co, .Su, .Pa").tooltip({
@ -164,9 +182,34 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
$('.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 const cid=$(this).attr('name').replace(" ", "_");
if ( !(loadedCanti.has(cid)))
{
var parcid=cid.split('_')
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)
}
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block') $("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block')
manageMiniMap(this); manageMiniMap(this);
$(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
var ele = $(element);
ele.tooltip({
content: (function() {return formatTTContent(ele.attr('title'));}),
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,
show: false
});
});
}); });
@ -253,6 +296,7 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
function drawMinimap(name){ function drawMinimap(name){
showMinimap(name) showMinimap(name)
//$('iframe').contents().find('body').css('backgroundColor', '#eaeae6;');
currentMinimap = name; currentMinimap = name;
//mmviewer diventa draggable //mmviewer diventa draggable
@ -275,12 +319,22 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
} }
function cleanSearchResult() { function cleanSearchResult() {
for (msid of listaPeriodiRisultato){
$(msid).each(function(){
$(this).removeClass("font-weight-bold mark ")
});
}
for (forma of listarisultati) { for (forma of listarisultati) {
idforma = '#' + forma idforma = '#' + forma
$(idforma).removeClass("font-weight-bold mark ") $(idforma).removeClass("font-weight-bold mark ")
} }
$(".badge").remove(); $(".badge").remove();
listarisultati = [] listarisultati = []
listaPeriodiRisultato=[]
resultSentences=new Set() resultSentences=new Set()
if (currentMinimap != '') if (currentMinimap != '')
showMinimap(currentMinimap) showMinimap(currentMinimap)
@ -366,6 +420,7 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
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";
@ -388,6 +443,8 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
window.addEventListener('scroll', trackScroll) window.addEventListener('scroll', trackScroll)
window.addEventListener('resize', getDimensionsDiv) window.addEventListener('resize', getDimensionsDiv)
//$('iframe').css('background', '#eaeae6;');
$('iframe').contents().find('body').css('backgroundColor', '#eaeae6;');
} }
@ -448,6 +505,43 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
//Cantica management functions //Cantica management functions
function showCanto(formecantica, idcantica, canto) {
var setVersiCanto = new Set()
var cantica=cantiche[parseInt(idcantica)-1];
var elverso, formaItem
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])){
elverso=createDivVersoNew(cantica, formaItem[3], 'Canto_' + formaItem[1])
setVersiCanto.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
}
createSpanFormeNew(formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso)
}
})
if (listaPeriodiRisultato.length){
for (msid of listaPeriodiRisultato){
$(msid).each(function(){
$(this).addClass("font-weight-bold mark ")
});
}
}
if (listarisultati.length){
//evidenzia risultati
for (ris of listarisultati) {
idris = '#' + ris
$(idris).addClass("font-weight-bold mark ")
}
}
}
function showCantica(cantica) { function showCantica(cantica) {
//var listaCanti = new Set() //var listaCanti = new Set()
var setVersi = new Set() var setVersi = new Set()
@ -476,7 +570,7 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
setVersi.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1]) setVersi.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])
} }
else{ else{
createSpanFormeNew(cantica, 'Canto_' + formaItem[1], formaItem[3], formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso) createSpanFormeNew(formaItem[0], formaItem[4], formaItem[2], sentenceid,formaItem[6],elverso)
} }
} }
@ -484,19 +578,39 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
} }
function createSpanFormeNew(cantica, canto, numverso, forma, catgramm, pos, sentenceid, clausefunct, elementoverso) { function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) {
var spanoccorrenza = $('<span />') var spanoccorrenza = $('<span />')
spanoccorrenza.attr('id', pos) spanoccorrenza.attr('id', pos)
//spanoccorrenza.attr('data-cg', catgramm) //spanoccorrenza.attr('data-cg', catgramm)
spanoccorrenza.attr('title', catgramm) spanoccorrenza.attr('title', catgramm)
spanoccorrenza.attr('class', sentenceid+" "+clausefunct) spanoccorrenza.attr('class', sentenceid+" "+clausefunct)
/*if (listaPeriodiRisultato.length && listaPeriodiRisultato.includes('.'+sentenceid)){
console.log('***SID: '+sentenceid+' '+spanoccorrenza.attr('id'))
listarisultati.push(spanoccorrenza.attr('id'))
}
//if (listarisultati.length > 0 && listarisultati.includes(spanoccorrenza.attr('id'))) if (listarisultati.length > 0 && listarisultati.includes(spanoccorrenza.attr('id')))
// spanoccorrenza.attr('class', "font-weight-bold mark ") spanoccorrenza.addClass("font-weight-bold mark ")
*/
spanoccorrenza.append(forma+" ") spanoccorrenza.append(forma+" ")
spanoccorrenza.appendTo(elementoverso) spanoccorrenza.appendTo(elementoverso)
}
function createDivVersoNew(cantica, num, canto) {
var elementoverso = $('<p />')
elementoverso.append(num + ". ")
elementoverso.attr("style", "line-height: 0.5em")
elementoverso.attr('class', 'f6 text-secondary text-nowrap font-weight-lighter '+cantica+' '+canto)
elementoverso.attr('id', cantica + "_" + canto + "_" + num)
elementoverso.appendTo('#' + cantica + canto)
return elementoverso
} }
function createDivVerso(cantica, num, canto, forma, catgram, pos, sentenceid, clausefunct) { function createDivVerso(cantica, num, canto, forma, catgram, pos, sentenceid, clausefunct) {
@ -613,10 +727,12 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
resultsInCantica=[] resultsInCantica=[]
resultsInCanto=[] resultsInCanto=[]
listaPeriodiRisultato=[]
if (listaclausole.length){ if (listaclausole.length){
for (var frase of listaclausole){ for (var frase of listaclausole){
var fraseItems=frase.split('-'); var fraseItems=frase.split('-');
for (var p=parseInt(fraseItems[1]); p<parseInt(fraseItems[2])+1;p++){ for (var p=parseInt(fraseItems[1]); p<parseInt(fraseItems[2])+1;p++){
listarisultati.push(p) listarisultati.push(p)
} }
if (!resSent.has(fraseItems[0]+'-'+fraseItems[3])){ if (!resSent.has(fraseItems[0]+'-'+fraseItems[3])){
@ -631,13 +747,16 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
if (unitaRicerca=='periodo' && listaclausole.length){ if (unitaRicerca=='periodo' && listaclausole.length){
resultsInCantica=[] resultsInCantica=[]
resultsInCanto=[] resultsInCanto=[]
listaPeriodiRisultato=[]
for (var frase of listaclausole){ for (var frase of listaclausole){
var fraseItems=frase.split('-'); var fraseItems=frase.split('-');
var mysid = '.' + fraseItems[0].toString() var mysid = '.' + fraseItems[0].toString()
console.log(mysid) console.log(mysid)
$(mysid).addClass('font-italic') //$(mysid).addClass('font-italic')
//$(mysid).addClass("font-weight-bold mark ")
listaPeriodiRisultato.push(mysid)
$(mysid).each(function(){ $(mysid).each(function(){
console.log('add id '+$(this).attr('id'));
listarisultati.push($(this).attr('id')) listarisultati.push($(this).attr('id'))
}); });
if (!resSent.has(fraseItems[0])){ if (!resSent.has(fraseItems[0])){