-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavigator.js
40 lines (32 loc) · 998 Bytes
/
navigator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*\
title: $:/plugins/mklauber/aliases/navigator.js
type: application/javascript
module-type: widget-subclass
Widget base class
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.baseClass = "navigator";
exports.constructor = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
exports.prototype = {};
exports.prototype.handleNavigateEvent = function(event) {
event = $tw.hooks.invokeHook("th-navigating",event);
if(event.navigateTo) {
if (!this.wiki.tiddlerExists(event.navigateTo) && event.followAliases == "true") {
var aliases = this.wiki.filterTiddlers("[title["+event.navigateTo+"]listed[aliases]]")
if (aliases.length === 1) {
event.navigateTo = aliases[0];
}
}
this.addToStory(event.navigateTo,event.navigateFromTitle);
if(!event.navigateSuppressNavigation) {
this.addToHistory(event.navigateTo,event.navigateFromClientRect);
}
}
return false;
};
})();