diff --git a/main.js b/main.js index eca43a4..5f663d9 100644 --- a/main.js +++ b/main.js @@ -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); } }