nuovo data manager, in progress
This commit is contained in:
parent
93f8b57af0
commit
f80d916c34
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@ var rif_commentatori=[];
|
|||
var rif_autori=[];
|
||||
var rif_areetematiche=[];
|
||||
|
||||
|
||||
const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();
|
||||
|
||||
// Select a bundle based on browser checks
|
||||
|
@ -36,33 +37,79 @@ const conn = await db.connect();
|
|||
await conn.query(`
|
||||
CREATE TABLE riferimenti AS
|
||||
SELECT * FROM "https://lida.dantenetwork.it/js/data/riferimenti_3.parquet";
|
||||
CREATE table commentatori as select distinct Com from riferimenti;
|
||||
CREATE table autori as select distinct Aut from riferimenti order by Aut;
|
||||
Create table areatematica as select distinct CA from riferimenti order by CA;
|
||||
`);
|
||||
|
||||
var table=await conn.query(`
|
||||
SELECT * FROM autori
|
||||
select distinct Aut from riferimenti order by Aut COLLATE NOCASE;
|
||||
`);
|
||||
const result = table.toArray().map((row) => row.toJSON());
|
||||
rif_autori=result.map((x) => x['Aut']);
|
||||
console.log(rif_autori)
|
||||
await conn.close();
|
||||
const conn2 = await db.connect();
|
||||
var table=await conn2.query(`
|
||||
SELECT * FROM commentatori
|
||||
//console.log(rif_autori)
|
||||
|
||||
|
||||
var table=await conn.query(`
|
||||
select distinct Com from riferimenti;
|
||||
`);
|
||||
const result2 = table.toArray().map((row) => row.toJSON());
|
||||
rif_commentatori=result2.map((x) => x['Com']);;
|
||||
console.log(rif_commentatori)
|
||||
rif_commentatori=result2.map((x) => x['Com']);
|
||||
|
||||
var table=await conn2.query(`
|
||||
SELECT * FROM areatematica
|
||||
/*rif_commentatori.sort((a, b) => {
|
||||
var sre= (a.replace(/^\D+/g, '')-b.replace(/^\D+/g, ''))
|
||||
console.log(sre)
|
||||
return sre
|
||||
})*/
|
||||
//console.log(rif_commentatori)
|
||||
|
||||
|
||||
var table=await conn.query(`
|
||||
select distinct CA from riferimenti order by CA;
|
||||
`);
|
||||
const result3 = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
rif_areetematiche= result3.map((x) => x['CA']);
|
||||
console.log(rif_areetematiche)
|
||||
await conn2.close();
|
||||
//console.log(rif_areetematiche)
|
||||
await conn.close();
|
||||
|
||||
console.log('done')
|
||||
|
||||
export function getAreeTematicheS() {
|
||||
|
||||
return rif_areetematiche
|
||||
}
|
||||
|
||||
export function getAutoriFontiCitazioniS() {
|
||||
|
||||
return rif_autori
|
||||
}
|
||||
|
||||
export function getCommentatoriS() {
|
||||
|
||||
return rif_commentatori
|
||||
}
|
||||
|
||||
export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
||||
|
||||
let citcantiche = ['Inferno', 'Purgatorio', 'Paradiso']
|
||||
if (canticapar == '') {
|
||||
return
|
||||
}
|
||||
const tconn = await db.connect();
|
||||
var table=await tconn.query(`
|
||||
select Ann as Annotazione, Com as Commentario, FrN as frammentoNota, AC as AutoreCitazione,
|
||||
F as FonteCitazione, LF as LuogoFonteCitazione, NF as NotaFonteCitazione,
|
||||
TF as TestoFonteCitazione, UF as URLFonteCitazione, NaRi as NaturaRiferimento,
|
||||
RCC as RapportoCommentoCommentatoreText, RSO as RapportoSoggettoOggetto,
|
||||
Aut as NomeAutoreCitazione, TiFo as TitoloFonteCitazione, Verso as VersoCitazione, CA as AreaTematica,
|
||||
TiCi as TipoCitazione, CEP as CitEpisodi, CIM as CitImmagini, CTE as CitTeorie,
|
||||
CMO as CitMotivi, CST as CitStilemi, CTO as CitTopografie
|
||||
from riferimenti
|
||||
where Cantica='${canticapar}' and Canto='${cantopar}' order by verso;
|
||||
`);
|
||||
|
||||
var result4 = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
|
||||
await tconn.close();
|
||||
return result4
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ const displayminimapId = '#displayminimap';
|
|||
const visCantoClass = '.visCanto';
|
||||
const fillerClass = '.filler';
|
||||
const bodyScript = '<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script> <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>'
|
||||
const cssTableMainHeight = 0.95;
|
||||
|
||||
let minimap = document.createElement('div');
|
||||
let viewer = document.createElement('div');
|
||||
|
@ -21,7 +22,7 @@ let scrollCorrectionFactor = 0.997;
|
|||
|
||||
|
||||
function drawMinimap(name, onlyContent = false, cantoOffset = 0){
|
||||
var cantoHeightToSet = $("body")[0].clientHeight*cssCantoHeight;
|
||||
//var cantoHeightToSet = $("body")[0].clientHeight*cssCantoHeight;
|
||||
var maxCantoHeightToSet = $("body")[0].clientHeight*cssTableMainHeight-110; // 63 padding top + 47 margine bottom
|
||||
$(visCantoClass).css("max-height", maxCantoHeightToSet);
|
||||
$(displayCantoId).css("max-height", maxCantoHeightToSet);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
/*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";*/
|
||||
import {Runtime, Library, Inspector} from "https://lida.dantenetwork.it/node_modules/commarcdiag/runtime.js";
|
||||
import commarc from "https://lida.dantenetwork.it/node_modules/commarcdiag/index.js";
|
||||
import {formaClass, lisid, lsentid, vistaPeriodi, listaPeriodiRisultato, listaClausoleRisultato} from "./browseMgr_5.0.js"
|
||||
import { fillStructCard, emptyStructCard } from "./script_5.0.mod.js";
|
||||
|
||||
const iframe = document.getElementsByClassName("minimap__content");
|
||||
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){
|
||||
|
||||
|
||||
if(resetGraphStr())
|
||||
return
|
||||
|
||||
var hcontainer="#structCard0"
|
||||
|
||||
var main=runtime1.module(commarc, name => {
|
||||
|
||||
//if (name === "sentenceStructArcs_new") {
|
||||
if (name === "sentenceArcsStructs_new") {
|
||||
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));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (lisid!=''){
|
||||
//var mywidth=document.getElementById('displaycanto').offsetWidth
|
||||
|
||||
console.log('here graph '+lisid+' '+lsentid)
|
||||
|
||||
|
||||
main.redefine('width', 625);
|
||||
main.redefine("lisid", lisid);
|
||||
const structel = document.getElementsByClassName(lsentid);
|
||||
|
||||
var stid=lsentid.split('_')
|
||||
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');
|
||||
if (!vistaPeriodi){
|
||||
var synttp=collection[i].className.split(" ")[1]
|
||||
collection[i].style.color = colorssp(mapsynttypestopalette[synttp]);
|
||||
}
|
||||
|
||||
//collection[i].style.removeProperty('color');
|
||||
}
|
||||
$('#tab-list #vis1-tab').tab('show')
|
||||
updateMinimap(lsentid)
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
return
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*function resetMinimap(sentid){
|
||||
//var 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(sentid);
|
||||
for (let i = 0; i < iframeSentence.length; i++) {
|
||||
iframeSentence[i].classList.remove('font-italic');
|
||||
if (!vistaPeriodi)
|
||||
iframeSentence[i].style.removeProperty('color');
|
||||
|
||||
iframeSentence[i].classList.remove('font-weight-normal');
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
function updateMinimap(sentid){
|
||||
//var 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(sentid);
|
||||
for (let i = 0; i < iframeSentence.length; i++) {
|
||||
iframeSentence[i].classList.add('font-italic');
|
||||
|
||||
if (!vistaPeriodi){
|
||||
var synttp=iframeSentence[i].className.split(" ")[1]
|
||||
iframeSentence[i].style.color = colorssp(mapsynttypestopalette[synttp]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export function resetGraphStr(){
|
||||
|
||||
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 (!vistaPeriodi && !listaPeriodiRisultato.includes(tmpsent)
|
||||
&& listaClausoleRisultato.filter(cl => cl.split('-')[0]==tmpsent).length==0)
|
||||
sentence[i].style.removeProperty('color');
|
||||
|
||||
sentence[i].classList.remove('font-weight-normal');
|
||||
|
||||
}
|
||||
|
||||
//reset Minimap
|
||||
var iframeDocument = myiframe[0].contentDocument || myiframe[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 (!vistaPeriodi)
|
||||
iframeSentence[i].style.removeProperty('color');
|
||||
|
||||
iframeSentence[i].classList.remove('font-weight-normal');
|
||||
}
|
||||
//EMPTY CARD
|
||||
emptyStructCard()
|
||||
|
||||
if (tmpsent == lsentid) {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue