modificate funzione per contesto ris

This commit is contained in:
cesare 2023-02-15 16:57:19 +01:00
parent c7d151f27f
commit d363bdd92d
1 changed files with 12 additions and 6 deletions

View File

@ -275,11 +275,10 @@ function getFormaContext(formaid, numversi=3) {
var cantica = 1;
var listaforme = formeprima;
var minpos = 0;
var limitv = numversi-1
var limitv = Math.max((numversi-1),2)
var maxpos = 0;
if (limitv<1)
limitv=2
if (parseInt(formaid) > 33373 && parseInt(formaid) < 66588) {
listaforme = formeseconda;
@ -300,6 +299,7 @@ function getFormaContext(formaid, numversi=3) {
maxpos = listaforme.length - 1
var pos = 0
/*
for (i=0; i<listaforme.length; i++){
var tmpos=listaforme[i].split('_')[2]
if (tmpos==formaid){
@ -307,11 +307,17 @@ function getFormaContext(formaid, numversi=3) {
break;
}
}
*/
for (const [index, element] of listaforme.entries()) {
if(element.split('_')[2]==formaid){
pos=index;
break;
}
}
var item = listaforme[pos].split('_');
var numverso = item[3]
//var forma=item[0]
//var canto=item[1]
var spannum=(12*limitv)
var spannum=(11*limitv)
var contextinf = Math.max(minpos, parseInt(pos) - spannum)
var contextsup = Math.min(maxpos, parseInt(pos) + spannum)