1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

JSHint makes a hard task master...

This commit is contained in:
Jeremy Ruston 2011-12-14 14:11:11 +00:00
parent 5d16050e24
commit 00f8021749
6 changed files with 13 additions and 10 deletions

View File

@ -6,7 +6,7 @@ This is the main() function in the browser
\*/
(function(){
/*jslint node: true */
/*jslint node: true, browser: true */
"use strict";
var WikiStore = require("./WikiStore.js").WikiStore,

View File

@ -31,7 +31,7 @@ Navigators.prototype.install = function(selector,navname) {
this.document.addEventListener("click",function(e) {
var el = e.target,
matchesSelector = el.matchesSelector || el.mozMatchesSelector ||
el.webkitMatchesSelector || el.oMatchesSelector || el.msMatchesSelector
el.webkitMatchesSelector || el.oMatchesSelector || el.msMatchesSelector;
if(matchesSelector && matchesSelector.call(el,selector)) {
var r = nav.navigateTo(el.getAttribute("href"));
if(!r) {

View File

@ -281,7 +281,7 @@ Recipe.tiddlerOutputter = {
out.push("<" + "script type=\"application/javascript\">");
out.push("define(\"" + title + "\",function(require,exports) {");
out.push(tid.fields.text);
out.push("});")
out.push("});");
out.push("</" + "script>");
}
}

View File

@ -6,22 +6,22 @@ This browser component manages navigating to new tiddlers in a TiddlyWiki classi
\*/
(function(){
/*jslint node: true */
/*jslint node: true, jquery: true */
"use strict";
var StoryNavigator = function(navigators) {
this.navigators = navigators;
}
};
StoryNavigator.prototype.navigateTo = function(title) {
var tiddlerHtml = this.navigators.store.renderTiddler("text/html",title);
if(tiddlerHtml) {
$("<div/>").html(tiddlerHtml).appendTo("body");
$("<article/>").html(tiddlerHtml).appendTo("body");
return false;
} else {
return true;
}
}
};
exports.StoryNavigator = StoryNavigator;

View File

@ -58,7 +58,7 @@ Tiddler.standardFields = {
tags: { type: "tags"},
type: { type: "string"},
text: { type: "string"}
}
};
Tiddler.isStandardField = function(name) {
return name in Tiddler.standardFields;

View File

@ -97,10 +97,13 @@ WikiStore.prototype.parseTiddler = function(title) {
}
};
WikiStore.prototype.renderTiddler = function(type,title) {
/*
Render a tiddler to a particular MIME type. Optionally render it with a different tiddler as the context. This option is used to render a tiddler through a template as store.renderTiddler("text/html",tiddler,template)
*/
WikiStore.prototype.renderTiddler = function(type,title,asTitle) {
var parser = this.parseTiddler(title);
if(parser) {
return parser.render(type,parser.children,this,title);
return parser.render(type,parser.children,this,asTitle ? asTitle : title);
} else {
return null;
}