diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js
index 6d411d5..3477664 100644
--- a/js/cesareBrowse.js
+++ b/js/cesareBrowse.js
@@ -651,8 +651,11 @@ $(" ."+formaClass).hover(function(idx, element) {
const callerid=$(this).attr('id');
if (callerid!=null && callerid.startsWith(idCitazione)){
const mypos=callerid.split('_')[2]
+ latestPhraseId = callerid.split('_')[0].replace("citazione", "")+callerid.split('_')[1];
$("#collapse"+parcid[0].replace("Canto", "")).collapse('show');
- document.getElementById(mypos).scrollIntoView();
+ document.getElementById(mypos).scrollIntoView({
+ behavior: "smooth",
+ });
}
diff --git a/js/script_4.2.js b/js/script_4.2.js
index 4c09a05..0bb332a 100644
--- a/js/script_4.2.js
+++ b/js/script_4.2.js
@@ -5,6 +5,7 @@
var getJsonQuery;
var currStyle = "style1";
var currPage = 0;
+var latestPhraseId = "";
var numeroPagine = 0;
$(document).ready(function() {
@@ -183,54 +184,8 @@ $(document).ready(function() {
$("#displaycanto").width(" min-content");
}
});
-
-/**
- $.jqPaginator('#listPagination', {
- wrapper: '',
- //first: '
',
- prev: '',
- next: '',
- //last: '',
- //page: 'Pag. {{page}}/{{totalPages}}',
- page: '\
- ',
- totalPages: 0,
- totalCounts: 25,
- pageSize: 25,
- currentPage: 1,
- visiblePages: 1,
- onPageChange: function (num, type) {
- console.log("Page num: "+num+" type: "+type)
- console.log("listarisultati: "+ listarisultati.length);
- console.log($("#paginaLista option:selected").val());
- //$('#text').html('当前第' + num + '页');
- $("#paginaLista option:selected").val(num).change();
- }
- });
-
- $('#collapseZero').on('shown.bs.collapse', function () {
- var numeroPagine = Math.ceil(listarisultati.length/nRisultatiPerPag);
- var pageDef = '\
- ';
- $('#listPagination').jqPaginator('option', {
- totalCounts: listarisultati.length,
- pageSize: nRisultatiPerPag,
- page: pageDef,
- });
- //$("#paginaLista option:not(:first)").remove();
- console.log("numeroPagine: "+ Math.ceil(listarisultati.length/nRisultatiPerPag));
- //$("#showLogic").html('Nascondi');
- //$("#collapseZero").collapse('hide');
- showFrasi(0, nRisultatiPerPag);
- })
-
-*/
+ // Funzioni di gestione dei bottoni di paginazione
$('#collapseZero').on('shown.bs.collapse', function () {
managePage();
});
@@ -1363,9 +1318,9 @@ $(document).ready(function() {
};
function managePage() {
- console.log ("currPage: " + currPage);
if (currPage == 0){
- numeroPagine = Math.ceil(listarisultati.length/nRisultatiPerPag);
+ //numeroPagine = Math.ceil(listarisultati.length/nRisultatiPerPag);
+ numeroPagine = Math.ceil(numeroContesti/nRisultatiPerPag);
$("#paginaLista option").remove();
for (let i = 1; i <= numeroPagine; i++) {
$('#paginaLista').append(``);
@@ -1397,6 +1352,12 @@ $(document).ready(function() {
};
};
$.manageResultList((currPage-1)*nRisultatiPerPag, nRisultatiPerPag);
+ if (latestPhraseId != "") {
+ document.getElementById(latestPhraseId).scrollIntoView({
+ behavior: "smooth",
+ });
+ latestPhraseId = "";
+ }
};
});