change back to how_many, too hard to fix and the inconsistency broke the GUI change
This commit is contained in:
@@ -473,7 +473,7 @@ function getDirEntries(dir_id, back)
|
|||||||
document.entries=res
|
document.entries=res
|
||||||
// rebuild entryList/pageList as each dir comes with new entries
|
// rebuild entryList/pageList as each dir comes with new entries
|
||||||
entryList=res.map(obj => obj.id);
|
entryList=res.map(obj => obj.id);
|
||||||
pageList=entryList.slice(0, OPT.howMany)
|
pageList=entryList.slice(0, OPT.how_many)
|
||||||
if( back )
|
if( back )
|
||||||
document.back_id = res[0].in_dir.eid
|
document.back_id = res[0].in_dir.eid
|
||||||
drawPageOfFigures()
|
drawPageOfFigures()
|
||||||
@@ -539,8 +539,8 @@ function getPage(pageNumber,viewing_idx=0)
|
|||||||
// getting another event before we have the data for the page back
|
// getting another event before we have the data for the page back
|
||||||
$('#la').prop('disabled', true)
|
$('#la').prop('disabled', true)
|
||||||
$('#ra').prop('disabled', true)
|
$('#ra').prop('disabled', true)
|
||||||
const startIndex = (pageNumber - 1) * OPT.howMany;
|
const startIndex = (pageNumber - 1) * OPT.how_many;
|
||||||
const endIndex = startIndex + OPT.howMany;
|
const endIndex = startIndex + OPT.how_many;
|
||||||
pageList = entryList.slice(startIndex, endIndex);
|
pageList = entryList.slice(startIndex, endIndex);
|
||||||
|
|
||||||
// set up data to send to server to get the entry data for entries in pageList
|
// set up data to send to server to get the entry data for entries in pageList
|
||||||
@@ -581,7 +581,7 @@ function isFirstPage(pageNumber)
|
|||||||
// Function to check if we are on the last page
|
// Function to check if we are on the last page
|
||||||
function isLastPage(pageNumber)
|
function isLastPage(pageNumber)
|
||||||
{
|
{
|
||||||
const totalPages = Math.ceil(entryList.length / OPT.howMany);
|
const totalPages = Math.ceil(entryList.length / OPT.how_many);
|
||||||
return pageNumber >= totalPages;
|
return pageNumber >= totalPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +592,7 @@ function getPageNumberForId(id) {
|
|||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
return -1; // or null, if you prefer
|
return -1; // or null, if you prefer
|
||||||
}
|
}
|
||||||
return Math.floor(idx / OPT.howMany) + 1;
|
return Math.floor(idx / OPT.how_many) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are on first page, disable prev, it not ensure next is enabled
|
// if we are on first page, disable prev, it not ensure next is enabled
|
||||||
@@ -618,7 +618,7 @@ function nextPage()
|
|||||||
// should never happen / just return pageList unchanged
|
// should never happen / just return pageList unchanged
|
||||||
if ( currentPage === -1 || isLastPage( currentPage ) )
|
if ( currentPage === -1 || isLastPage( currentPage ) )
|
||||||
{
|
{
|
||||||
console.log( "WARNING: seems first on pg=" + firstEntryOnPage + " of how many=" + OPT.howMany + " gives currentPage=" + currentPage + " and we cant go next page?" )
|
console.error( "WARNING: seems first on pg=" + firstEntryOnPage + " of how many=" + OPT.how_many + " gives currentPage=" + currentPage + " and we cant go next page?" )
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getPage( currentPage+1 )
|
getPage( currentPage+1 )
|
||||||
@@ -634,7 +634,7 @@ function prevPage()
|
|||||||
// should never happen / just return pageList unchanged
|
// should never happen / just return pageList unchanged
|
||||||
if (currentPage === 1 || currentPage === -1 )
|
if (currentPage === 1 || currentPage === -1 )
|
||||||
{
|
{
|
||||||
console.log( "WARNING: seems first on pg=" + firstEntryOnPage + " of how many=" + OPT.howMany + " gives currentPage=" + currentPage + " and we cant go prev page?" )
|
console.error( "WARNING: seems first on pg=" + firstEntryOnPage + " of how many=" + OPT.how_many + " gives currentPage=" + currentPage + " and we cant go prev page?" )
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getPage( currentPage-1 )
|
getPage( currentPage-1 )
|
||||||
|
|||||||
Reference in New Issue
Block a user