1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-27 14:48:19 +00:00

Change permalink behaviour

Now a link to a single tiddler like http://tiddlywiki.com/#HelloThere
will just open that single tiddler (the old behaviour was to also open
the default tiddlers)
This commit is contained in:
Jermolene 2014-05-28 17:07:41 +01:00
parent 62c602e9d2
commit f7b8813a27

View File

@ -63,7 +63,7 @@ function openStartupTiddlers(options) {
options = options || {};
// Decode the hash portion of our URL
var target,
storyFilter;
storyFilter = null;
if($tw.locationHash.length > 1) {
var hash = $tw.locationHash.substr(1),
split = hash.indexOf(":");
@ -74,13 +74,13 @@ function openStartupTiddlers(options) {
storyFilter = decodeURIComponent(hash.substr(split + 1).trim());
}
}
// Use the story filter specified in the hash, or the default tiddlers
if(!storyFilter || storyFilter === "") {
// If the story wasn't specified use the current tiddlers or a blank story
if(storyFilter === null) {
if(options.defaultToCurrentStory) {
var currStoryList = $tw.wiki.getTiddlerList(DEFAULT_STORY_TITLE);
storyFilter = $tw.utils.stringifyList(currStoryList);
} else {
storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE);
storyFilter = "";
}
}
var storyList = $tw.wiki.filterTiddlers(storyFilter);