visualizzazione struttura sintattica, in progress

This commit is contained in:
cesare 2023-02-01 08:57:41 +01:00
parent af6ad62c52
commit 71f84da39c
2 changed files with 45 additions and 76 deletions

View File

@ -27,6 +27,10 @@
color: red; color: red;
} }
.canto {
}
/* /*
Minimap Minimap

View File

@ -5,11 +5,13 @@
var resetResult; var resetResult;
var lsid; var lsid;
var getDimDiv; var getDimDiv;
$(document).ready(function() { $(document).ready(function() {
lsid=''; lsid='';
removeGraph=false;
const posyntstruct=`<div > const posyntstruct=`<div >
<div id="sentenceStructArcs2"></div> <div id="sentenceStructArcs2"></div>
</div> </div>
@ -54,12 +56,11 @@ $(document).ready(function() {
createAllDivCanti() createAllDivCanti()
const start = performance.now(); const start = performance.now();
showCanto(formeprima, '1','1') showCanto(formeprima, '1','1')
//showCantica('Inferno') //$("#InfernoCanto_1").attr('style', 'display:block')
//showCantica('Purgatorio') //$("#InfernoCanto_1").removeClass('hidecanto')
//showCantica('Paradiso')
$("#InfernoCanto_1").attr('style', 'display:block') $("#InfernoCanto_1").css("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`);
@ -81,6 +82,23 @@ $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
}); });
$( " .Ma, .Co, .Su, .Pa " ).dblclick(function() {
sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
console.log(sentenceId)
if (shownSentenceList.has(sentenceId)){
resetSentenceStructure(sentenceId)
shownSentenceList.delete(sentenceId)
lsid=''
}
else{
showSentenceStructure (sentenceId)
shownSentenceList.add(sentenceId)
}
});
$(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) { $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
@ -93,56 +111,8 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
//$(this).trigger('drawSynt') //$(this).trigger('drawSynt')
}); });
/*
$(" .Ma, .Co, .Su, .Pa").tooltip({
content: (function() {return formatTTContent($(this).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
});
*/
/*$(""[data-cg]").hover(function() {
console.log('here')
var details=getHoverContent($(this).data("cg"))
var index = details.indexOf(",");
var sentencetype= $(this).attr('class');
var categoria = "";
if (index != -1){
categoria = details.substring(0,index);
details = details.substring(index+1);
}else{
categoria = details;
details = "";
}
/*$(this).popover({title: catgramm, content: subcatgramm+"<br/><div id='sentence' type='button' class='$"+sentencetype+
" popover-footer btn btn-light'>Periodo</div>"+posyntstruct,
html:true, placement: "top",
trigger: "click"}).on("hidden.bs.popover", function(e) {
sentenceId=$(this).attr('class').split(' ')[0].replace('$','');
resetSentenceStructure(sentenceId)
shownSentenceList.delete(sentenceId)
})
.on("shown.bs.popover", function(es){
ids=sentencetype.split("_")
sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
lisid=ids[0]+'_'+ids[1]+'_'+ids[3]
lisid=lisid.split(" ")[0]
console.log('show '+lisid)
});
});*/
jQuery(document).delegate('#sentence', 'click', function(e) { jQuery(document).delegate('#sentence', 'click', function(e) {
@ -150,6 +120,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
sentenceId=$(this).attr('class').split(' ')[0].replace('$','') sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
console.log(sentenceId) console.log(sentenceId)
if (shownSentenceList.has(sentenceId)){ if (shownSentenceList.has(sentenceId)){
lisid=''
resetSentenceStructure(sentenceId) resetSentenceStructure(sentenceId)
shownSentenceList.delete(sentenceId) shownSentenceList.delete(sentenceId)
} }
@ -160,8 +131,8 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
}); });
var mmih = 0 //var mmih = 0
var mmiw = 0 //var mmiw = 0
$("#" + displayId).scroll(function() { $("#" + displayId).scroll(function() {
@ -181,7 +152,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
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).css("display", "none");
}); });
const cid=$(this).attr('name').replace(" ", "_"); const cid=$(this).attr('name').replace(" ", "_");
if ( !(loadedCanti.has(cid))) if ( !(loadedCanti.has(cid)))
@ -196,7 +167,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
showCanto(formeterza, '3',parcid[1]) showCanto(formeterza, '3',parcid[1])
loadedCanti.add(cid) loadedCanti.add(cid)
} }
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block') $("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
manageMiniMap(this); manageMiniMap(this);
$(" .Ma, .Co, .Su, .Pa").each(function(idx, element) { $(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
var ele = $(element); var ele = $(element);
@ -314,7 +285,6 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
minimapScrolling = true; minimapScrolling = true;
trackScrollViewer(ui.offset.top - minimapTopPos); trackScrollViewer(ui.offset.top - minimapTopPos);
console.log(ui);
} }
}); });
} }
@ -443,9 +413,9 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
getDimensionsDiv() getDimensionsDiv()
window.addEventListener('scroll', trackScroll) //window.addEventListener('scroll', trackScroll)
window.addEventListener('resize', getDimensionsDiv) window.addEventListener('resize', getDimensionsDiv)
//$('iframe').css('background', '#eaeae6;');
} }
@ -484,11 +454,12 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
getDimDiv = function(){ getDimDiv = function(){
getDimensionsDiv(); getDimensionsDiv();
} }
/*
function trackScroll() { function trackScroll() {
//console.log(window.scrollY) console.log('sc '+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)`
@ -546,7 +517,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
} }
} }
/*
function showCantica(cantica) { function showCantica(cantica) {
//var listaCanti = new Set() //var listaCanti = new Set()
var setVersi = new Set() var setVersi = new Set()
@ -582,6 +553,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return return
} }
*/
function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) { function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) {
var spanoccorrenza = $('<span />') var spanoccorrenza = $('<span />')
@ -589,14 +561,6 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
//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')))
spanoccorrenza.addClass("font-weight-bold mark ")
*/
spanoccorrenza.append(forma+" ") spanoccorrenza.append(forma+" ")
spanoccorrenza.appendTo(elementoverso) spanoccorrenza.appendTo(elementoverso)
@ -617,7 +581,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return elementoverso return elementoverso
} }
/*
function createDivVerso(cantica, num, canto, forma, catgram, pos, sentenceid, clausefunct) { function createDivVerso(cantica, num, canto, forma, catgram, pos, sentenceid, clausefunct) {
var elementoverso = $('<p />') var elementoverso = $('<p />')
@ -643,7 +607,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return elementoverso return elementoverso
} }
*/
function createAllDivCanti() { function createAllDivCanti() {
var cantiche=["Inferno", "Purgatorio","Paradiso"] var cantiche=["Inferno", "Purgatorio","Paradiso"]
@ -657,7 +621,8 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
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.css("display", "none")
//divcanto.attr('style', 'display:none')
divcanto.attr('id', (cantica + canto).replace(" ", "_")) divcanto.attr('id', (cantica + canto).replace(" ", "_"))
titolocanto.appendTo(divcanto) titolocanto.appendTo(divcanto)
divcanto.appendTo(' .blog-main') divcanto.appendTo(' .blog-main')