1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Fixes for navigation

This commit is contained in:
Jeremy Ruston 2012-10-24 22:50:15 +01:00
parent e88da55683
commit 8d67bcb718
2 changed files with 3 additions and 8 deletions

View File

@ -112,7 +112,6 @@ exports.createListElement = function(title) {
var node = this.createListElementMacro(title),
eventHandler = {handleEvent: function(event) {
// Add context information to the event
event.navigateFromListElement = node;
event.navigateFromTitle = title;
return true;
}};

View File

@ -47,21 +47,17 @@ exports.eventMap["tw-navigate"] = function(event) {
var t,tiddler,slot;
// See if the tiddler is already there
for(t=0; t<this.story.length; t++) {
if(this.story[t].title === event.navigateTo) {
if(this.story[t] === event.navigateTo) {
tiddler = t;
}
}
// If not we need to add it
if(tiddler === undefined) {
// First we try to find the position of the story element we navigated from
var navigateFromTitle;
if(event.navigateFromStoryElement) {
navigateFromTitle = event.navigateFromStoryElement.params.target;
}
slot = 0;
if(navigateFromTitle !== undefined) {
if(event.navigateFromTitle !== undefined) {
for(t=0; t<this.story.length; t++) {
if(this.story[t].title === navigateFromTitle) {
if(this.story[t] === event.navigateFromTitle) {
slot = t + 1;
}
}