2023-02-06 18:16:01 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
import {Runtime, Library, Inspector} from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/runtime.js";
|
|
|
|
import commarc from "https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/index.js";
|
|
|
|
|
2023-02-24 18:06:26 +01:00
|
|
|
const iframe = document.getElementsByClassName("minimap__content");
|
2023-02-06 18:16:01 +01:00
|
|
|
const runtime1 = new Runtime(new Library(name => {
|
|
|
|
console.log('name' +name)
|
|
|
|
switch (name) {
|
|
|
|
case "d3@^5.8": return d3;
|
|
|
|
case "d3@^6.0": return d3;
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener("dblclick", function(e){
|
|
|
|
const target = e.target.closest("."+formaClass);
|
|
|
|
|
|
|
|
if(target){
|
|
|
|
|
|
|
|
var periodograph=document.getElementById("periodograph");
|
|
|
|
|
|
|
|
if (periodograph!=null){
|
2024-01-08 22:19:08 +01:00
|
|
|
//console.log('val '+document.getElementById("periodograph").getAttribute('name'))
|
2023-02-06 18:16:01 +01:00
|
|
|
let showngr=document.getElementById("periodograph").getAttribute('name').split("_")
|
|
|
|
var tmpsent=showngr[0]+"_"+showngr[1]+"_s_"+showngr[2]
|
|
|
|
periodograph.parentNode.removeChild(periodograph);
|
2024-01-05 12:22:12 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
//var sentence = document.getElementsByClassName(lsentid);
|
|
|
|
var sentence = document.getElementsByClassName(tmpsent);
|
2024-01-05 12:22:12 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
for (let i = 0; i < sentence.length; i++) {
|
2024-01-05 17:08:19 +01:00
|
|
|
//var matches = listaClausoleRisultato.filter(s => s.includes(sentence[i].classList[0]));
|
2023-02-06 18:16:01 +01:00
|
|
|
sentence[i].classList.remove('font-italic');
|
2024-01-05 13:20:10 +01:00
|
|
|
if (selectedVista!='frasi' && !listaPeriodiRisultato.includes(tmpsent))
|
2023-02-08 17:07:49 +01:00
|
|
|
sentence[i].style.removeProperty('color');
|
2023-02-06 18:16:01 +01:00
|
|
|
|
|
|
|
sentence[i].classList.remove('font-weight-normal');
|
2023-03-09 12:49:29 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
}
|
2023-03-09 12:49:29 +01:00
|
|
|
//console.log('matches for clausole '+matches)
|
|
|
|
|
|
|
|
|
2023-04-19 16:55:30 +02:00
|
|
|
//$('#tab-list #vis0-tab').tab('show')
|
2023-02-21 15:29:45 +01:00
|
|
|
resetMinimap(tmpsent)
|
|
|
|
|
2024-01-08 22:19:08 +01:00
|
|
|
emptyStructCard()
|
|
|
|
|
2023-02-15 12:00:51 +01:00
|
|
|
if (tmpsent==lsentid){
|
2023-02-21 15:29:45 +01:00
|
|
|
|
|
|
|
//showMinimap()
|
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
return
|
2023-02-15 12:00:51 +01:00
|
|
|
}
|
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
}
|
2024-01-08 22:19:08 +01:00
|
|
|
var hcontainer="#structCard0"
|
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
var main=runtime1.module(commarc, name => {
|
|
|
|
|
2023-03-01 10:44:40 +01:00
|
|
|
if (name === "sentenceStructArcs_new") {
|
2024-01-08 22:19:08 +01:00
|
|
|
const structel = document.getElementsByClassName(lsentid);
|
|
|
|
console.log(structel[0].parentNode.getAttribute('value'))
|
|
|
|
var stid=lsentid.split('_')
|
|
|
|
var structid=stid[0]+'_'+stid[1]+'_'+structel[0].parentNode.getAttribute('value')
|
|
|
|
console.log(structid)
|
|
|
|
fillStructCard(structid);
|
|
|
|
return new Inspector(document.querySelector(hcontainer));
|
2023-02-15 12:00:51 +01:00
|
|
|
}
|
2023-02-17 10:42:05 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
});
|
2023-02-15 12:00:51 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
|
2023-02-07 14:13:51 +01:00
|
|
|
//main.redefine("links", d3.csv("https://hdnlab1.isti.cnr.it/d3search/node_modules/commarcdiag/files/parsint_mod_completo_pre_new_4.csv", d3.autoType));
|
2023-02-06 18:16:01 +01:00
|
|
|
|
|
|
|
if (lisid!=''){
|
2023-02-17 10:42:05 +01:00
|
|
|
var mywidth=document.getElementById('displaycanto').offsetWidth
|
2023-02-23 10:27:17 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
console.log('here graph '+lisid+' '+lsentid)
|
2024-01-08 22:19:08 +01:00
|
|
|
var structContainer=document.getElementById("structCard0");
|
|
|
|
|
|
|
|
|
2023-02-23 10:27:17 +01:00
|
|
|
main.redefine('width', 645);
|
2023-02-06 18:16:01 +01:00
|
|
|
main.redefine("lisid", lisid);
|
2024-01-08 22:19:08 +01:00
|
|
|
const structel = document.getElementsByClassName(lsentid);
|
|
|
|
|
|
|
|
var stid=lsentid.split('_')
|
|
|
|
var structid=stid[0]+'_'+stid[1]+'_'+structel[0].parentNode.getAttribute('value')
|
|
|
|
|
|
|
|
fillStructCard(structid)
|
2023-02-06 18:16:01 +01:00
|
|
|
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)
|
2023-02-14 11:35:13 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
|
2023-02-08 17:07:49 +01:00
|
|
|
//console.log(maptypes[synttp]+' '+maptypestopalette[synttp]+', '+colorssp(maptypestopalette[synttp]))
|
|
|
|
//collection[i].style.background = colorssp(maptypestopalette[synttp]);
|
2023-02-14 11:35:13 +01:00
|
|
|
if (selectedVista!='frasi'){
|
|
|
|
var synttp=collection[i].className.split(" ")[1]
|
|
|
|
collection[i].style.color = colorssp(mapsynttypestopalette[synttp]);
|
|
|
|
}
|
|
|
|
|
2023-02-17 10:42:05 +01:00
|
|
|
//collection[i].style.removeProperty('color');
|
2023-02-06 18:16:01 +01:00
|
|
|
}
|
2023-04-19 13:27:12 +02:00
|
|
|
$('#tab-list #vis1-tab').tab('show')
|
2023-02-21 15:29:45 +01:00
|
|
|
updateMinimap(lsentid)
|
|
|
|
|
2023-02-17 10:42:05 +01:00
|
|
|
|
2023-02-06 18:16:01 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-02-21 15:29:45 +01:00
|
|
|
//showMinimap()
|
2023-02-06 18:16:01 +01:00
|
|
|
});
|
|
|
|
|
2023-03-09 12:49:29 +01:00
|
|
|
//manage clauses
|
2023-02-06 18:16:01 +01:00
|
|
|
|
2023-02-21 15:29:45 +01:00
|
|
|
function resetMinimap(sentid){
|
2023-02-24 18:06:26 +01:00
|
|
|
//var iframe = document.getElementsByClassName("minimap__content");
|
2023-02-21 15:29:45 +01:00
|
|
|
|
|
|
|
var iframeDocument = iframe[0].contentDocument || iframe[0].contentWindow.document;
|
|
|
|
if (!iframeDocument) {
|
|
|
|
throw "iframe couldn't be found in DOM.";
|
|
|
|
}
|
|
|
|
var iframeSentence = iframeDocument.getElementsByClassName(sentid);
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-02-06 18:16:01 +01:00
|
|
|
|
|
|
|
|
2023-02-21 15:29:45 +01:00
|
|
|
function updateMinimap(sentid){
|
2023-02-24 18:06:26 +01:00
|
|
|
//var iframe = document.getElementsByClassName("minimap__content");
|
2023-02-06 18:16:01 +01:00
|
|
|
|
2023-02-21 15:29:45 +01:00
|
|
|
var iframeDocument = iframe[0].contentDocument || iframe[0].contentWindow.document;
|
|
|
|
if (!iframeDocument) {
|
|
|
|
throw "iframe couldn't be found in DOM.";
|
|
|
|
}
|
|
|
|
var iframeSentence = iframeDocument.getElementsByClassName(sentid);
|
|
|
|
for (let i = 0; i < iframeSentence.length; i++) {
|
|
|
|
iframeSentence[i].classList.add('font-italic');
|
|
|
|
|
|
|
|
if (selectedVista!='frasi'){
|
|
|
|
var synttp=iframeSentence[i].className.split(" ")[1]
|
|
|
|
iframeSentence[i].style.color = colorssp(mapsynttypestopalette[synttp]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-08 22:19:08 +01:00
|
|
|
}
|