diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 508132c..8c27c8d 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -105,7 +105,7 @@ $(" ."+formaClass).each(function(idx, element) { $( " ."+formaClass ).dblclick(function() { - sentenceId=$(this).attr('class').split(' ')[0].replace('$','') + var sentenceId=$(this).attr('class').split(' ')[0].replace('$','') console.log('dblclick '+lisid) if (shownSentenceList.has(sentenceId)){ resetSentenceStructure(sentenceId) @@ -123,7 +123,7 @@ $( " ."+formaClass ).dblclick(function() { $(" ."+formaClass).hover(function(idx, element) { - sentenceId=$(this).attr('class').split(' ')[0].split('_') + var sentenceId=$(this).attr('class').split(' ')[0].split('_') var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3] lsentid=$(this).attr('class').split(' ')[0] lisid=tmplisid @@ -246,8 +246,8 @@ $(" ."+formaClass).hover(function(idx, element) { //aggiungo listeners //addFormaListeners() - //addFormaListenersInCanto() - addFormaListenersInRisultato() + addFormaListenersInCanto() + //addFormaListenersInRisultato() //disegno minimap drawMinimap('#vistaFrasi') @@ -323,12 +323,13 @@ $(" ."+formaClass).hover(function(idx, element) { */ jQuery(document).delegate(' .espandiFrase, .riduciFrase', 'click', function() { + var posizioniEspansione=[] var cid = $(this).attr('id'); var parcid = cid.split('_'); - console.log(parcid) + //console.log(parcid) var posVerso reit = '#versiFrase' + parcid[4] - console.log($(reit+" > li").length) + //console.log($(reit+" > li").length) var expcontextLength=$(reit+" > li").length if(cid.includes('_er_')){ expcontextLength=contextLength @@ -352,6 +353,7 @@ $(" ."+formaClass).hover(function(idx, element) { setVersicontestoExp.add(forma.verso) } createSpanFormeNew(forma.testo, forma.catg, 'e' + forma.posizione, forma.periodo, forma.funzperiodo, divVersoExp) + posizioniEspansione.push('e' + forma.posizione) } if(cid.includes('_er_')){ @@ -384,7 +386,8 @@ $(" ."+formaClass).hover(function(idx, element) { //aggiungo listeners - addFormaListenersInRisultato() + //addFormaListenersInRisultato(posizioniEspansione) + addFormaListenersInCanto() //disegno minimap drawMinimap('#vistaFrasi') @@ -556,8 +559,8 @@ $(" ."+formaClass).hover(function(idx, element) { } //aggiungo listeners //addFormaListeners() - //addFormaListenersInCanto() - addFormaListenersInRisultato() + addFormaListenersInCanto() + //addFormaListenersInRisultato() const endal = performance.now(); console.log(`Addlistener time: ${endal - start} ms`); @@ -658,7 +661,7 @@ $(" ."+formaClass).hover(function(idx, element) { }); ele.hover(function(idx, element) { - sentenceId = $(this).attr('class').split(' ')[0].split('_') + var sentenceId = $(this).attr('class').split(' ')[0].split('_') var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3] lsentid = $(this).attr('class').split(' ')[0] lisid = tmplisid @@ -669,36 +672,30 @@ $(" ."+formaClass).hover(function(idx, element) { } - function addFormaListenersInRisultato(){ + function addFormaListenersInRisultato(tmplist){ - for (ris of listarisultati) { - - idris = '#e' + ris - ele=$(idris) - $(idris).tooltip({ + for (ris of tmplist) { + + ele = $(ris) + $(ris).tooltip({ content: (function() { return formatTTContent(ele.attr('title'), ele.attr('class').split(' ')[1]); }), 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: {delay: 800,duration: 0} + show: { delay: 800, duration: 0 } }); - - } - $(cantoDisplayed).find(" ." + formaClass).each(function(idx, element) { - $(element).hover(function(idx, element) { + $(ris).hover(function(idx, element) { - sentenceId = $(this).attr('class').split(' ')[0].split('_') + var sentenceId = $(this).attr('class').split(' ')[0].split('_') var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3] lsentid = $(this).attr('class').split(' ')[0] lisid = tmplisid }); - - }); + } - } function addFormaListenersInCanto(){ @@ -718,7 +715,7 @@ $(" ."+formaClass).hover(function(idx, element) { }); $(element).hover(function(idx, element) { - sentenceId = $(this).attr('class').split(' ')[0].split('_') + var sentenceId = $(this).attr('class').split(' ')[0].split('_') var tmplisid = sentenceId[0] + '_' + sentenceId[1] + '_' + sentenceId[3] lsentid = $(this).attr('class').split(' ')[0] lisid = tmplisid @@ -1084,14 +1081,14 @@ function resetFrasi(){ function createSpanFormeNew(forma, catgramm, pos, sentenceid, clausefunct, elementoverso) { var spanoccorrenza = $('') + var nbsp=$(' ') spanoccorrenza.attr('id', pos) //spanoccorrenza.attr('data-cg', catgramm) spanoccorrenza.attr('title', catgramm) spanoccorrenza.attr('class', sentenceid+" "+clausefunct+' '+formaClass) - spanoccorrenza.append(forma+" ") - + spanoccorrenza.append(forma) spanoccorrenza.appendTo(elementoverso) - + nbsp.appendTo(elementoverso) } function createDivVersoNew(cantica, num, canto) {