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;
}
.canto {
}
/*
Minimap

View File

@ -5,11 +5,13 @@
var resetResult;
var lsid;
var getDimDiv;
$(document).ready(function() {
lsid='';
removeGraph=false;
const posyntstruct=`<div >
<div id="sentenceStructArcs2"></div>
</div>
@ -54,12 +56,11 @@ $(document).ready(function() {
createAllDivCanti()
const start = performance.now();
showCanto(formeprima, '1','1')
//showCantica('Inferno')
//showCantica('Purgatorio')
//showCantica('Paradiso')
$("#InfernoCanto_1").attr('style', 'display:block')
//$("#InfernoCanto_1").attr('style', 'display:block')
//$("#InfernoCanto_1").removeClass('hidecanto')
$("#InfernoCanto_1").css("display", "block");
drawMinimap("InfernoCanto_1")
const end = performance.now();
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) {
@ -93,56 +111,8 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
//$(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) {
@ -150,6 +120,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
sentenceId=$(this).attr('class').split(' ')[0].replace('$','')
console.log(sentenceId)
if (shownSentenceList.has(sentenceId)){
lisid=''
resetSentenceStructure(sentenceId)
shownSentenceList.delete(sentenceId)
}
@ -160,8 +131,8 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
});
var mmih = 0
var mmiw = 0
//var mmih = 0
//var mmiw = 0
$("#" + displayId).scroll(function() {
@ -181,7 +152,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
jQuery(document).delegate('.navig-canto', 'click', function(e) {
$('.canto').each(function() {
$(this).attr("style", 'display:none');
$(this).css("display", "none");
});
const cid=$(this).attr('name').replace(" ", "_");
if ( !(loadedCanti.has(cid)))
@ -196,7 +167,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
showCanto(formeterza, '3',parcid[1])
loadedCanti.add(cid)
}
$("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display:block')
$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block");
manageMiniMap(this);
$(" .Ma, .Co, .Su, .Pa").each(function(idx, element) {
var ele = $(element);
@ -314,7 +285,6 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
minimapScrolling = true;
trackScrollViewer(ui.offset.top - minimapTopPos);
console.log(ui);
}
});
}
@ -443,9 +413,9 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
getDimensionsDiv()
window.addEventListener('scroll', trackScroll)
//window.addEventListener('scroll', trackScroll)
window.addEventListener('resize', getDimensionsDiv)
//$('iframe').css('background', '#eaeae6;');
}
@ -484,11 +454,12 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
getDimDiv = function(){
getDimensionsDiv();
}
/*
function trackScroll() {
//console.log(window.scrollY)
console.log('sc '+window.scrollY)
viewer.style.transform = `translateY(${window.scrollY * realScale}px)`
}
}*/
function trackScrollCanto() {
console.log('cantoscrollT*realscale ' + document.getElementById(displayId).scrollTop * realScale + ' top: ' + document.getElementById(displayId).scrollTop)
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) {
//var listaCanti = new Set()
var setVersi = new Set()
@ -582,6 +553,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return
}
*/
function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) {
var spanoccorrenza = $('<span />')
@ -589,14 +561,6 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
//spanoccorrenza.attr('data-cg', catgramm)
spanoccorrenza.attr('title', catgramm)
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.appendTo(elementoverso)
@ -617,7 +581,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return elementoverso
}
/*
function createDivVerso(cantica, num, canto, forma, catgram, pos, sentenceid, clausefunct) {
var elementoverso = $('<p />')
@ -643,7 +607,7 @@ $(" .Ma, .Co, .Su, .Pa").hover(function(idx, element) {
return elementoverso
}
*/
function createAllDivCanti() {
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" />')
titolocanto.append(cantica + ", " + 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(" ", "_"))
titolocanto.appendTo(divcanto)
divcanto.appendTo(' .blog-main')