Implementato ritormo alla citazione

This commit is contained in:
Luca Trupiano 2023-03-16 16:14:16 +01:00
parent 854597b30a
commit c21891d5cd
2 changed files with 14 additions and 50 deletions

View File

@ -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",
});
}

View File

@ -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: '<li class="page-item first"><a class="page-link" href="javascript:;"><ion-icon name="arrow-undo-sharp"></ion-icon></a></li>',
prev: '<li class="page-item prev"><a class="page-link p-1" href="javascript:;"><ion-icon name="caret-back-sharp"></ion-icon></a></li>',
next: '<li class="page-item next"><a class="page-link p-1" href="javascript:;"><ion-icon name="caret-forward-sharp"></ion-icon></a></li>',
//last: '<li class="page-item last"><a class="page-link" href="javascript:;"><ion-icon name="arrow-redo-sharp"></ion-icon></a></li>',
//page: '<li class="page-item page"><a class="page-link" href="javascript:;">Pag. {{page}}/{{totalPages}}</a></li>',
page: '<li class="page-item page"><a class="page-link p-0" href="javascript:;">\
<select class="custom-select custom-select-sm bg-light border-0" id="paginaLista">\
<option value="1">1/{{totalPages}}</option></select></a></li>',
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 = '<li class="page-item page"><a class="page-link p-0" href="javascript:;">\
<select class="custom-select custom-select-sm bg-light border-0" id="paginaLista2">'
for (let i = 1; i <= numeroPagine; i++) {
pageDef = pageDef + '<option value="'+i+'">'+i+'/'+numeroPagine+'</option>'
}
pageDef = pageDef + '</select></a></li>';
$('#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('<span class="font-weight-bold text-muted">Nascondi</span>');
//$("#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(`<option value="${i}">${i+'/'+numeroPagine}</option>`);
@ -1397,6 +1352,12 @@ $(document).ready(function() {
};
};
$.manageResultList((currPage-1)*nRisultatiPerPag, nRisultatiPerPag);
if (latestPhraseId != "") {
document.getElementById(latestPhraseId).scrollIntoView({
behavior: "smooth",
});
latestPhraseId = "";
}
};
});