From fe9322e23cd113ef3362d132d8117901ca402683 Mon Sep 17 00:00:00 2001 From: cesare Date: Fri, 31 Jan 2025 17:01:27 +0100 Subject: [PATCH] rif, in progress --- js/browseMgr_5.0.js | 19 ++++++++++++++----- js/dataMgr.js | 29 ++++++++++++++++------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/js/browseMgr_5.0.js b/js/browseMgr_5.0.js index 725a2a7..058b5fd 100644 --- a/js/browseMgr_5.0.js +++ b/js/browseMgr_5.0.js @@ -1,7 +1,7 @@ /** * */ -import { getVersiConCitazioni, queryRiferimenti, getListaRis} from './dataMgr.js'; +import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis} from './dataMgr.js'; import { getJsonQuery, emptyStructCard } from './script_5.0.js'; import {resetGraphStr} from './syntgraph_5.0.js' @@ -554,7 +554,10 @@ $(document).ready(function() { //$("#" + $(this).attr('name').replace(" ", "_")).css("display", "block"); $("#" + $(this).attr('name').replace(" ", "_")).attr('style', 'display: d-flex;') - + var telive=getListaRis() + for (var tel of telive){ + $(tel).addClass("mark ") + } drawMinimap("#" + $(this).attr('name').replace(" ", "_"), false) @@ -908,7 +911,7 @@ $(document).ready(function() { } drawMinimap("#" + idminimap, false) - console.log (commentsSQL) + //console.log (commentsSQL) } @@ -1492,10 +1495,12 @@ $(document).ready(function() { var telive=getListaRis() for (var ve of telive) { let idve = ve - $(ve).removeClass("font-weight-bold mark ") - minim.contents().find(ve).removeClass("font-weight-bold mark ") + $(ve).removeClass("mark ") + minim.contents().find(ve).removeClass("mark ") } + cleanListaRis() drawMinimap(cantoDisplayed, true) + } /*function manageMM(name) { @@ -1719,6 +1724,10 @@ $(document).ready(function() { } } + /*var telive=getListaRis() + for (var tel of telive){ + $(tel).addClass("mark ") + }*/ } diff --git a/js/dataMgr.js b/js/dataMgr.js index 365e6f1..985a0d6 100644 --- a/js/dataMgr.js +++ b/js/dataMgr.js @@ -59,14 +59,6 @@ rif_commentatori = result2.map((x) => x['Com']); -/*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; `); @@ -76,7 +68,7 @@ rif_areetematiche = result3.map((x) => x['CA']); var table1 = await conn.query(` - select distinct TiFo from riferimenti; + select distinct TiFo from riferimenti order by TiFo COLLATE NOCASE; `); const result4 = table1.toArray().map((row) => row.toJSON()); rif_fonti = result4.map((x) => x['TiFo']); @@ -88,6 +80,9 @@ console.log('done') export function getListaRis(){ return listaidversi; } +export function cleanListaRis(){ + listaidversi=[]; +} export function getFontiS() { return rif_fonti @@ -148,14 +143,22 @@ export async function queryRiferimenti(filtro, cid) { queryfi += "Com like '%'" if (filtro.Autore_Fonte != null && filtro.Autore_Fonte.trim() != 'all') queryfi += " and Aut='" + filtro.Autore_Fonte.trim() + "'" - + if (filtro.Fonte != null && filtro.Fonte.trim() != 'all') + queryfi += " and TiFo='" + filtro.Fonte.trim() + "'" + + if (filtro.Area_Tematica != null && filtro.Area_Tematica.trim() != 'all') + queryfi += " and CA='" + filtro.Area_Tematica.trim() + "'" + + if (filtro.Tipo_Riferimento != null && filtro.Tipo_Riferimento.trim() != 'all') + queryfi += " and NaRi='" + filtro.Tipo_Riferimento.trim().toUpperCase() + "'" + var rs = await tconn.query(querytl + queryfi) var result4 = rs.toArray().map((row) => row.toJSON()); await tconn.close(); var resxcantica = Object.groupBy(result4, ({ Cantica }) => Cantica); - + listaidversi=[] var numcid = cid.split('_')[1] for (var cantica in resxcantica) { var $nctags = $(' .navig-canto') @@ -183,10 +186,10 @@ export async function queryRiferimenti(filtro, cid) { spanbadge.appendTo($nctags.filter('[name="' + cantica + 'Canto ' + canto + '"]')) for (const tmpvi of tmpv) { let myveid = '#' + cantica + '_Canto_' + canto + '_' + tmpvi.Verso.split('-')[0] - console.log(myveid) + //console.log(myveid) listaidversi.push(myveid) if (cid.includes(cantica) && numcid == canto) - $(myveid).addClass("font-weight-bold mark ") + $(myveid).addClass("mark ") } }