From 4c2133c72021a99bc79a3a2cba4a5f65fb04747d Mon Sep 17 00:00:00 2001 From: cesare Date: Wed, 22 Feb 2023 14:57:21 +0100 Subject: [PATCH] modificata gestione minimap per query --- js/cesareBrowse.js | 99 +++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 43bc04c..d1b6a2d 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -109,7 +109,16 @@ function loadFrasi() { $(this).css('color', colorssp(mapsynttypestopalette[stp])); }) - drawMinimap(cantoDisplayed) + let minim=$(" .minimap__content") + minim.contents().find(" .sentencetag").each(function(){ + $(this).attr('style', 'display: d-flex;'); + }) + minim.contents().find(' .'+formaClass).each(function() { + stp=$(this).attr('class').split(" ")[1] + + $(this).css('color', colorssp(mapsynttypestopalette[stp])); + }) + //drawMinimap(cantoDisplayed) } function resetFrasi(){ @@ -120,7 +129,14 @@ function resetFrasi(){ //console.log(colorssp(mapsynttypestopalette[stp])) $(this).css('color', ''); }) - drawMinimap(cantoDisplayed) + let minim=$(" .minimap__content") + minim.contents().find(" .sentencetag").each(function(){ + $(this).css('display', 'none'); + }) + minim.contents().find(' .'+formaClass).each(function() { + $(this).css('color', ''); + }) + //drawMinimap(cantoDisplayed) } @@ -427,18 +443,21 @@ $(" ."+formaClass).hover(function(idx, element) { //visualizzo $("#vistaFrasi").attr('style', 'display: d-flex;'); + manageMM("#vistaFrasi") - drawMinimap("#vistaFrasi") + //drawMinimap("#vistaFrasi") }); jQuery(document).delegate('.navig-canto', 'click', function(e) { resetFrasi() + //nasconde vista risultati $("#vistaFrasi").css("display", "none"); //rimuove il grafo sintattico se c'รจ' var periodograph=document.getElementById("periodograph"); + if (periodograph!=null){ let showngr=document.getElementById("periodograph").getAttribute('name').split("_") var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2]; @@ -473,31 +492,17 @@ $(" ."+formaClass).hover(function(idx, element) { } //$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block"); $("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;') - drawMinimap("#" + $(this).attr('name').replace(" ", "_")) - $(" ."+formaClass).each(function(idx, element) { - var ele = $(element); - ele.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: false - - }); - ele.hover(function(idx, element) { - - sentenceId=$(this).attr('class').split(' ')[0].split('_') - var tmplisid=sentenceId[0]+'_'+sentenceId[1]+'_'+sentenceId[3] - lsentid=$(this).attr('class').split(' ')[0] - lisid=tmplisid - }); - - }); + //drawMinimap("#" + $(this).attr('name').replace(" ", "_")) + manageMM("#" + $(this).attr('name').replace(" ", "_")) + if (selectedVista=='frasi'){ + loadFrasi(); + } + addFormaListeners(); }); + //Query jQuery(document).delegate('#searchcomm, #searchcomm2', 'click', function(e) { @@ -638,21 +643,34 @@ $(" ."+formaClass).hover(function(idx, element) { }); } + let minim=$(" .minimap__content") for (forma of listarisultati) { idforma = '#' + forma $(idforma).removeClass("font-weight-bold mark ") + minim.contents().find(idforma).removeClass("font-weight-bold mark ") } $(".badge").remove(); - $("#headingZero").css("display", "none"); - $("#vistaFrasi").empty() - $("#vistaFrasi").css("display", "none"); + //$("#headingZero").css("display", "none"); + listarisultati = [] listaPeriodiRisultato=[] resultSentences=new Set() $(cantoDisplayed).attr('style', 'display: d-flex;'); - drawMinimap(cantoDisplayed) + manageMM (cantoDisplayed) + //drawMinimap(cantoDisplayed) + } + + function manageMM(name){ + currentMinimap = name; + let testhtml = $(currentMinimap)[0].outerHTML; + let minim=$(" .minimap__content") + let bm=minim.contents().find(' .blog-main') + bm.empty() + bm.append(testhtml) + getDimensionsDiv(); + } var unitaRicerca='forma' @@ -709,24 +727,6 @@ $(" ."+formaClass).hover(function(idx, element) { } - /* - var periodograph=document.getElementById("periodograph"); - - if (periodograph!=null){ - console.log('val '+document.getElementById("periodograph").getAttribute('name')) - let showngr=document.getElementById("periodograph").getAttribute('name').split("_") - var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2] - periodograph.parentNode.removeChild(periodograph); - //var sentence = document.getElementsByClassName(lsentid); - var sentence = document.getElementsByClassName(tmpsent); - for (let i = 0; i < sentence.length; i++) { - sentence[i].classList.remove('font-italic'); - if (selectedVista!='frasi') - sentence[i].style.removeProperty('color'); - - sentence[i].classList.remove('font-weight-normal'); - } - */ function resetSentenceStructure(sentence) { /* @@ -835,9 +835,9 @@ $(" ."+formaClass).hover(function(idx, element) { spannum.attr('class', 'numverso text-muted') elementoverso.append(spannum) //elementoverso.append(num + ". ") - elementoverso.attr("style", "line-height: 0.5em") + //elementoverso.attr("style", "line-height: 0.5em") - elementoverso.attr('class', 'f6 text-dark text-nowrap font-weight-lighter '+cantica+' '+canto) + elementoverso.attr('class', 'f6 mb-2 text-dark text-nowrap font-weight-lighter '+cantica+' '+canto) elementoverso.attr('id', cantica + "_" + canto + "_" + num) @@ -952,6 +952,7 @@ $(" ."+formaClass).hover(function(idx, element) { }); seachbBindingsStream.on('end', () => { var resSent=new Set() + let minim=$(" .minimap__content") console.log('start rendering...') listarisultati = Array.from(result) var listaclausole=Array.from(resultClauses) @@ -1032,7 +1033,7 @@ $(" ."+formaClass).hover(function(idx, element) { //$('#cantica' + i).after(spanbadgecantica) } } - //aggiunge badge con totale risultati nel bottone lista canti + //aggiunge badge con totale risultati nel bottone lista risultati if (totResultN>0){ $("#headingZero").attr('style', 'display: d-flex;') var spanbadgelista = $('');