impl gestione chiusura tab dei grafi sintattici

This commit is contained in:
cesare 2024-01-09 10:19:16 +01:00
parent fb1e732cca
commit dbb6e6525a
4 changed files with 103 additions and 94 deletions

View File

@ -73,17 +73,8 @@ $("#valoreVista").on('change', function() {
break;
case "frasi":
//cancello il grafo sintattico
var periodograph=document.getElementById("periodograph");
if (periodograph!=null){
let showngr=periodograph.getAttribute('name').split("_")
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
resetSentenceStructure(tmpsent)
shownSentenceList.delete(tmpsent)
//$("#periodograph").empty()
periodograph.parentNode.removeChild(periodograph);
}
resetGraphStruct()
emptyStructCard()
loadFrasi();
break;
@ -93,20 +84,15 @@ $("#valoreVista").on('change', function() {
break;
case "dialoghi":
resetFrasi()
resetGraphStruct()
emptyStructCard()
loadDialoghi();
break;
case "citazioni":
//cancello il grafo sintattico
var periodograph=document.getElementById("periodograph");
if (periodograph!=null){
let showngr=periodograph.getAttribute('name').split("_")
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
resetSentenceStructure(tmpsent)
shownSentenceList.delete(tmpsent)
periodograph.parentNode.removeChild(periodograph);
}
resetGraphStruct()
emptyStructCard()
}
});
@ -461,18 +447,8 @@ $(" ."+formaClass).hover(function(idx, element) {
$("#vistaFrasi").css("display", "none");
//rimuove il grafo sintattico se c'è'
var periodograph=document.getElementById("periodograph");
if (periodograph!=null){
let showngr=periodograph.getAttribute('name').split("_")
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
if (shownSentenceList.has(tmpsent)){
lisid=''
resetSentenceStructure(tmpsent)
shownSentenceList.delete(tmpsent)
}
$("#periodograph").empty()
}
resetGraphStruct()
emptyStructCard()
$(cantoDisplayed).css("display", "none");
@ -795,18 +771,8 @@ function resetFrasi(){
}
}
//cancello il grafo sintattico
var periodograph=document.getElementById("periodograph");
if (periodograph!=null){
let showngr=periodograph.getAttribute('name').split("_")
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2];
resetSentenceStructure(tmpsent)
shownSentenceList.delete(tmpsent)
//$("#periodograph").empty()
periodograph.parentNode.removeChild(periodograph);
//$('#tab-list #vis0-tab').tab('show')
}
resetGraphStruct()
emptyStructCard()
}
/*INIZIO GESTIONE CITAZIONI*/

View File

@ -449,6 +449,7 @@ $(document).ready(function() {
//$('#displayinfo').append($(emptyInfo))
$('#infoCard0').attr('style', "display: flex;");
$('#structGroupCard0').attr('style', "display: none;");
resetGraphStruct()
});
// Variabili JSON per i filtri

View File

@ -12,49 +12,16 @@ const runtime1 = new Runtime(new Library(name => {
case "d3@^6.0": return d3;
}
}));
document.addEventListener("dblclick", function(e){
const target = e.target.closest("."+formaClass);
if(target){
if (locResetGraphStruct())
return
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++) {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (selectedVista!='frasi' && !listaPeriodiRisultato.includes(tmpsent))
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');
}
//console.log('matches for clausole '+matches)
//$('#tab-list #vis0-tab').tab('show')
resetMinimap(tmpsent)
emptyStructCard()
if (tmpsent==lsentid){
//showMinimap()
return
}
}
var hcontainer="#structCard0"
var main=runtime1.module(commarc, name => {
@ -71,14 +38,10 @@ document.addEventListener("dblclick", function(e){
});
//main.redefine("links", d3.csv("https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/files/parsint_mod_completo_pre_new_4.csv", d3.autoType));
if (lisid!=''){
var mywidth=document.getElementById('displaycanto').offsetWidth
//var mywidth=document.getElementById('displaycanto').offsetWidth
console.log('here graph '+lisid+' '+lsentid)
var structContainer=document.getElementById("structCard0");
main.redefine('width', 645);
@ -89,16 +52,11 @@ document.addEventListener("dblclick", function(e){
var structid=stid[0]+'_'+stid[1]+'_'+structel[0].parentNode.getAttribute('value')
fillStructCard(structid)
var collection = document.getElementsByClassName(lsentid);
for (let i = 0; i < collection.length; i++) {
//collection[i].classList.add('font-weight-normal');
collection[i].classList.add('font-italic');
//collection[i].classList.add('text-info');
//console.log(collection[i].className)
//console.log(maptypes[synttp]+' '+maptypestopalette[synttp]+', '+colorssp(maptypestopalette[synttp]))
//collection[i].style.background = colorssp(maptypestopalette[synttp]);
if (selectedVista!='frasi'){
var synttp=collection[i].className.split(" ")[1]
collection[i].style.color = colorssp(mapsynttypestopalette[synttp]);
@ -117,10 +75,9 @@ document.addEventListener("dblclick", function(e){
}
//showMinimap()
});
//manage clauses
function resetMinimap(sentid){
//var iframe = document.getElementsByClassName("minimap__content");
@ -158,4 +115,39 @@ function updateMinimap(sentid){
}
}
}
function locResetGraphStruct(){
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]
periodograph.parentNode.removeChild(periodograph);
//var sentence = document.getElementsByClassName(lsentid);
var sentence = document.getElementsByClassName(tmpsent);
for (let i = 0; i < sentence.length; i++) {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (selectedVista!='frasi' && !listaPeriodiRisultato.includes(tmpsent))
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');
}
resetMinimap(tmpsent)
emptyStructCard()
if (tmpsent==lsentid){
return true
}
return false
}
}

View File

@ -1253,6 +1253,56 @@ function getVersiConCitazioni(canticapar='', cantopar=''){
}
//TEMPORANEAMENTE: gestione del grafo quando viene chiusa la finestra dal bottone, dovebbe essere spostato
function resetGraphStruct(){
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]
periodograph.parentNode.removeChild(periodograph);
//var sentence = document.getElementsByClassName(lsentid);
var sentence = document.getElementsByClassName(tmpsent);
for (let i = 0; i < sentence.length; i++) {
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
sentence[i].classList.remove('font-italic');
if (selectedVista!='frasi' && !listaPeriodiRisultato.includes(tmpsent))
sentence[i].style.removeProperty('color');
sentence[i].classList.remove('font-weight-normal');
}
//reset Minimap
const iframe = document.getElementsByClassName("minimap__content");
var iframeDocument = iframe[0].contentDocument || iframe[0].contentWindow.document;
if (!iframeDocument) {
throw "iframe couldn't be found in DOM.";
}
var iframeSentence = iframeDocument.getElementsByClassName(tmpsent);
for (let i = 0; i < iframeSentence.length; i++) {
iframeSentence[i].classList.remove('font-italic');
if (selectedVista!='frasi')
iframeSentence[i].style.removeProperty('color');
iframeSentence[i].classList.remove('font-weight-normal');
}
emptyStructCard()
if (tmpsent==lsentid){
return true
}
return false
}
}
//end
var sottoCategorie = {
"verbovolgare": {
"Diatesi": { "Attivo": "TipoDiatesiVerboVolgare:VerboVolgareAttivo", "Passivo": "TipoDiatesiVerboVolgare:VerboVolgarePassivo" },