fix load previous and next

This commit is contained in:
quenousimporte 2024-02-07 21:52:25 +01:00
parent 901e0aa812
commit 7edb42ef83
1 changed files with 7 additions and 6 deletions

13
main.js
View File

@ -1532,20 +1532,21 @@ function loadlast()
function loadprevious()
{
//var list = sortedlist();
var index = localdata.indexOf(currentnote);
if (index > -1 && index < localdata.length - 1)
var list = sortedlist();
var index = list.findIndex(i => i.title == title.value);
if (index > -1 && index < list.length - 1)
{
loadnote(localdata[index + 1].title);
loadnote(list[index + 1].title);
}
}
function loadnext()
{
var index = localdata.indexOf(currentnote);
var list = sortedlist();
var index = list.findIndex(i => i.title == title.value);
if (index > -1 && index > 0)
{
loadnote(localdata[index - 1].title);
loadnote(list[index - 1].title);
}
}