From 71f84da39c0dd0f37b1c4e2dbd71062ac2fd42d9 Mon Sep 17 00:00:00 2001 From: cesare Date: Wed, 1 Feb 2023 08:57:41 +0100 Subject: [PATCH] visualizzazione struttura sintattica, in progress --- css/browsingldc.css | 4 ++ js/cesareBrowse.js | 117 ++++++++++++++++---------------------------- 2 files changed, 45 insertions(+), 76 deletions(-) diff --git a/css/browsingldc.css b/css/browsingldc.css index a2eb844..03c05f3 100644 --- a/css/browsingldc.css +++ b/css/browsingldc.css @@ -27,6 +27,10 @@ color: red; } +.canto { + +} + /* Minimap diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 8c81685..982de20 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -5,11 +5,13 @@ var resetResult; var lsid; + var getDimDiv; $(document).ready(function() { lsid=''; + removeGraph=false; const posyntstruct=`
@@ -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+"
"+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 = $('') @@ -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 = $('

') @@ -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 = $('

') 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')