From cc767c97356353b2f949f934afac1bb7b867fe84 Mon Sep 17 00:00:00 2001 From: cesare Date: Fri, 16 Dec 2022 11:55:34 +0100 Subject: [PATCH] modfica funzioni caricamento iniziale --- js/cesareBrowse.js | 110 ++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 0cc2cf4..d22a29c 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -306,12 +306,18 @@ $(document).ready(function() { containerForme = formeseconda const endlc = performance.now(); console.log(`Load `+cantica+` time: ${endlc - start} ms`); - for (cmpItem of containerForme) { + for (var cmpItem of containerForme) { formaItem = cmpItem.split("_") - //listaCanti = createDivCanti(listaCanti, cantica, 'Canto ' + formaItem[1]) - //var forma = new Object() - setVersi = createDivVersi(setVersi, cantica, formaItem[3], 'Canto_' + formaItem[1]) - createSpanFormeNew(cantica, 'Canto_' + formaItem[1], formaItem[3], formaItem[0], formaItem[4], formaItem[2]) + //createDivVerso(cantica, num, canto, forma, catgram, pos) + if (! setVersi.has(cantica + "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1])){ + createDivVerso(cantica, formaItem[3], 'Canto_' + formaItem[1], formaItem[0], formaItem[4], formaItem[2]) + setVersi.add(cantica+ "_" + formaItem[3] + "_" + 'Canto_' + formaItem[1]) + } + else{ + //setVersi = createDivVersi(setVersi, cantica, formaItem[3], 'Canto_' + formaItem[1]) + createSpanFormeNew(cantica, 'Canto_' + formaItem[1], formaItem[3], formaItem[0], formaItem[4], formaItem[2]) + } + /* forma.numverso = formaItem[3]; forma.canto = 'Canto ' + formaItem[1]; @@ -374,6 +380,28 @@ $(document).ready(function() { } } + function createDivVerso(cantica, num, canto, forma, catgram, pos) { + + var elementoverso = $('

') + + elementoverso.append(num + ". ") + elementoverso.attr("style", "line-height: 0.5em") + + elementoverso.attr('class', 'f6 text-secondary text-nowrap font-weight-lighter') + + elementoverso.attr('id', cantica + "_" + canto + "_" + num) + + var spanoccorrenza = $('') + var pos = parseInt(pos) + spanoccorrenza.attr('id', cantica + "_" + canto+ "_" + num + "_" + pos) + spanoccorrenza.attr('data-cg', catgram) + + spanoccorrenza.append(forma+" ") + spanoccorrenza.appendTo(elementoverso) + + elementoverso.appendTo('#' + cantica + canto) + + } /* function createDivCanti(orderedListaCanti, cantica, canto) { if (orderedListaCanti.has(canto)) { @@ -523,41 +551,41 @@ coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){ case(3): return ' Terza coniugazione'; case(4): return ' Ausiliare essere' case(5): return ' Ausiliare avere'}} -modotempo=modo:"ip" {return('Presente indicativo')}/ - "ib" {return("Passato Prossimo Indicativo")}/ - "ii" {return("Imperfetto Indicativo")}/ - "ir" {return("Passato Remoto Indicativo")}/ - "is" {return( "Trapassato Prossimo Indicativo")}/ - "it" {return( "Trapassato Remoto Indicativo")}/ - "if" {return("Futuro Semplice Indicativo")}/ - "ia" {return("Futuro Anteriore Indicativo")}/ - "cp" {return( "Presente Congiuntivo")}/ - "ci" {return( "Imperfetto Congiuntivo")}/ - "cr" {return( "Passato Congiuntivo")}/ - "ct" {return( "Trapassato Congiuntivo")}/ - "dp" {return( "Presente Condizionale")}/ - "dr" {return( "Passato Condizionale")}/ - "mp" {return( "Presente Imperativo")}/ - "fp" {return( "Presente Infinito")}/ - "fr" {return( "Passato Infinito")}/ - "pp" {return( "Presente Participio")}/ - "pr" {return( "Passato Participio")}/ - "gp" {return( "Presente Gerundio")}/ - "gr" {return( "Passato Gerundio")}/ - "pf" {return( "Participio Futuro")} -persona="s1" {return('Prima persona singolare')}/ - "s2" {return('Seconda persona singolare')}/ - "s3" {return('Terza persona singolare')}/ - "p1" {return('Prima persona plurale')}/ - "p2" {return('Seconda persona plurale')}/ - "p3" {return('Terza persona plurale')} +modotempo=modo:"ip" {return(' Presente indicativo')}/ + "ib" {return(" Passato Prossimo Indicativo")}/ + "ii" {return(" Imperfetto Indicativo")}/ + "ir" {return(" Passato Remoto Indicativo")}/ + "is" {return( " Trapassato Prossimo Indicativo")}/ + "it" {return( " Trapassato Remoto Indicativo")}/ + "if" {return(" Futuro Semplice Indicativo")}/ + "ia" {return(" Futuro Anteriore Indicativo")}/ + "cp" {return( " Presente Congiuntivo")}/ + "ci" {return( " Imperfetto Congiuntivo")}/ + "cr" {return( " Passato Congiuntivo")}/ + "ct" {return( " Trapassato Congiuntivo")}/ + "dp" {return( " Presente Condizionale")}/ + "dr" {return( " Passato Condizionale")}/ + "mp" {return( " Presente Imperativo")}/ + "fp" {return( " Presente Infinito")}/ + "fr" {return( " Passato Infinito")}/ + "pp" {return( " Presente Participio")}/ + "pr" {return( " Passato Participio")}/ + "gp" {return( " Presente Gerundio")}/ + "gr" {return( " Passato Gerundio")}/ + "pf" {return( " Participio Futuro")} +persona="s1" {return(' Prima persona singolare')}/ + "s2" {return(' Seconda persona singolare')}/ + "s3" {return(' Terza persona singolare')}/ + "p1" {return(' Prima persona plurale')}/ + "p2" {return(' Seconda persona plurale')}/ + "p3" {return(' Terza persona plurale')} -funzione="a" {return('Verbo Funzione Aggettivo')}/ - "sm" {return('Verbo Funzione Sostantivo maschile')}/ - "sf" {return('Verbo Funzione Sostantivo femminile')}/ - "b" {return('Verbo Funzione Avverbio')}/ - "l" {return('Verbo Funzione Locuzione')} +funzione="a" {return(' Verbo Funzione Aggettivo')}/ + "sm" {return(' Verbo Funzione Sostantivo maschile')}/ + "sf" {return(' Verbo Funzione Sostantivo femminile')}/ + "b" {return(' Verbo Funzione Avverbio')}/ + "l" {return(' Verbo Funzione Locuzione')} declinazione=[1|2|3|4|5] {switch(parseInt(text())){ @@ -571,9 +599,9 @@ genere=[f|m] {if (text()=='f') return ' Femminile'; else if (text()=='m') return numero=[s|p] {if (text()=='s') return ' Singolare'; else if (text()=='p') return ' Plurale';} -grado="c+" {return('Grado c+ singolare')}/ - "c-" {return('Grado c-')}/ - "c=" {return('Grado c=')} +grado="c+" {return(' Grado c+ singolare')}/ + "c-" {return(' Grado c-')}/ + "c=" {return(' Grado c=')} Integer "integer" = _ [0-9]+ { return parseInt(text(), 10); }