Skip to content
Snippets Groups Projects
Commit e7563297 authored by Arkerthan's avatar Arkerthan
Browse files

fix history not recording initial passage

parent d3f6f5ff
No related branches found
No related tags found
1 merge request!6816basic implementation for history and auto generated quick links
...@@ -61,18 +61,17 @@ App.UI.quickMenu = (function() { ...@@ -61,18 +61,17 @@ App.UI.quickMenu = (function() {
// setup history // setup history
let history = []; let history = [];
let currentPassage;
let historyNavigation = false; let historyNavigation = false;
$(document).on(':passageinit', event => { $(document).on(':passageinit', event => {
// if navigated here normally, add passage to history, otherwise remove last entry from history // if navigated here normally, add passage to history, otherwise remove last entry from history
if (!historyNavigation) { if (!historyNavigation) {
if (currentPassage === event.passage.title) { if (State.passage === event.passage.title) {
// only reloaded passage // only reloaded passage
return; return;
} }
// if last passage can be jumped to add passage to history, otherwise clear history // if last passage can be jumped to add passage to history, otherwise clear history
if (jumpTo.includes(currentPassage)) { if (jumpTo.includes(State.passage)) {
history.push(currentPassage); history.unshift(State.passage);
} else { } else {
history = []; history = [];
} }
...@@ -80,7 +79,6 @@ App.UI.quickMenu = (function() { ...@@ -80,7 +79,6 @@ App.UI.quickMenu = (function() {
historyNavigation = false; historyNavigation = false;
history.shift(); history.shift();
} }
currentPassage = event.passage.title;
}); });
Mousetrap.bind("backspace", () => { Mousetrap.bind("backspace", () => {
// jump back in history // jump back in history
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment