dialoghi: agg personaggio e tipo in tooltip

This commit is contained in:
cesare 2024-01-10 11:54:13 +01:00
parent 2231472535
commit 771b9080ae
2 changed files with 28 additions and 32 deletions

View File

@ -573,6 +573,7 @@ li::marker {
}
.diaDiretto {
font-style: italic;
font-weight: bold;
color: #bb6258;
}
@ -594,3 +595,6 @@ li::marker {
font-size: 12px;
}
.ttContentPers {
padding: 3px 3px 0px 3px;
}

View File

@ -101,7 +101,7 @@ $(" ."+formaClass).each(function(idx, element) {
// We cycle through the elements using each() so that we can choose the element specifically that we wish to clean up afterward
var ele = $(element);
ele.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], ele.attr('class').split(' ')[0]);}),
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();},
@ -521,32 +521,6 @@ $(" ."+formaClass).hover(function(idx, element) {
//Utility functions
/*
function addFormaListenersInRisultato(tmplist){
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 }
});
$(ris).hover(function(idx, element) {
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(){
let idn=0
@ -555,7 +529,7 @@ $(" ."+formaClass).hover(function(idx, element) {
var ele = $(element);
$(element).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], ele.attr('class').split(' ')[0]); }),
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(); },
@ -1258,9 +1232,12 @@ function resetFrasi(){
}
}
//Visualizzazione lemma e categoria grammaticale
//Calcola lemma e categoria grammaticale oppure categoria sintattica per tooltip
function formatTTContent(categ, syntType){
function formatTTContent(categ, syntType, sentId){
if (selectedVista=='frasi'){
return '<div class="ttContent"><b>'+maptypes[syntType]+'</b></div>';
}
var details=[];
var lemma=categ.split('#')[1].replace("^", " ") //il lemma
var categoria=categ.split('#')[0] // la categoria
@ -1270,10 +1247,15 @@ function resetFrasi(){
var catgramm;
var subcatgramm = '';
var popoverText = '';
if (selectedVista=='frasi'){
return '<div class="ttContent"><b>'+maptypes[syntType]+'</b></div>';
var discorsost='';
var TipiDiscorso={
"ThoughtDiscourse": "Pensato",
"DirectDiscourse": "Diretto",
"SpeakableDiscourse": "Parlato"
}
for (detail of details){
myitems= detail.split(',');
@ -1284,6 +1266,16 @@ function resetFrasi(){
popoverText = popoverText + catgramm + subcatgramm;
}
if(selectedVista=='dialoghi'){
for (const india in dialoghi){
if (dialoghi[india]['Cnt'].replace('_so','')==sentId){
discorsost="<div class='ttContentPers'><b>Personaggio:</b> "+dialoghi[india]['Spna'].replace('http://dantenetwork.it/data/commedia/', '')
+'<br><b>Discorso:</b> '+TipiDiscorso[dialoghi[india]['Dty']]+'</div>'
break;
}
}
}
popoverText=popoverText+discorsost
return (popoverText);
}