1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 11:29:58 +00:00
TiddlyWiki5/js/StoryNavigator.js

33 lines
694 B
JavaScript
Raw Normal View History

/*\
title: js/StoryNavigator.js
This browser component manages navigating to new tiddlers in a TiddlyWiki classic story style
\*/
(function(){
2011-12-14 14:11:11 +00:00
/*jslint node: true, jquery: true */
"use strict";
var StoryNavigator = function(navigators) {
this.navigators = navigators;
2011-12-14 14:11:11 +00:00
};
StoryNavigator.prototype.navigateTo = function(title) {
var tiddlerHtml = this.navigators.store.renderTiddler("text/html","SimpleTemplate",title);
if(tiddlerHtml) {
var article = $("<article/>").html(tiddlerHtml);
article.appendTo("body");
$("html,body").animate({
scrollTop: article.offset().top
}, 400);
return false;
} else {
return true;
}
2011-12-14 14:11:11 +00:00
};
exports.StoryNavigator = StoryNavigator;
})();