This commit is contained in:
nicola 2023-03-13 10:04:51 +01:00
commit 66f24ab67c
1 changed files with 26 additions and 29 deletions

View File

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