This commit is contained in:
cesare 2025-03-19 14:19:17 +01:00
parent 22fbd9371e
commit 0ac771833b
2 changed files with 32 additions and 33 deletions

View File

@ -2320,15 +2320,15 @@ $(document).ready(function() {
if (digits == 2)
spannum.append('\xa0')
spannum.append(num + '. ')*/
var elementoverso = $('<li />')
var elementoverso = $('<li class="f6 mb-0 text-muted text-nowrap font-weight-lighter " value="'+num+'"/>')
/*var elementoversospan=$('<span />')*/
//elementoverso.append(spannum)
elementoverso.attr("value", num)
//elementoverso.attr("value", num)
//elementoverso.attr("style", "line-height: 1.0em")
elementoverso.attr('class', 'f6 mb-0 text-muted text-nowrap font-weight-lighter ')//+cantica+' '+canto)
//elementoverso.attr('class', 'f6 mb-0 text-muted text-nowrap font-weight-lighter ')//+cantica+' '+canto)
//elementoverso.attr('class', 'text-nowrap ')//+cantica+' '+canto)
elementoverso.attr('id', cantica + "_" + canto + "_" + num)
@ -2381,7 +2381,7 @@ $(document).ready(function() {
var canto = "Canto " + i
var cantoRomano = "Canto " + getRoman(i)
var divcanto = $('<div />')
var divcanto = $('<div class="canto pt-3"/>')
var titolocanto = $('<h4 class="titolo-canto pb-2" />')
//titolocanto.append(cantica + ", " + cantoRomano)
var spantitolocanto = $('<span />')
@ -2389,14 +2389,14 @@ $(document).ready(function() {
spantitolocanto.append(cantica + ", " + cantoRomano)
titolocanto.append(spantitolocanto)
divcanto.attr('class', 'canto pt-3')
//divcanto.attr('class', 'canto pt-3')
divcanto.css("display", "none")
divcanto.attr('id', (cantica + canto).replace(" ", "_"))
titolocanto.appendTo(divcanto)
//nuovo
var olversi = $('<ol />')
olversi.attr('class', 'pb-4 pr-4')
var olversi = $('<ol class="pb-4 pr-4"/>')
//olversi.attr('class', 'pb-4 pr-4')
olversi.appendTo(divcanto)
//fine nuovo
divcanto.appendTo('#displaycanto')

View File

@ -217,67 +217,66 @@ function getFraseContext(fraseids, numversi = 3) {
var mainid = fraseid.split('-')[0]
var cantica = mainid.split('_')[0]
var offset = parseInt(fraseid.split('-')[2]);
var idnum=parseInt(fraseid.split('-')[2])
var offset = idnum;
if (cantica == '2') {
offset = parseInt(fraseid.split('-')[2]) - 33374
offset = idnum - 33374
listaforme = formeseconda;
console.log(listaforme.length)
}
if (cantica == '3') {
offset = parseInt(fraseid.split('-')[2]) - 66588
offset = idnum - 66588
listaforme = formeterza;
}
var maxpos = listaforme.length - 1
//var maxpos = listaforme.length - 1
var pos = 0
var startindex = Math.max(0, (offset - 30))
var startindex = Math.max(0, (offset - 28))
for (i = startindex; i < listaforme.length; i++) {
var tmpos = listaforme[i].split('_')[2]
if (parseInt(tmpos) == parseInt(fraseid.split('-')[2])) {
if (parseInt(tmpos) == idnum) {
pos = i;
break;
}
}
console.log(fraseid + " - " + parseInt(fraseid.split('-')[2]) + ' - ' + pos)
//console.log(fraseid + " - " + parseInt(fraseid.split('-')[2]) + ' - ' + pos)
var pos2 = pos
if (fraseids.length > 1)
lastfraseid = fraseids[fraseids.length - 1]
else
lastfraseid = fraseids[0]
//una frase può avre più frammenti, prendo l'ultimo'
lastfraseid= fraseids.at(-1)
var th=parseInt(lastfraseid.split('-')[3])
for (j = pos; j < listaforme.length; j++) {
var tmpos2 = listaforme[j].split('_')[2]
if (parseInt(tmpos2) == parseInt(lastfraseid.split('-')[3])) {
if (parseInt(tmpos2) == th) {
pos2 = j;
break;
}
}
var minpos = 0;
//var minpos = 0;
var limitv = Math.max((numversi), 3)
var item = listaforme[pos].split('_');
var numverso = item[3]
var numverso = parseInt(item[3])
var spannum = (4 * limitv)
var contextinf = Math.max(minpos, parseInt(pos) - spannum)
var contextsup = Math.min(maxpos, parseInt(pos2) + spannum)
var contextinf = Math.max(0, (pos - spannum))
var contextsup = Math.min((listaforme.length - 1), (pos2 + spannum))
/*var contextinf = parseInt(fraseid.split('-')[2])
var contextsup = parseInt(fraseid.split('-')[3])*/
for (j = contextinf; j < contextsup + 1; j++) {
var tmpform = listaforme[j].split('_');
if ((tmpform[3] > parseInt(numverso) - limitv) && (tmpform[3] < parseInt(numverso) + limitv)) {
if ((parseInt(tmpform[3]) > (numverso - limitv)) && (parseInt(tmpform[3]) < (numverso + limitv))) {
var contextitem = {}
contextitem['testo'] = tmpform[0];
contextitem['verso'] = tmpform[3];
contextitem['canto'] = tmpform[1];
contextitem['cantica'] = cantica - 1;
contextitem['cantica'] = parseInt(cantica) - 1;
contextitem['posizione'] = tmpform[2];
contextitem['catg'] = tmpform[4];
contextitem['periodo'] = cantica + '_' + tmpform[1] + '_s_' + tmpform[5];
@ -324,7 +323,7 @@ function getContextLastPosition(formaid, numversi = 3) {
var spannum = (11 * limitv)
var contextsup = Math.min(maxpos, parseInt(pos) + spannum)
var contextsup = Math.min(maxpos, (pos + spannum))
var tmpform = listaforme[contextsup].split('_');
return (parseInt(tmpform[2]))
@ -378,14 +377,14 @@ function getFormaContext(formaid, numversi = 3) {
var item = listaforme[pos].split('_');
var numverso = item[3]
var numverso = parseInt(item[3])
var spannum = (11 * limitv)
var contextinf = Math.max(minpos, parseInt(pos) - spannum)
var contextsup = Math.min(maxpos, parseInt(pos) + spannum)
for (j = contextinf; j < contextsup + 1; j++) {
var tmpform = listaforme[j].split('_');
if ((tmpform[3] > parseInt(numverso) - limitv) && (tmpform[3] < parseInt(numverso) + limitv)) {
if ((parseInt(tmpform[3]) > (numverso - limitv)) && (parseInt(tmpform[3]) < (numverso + limitv))) {
var contextitem = {}
contextitem['testo'] = tmpform[0];
contextitem['verso'] = tmpform[3];
@ -393,7 +392,7 @@ function getFormaContext(formaid, numversi = 3) {
contextitem['cantica'] = cantica;
contextitem['posizione'] = tmpform[2];
contextitem['catg'] = tmpform[4];
contextitem['periodo'] = (parseInt(cantica) + 1) + '_' + tmpform[1] + '_s_' + tmpform[5];
contextitem['periodo'] = (cantica + 1) + '_' + tmpform[1] + '_s_' + tmpform[5];
contextitem['funzperiodo'] = tmpform[6];
context.push(contextitem);
}