mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 14:23:53 +00:00
JSHint makes a hard task master...
This commit is contained in:
parent
5d16050e24
commit
00f8021749
@ -6,7 +6,7 @@ This is the main() function in the browser
|
|||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
/*jslint node: true */
|
/*jslint node: true, browser: true */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var WikiStore = require("./WikiStore.js").WikiStore,
|
var WikiStore = require("./WikiStore.js").WikiStore,
|
||||||
|
@ -31,7 +31,7 @@ Navigators.prototype.install = function(selector,navname) {
|
|||||||
this.document.addEventListener("click",function(e) {
|
this.document.addEventListener("click",function(e) {
|
||||||
var el = e.target,
|
var el = e.target,
|
||||||
matchesSelector = el.matchesSelector || el.mozMatchesSelector ||
|
matchesSelector = el.matchesSelector || el.mozMatchesSelector ||
|
||||||
el.webkitMatchesSelector || el.oMatchesSelector || el.msMatchesSelector
|
el.webkitMatchesSelector || el.oMatchesSelector || el.msMatchesSelector;
|
||||||
if(matchesSelector && matchesSelector.call(el,selector)) {
|
if(matchesSelector && matchesSelector.call(el,selector)) {
|
||||||
var r = nav.navigateTo(el.getAttribute("href"));
|
var r = nav.navigateTo(el.getAttribute("href"));
|
||||||
if(!r) {
|
if(!r) {
|
||||||
|
@ -281,7 +281,7 @@ Recipe.tiddlerOutputter = {
|
|||||||
out.push("<" + "script type=\"application/javascript\">");
|
out.push("<" + "script type=\"application/javascript\">");
|
||||||
out.push("define(\"" + title + "\",function(require,exports) {");
|
out.push("define(\"" + title + "\",function(require,exports) {");
|
||||||
out.push(tid.fields.text);
|
out.push(tid.fields.text);
|
||||||
out.push("});")
|
out.push("});");
|
||||||
out.push("</" + "script>");
|
out.push("</" + "script>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,22 +6,22 @@ This browser component manages navigating to new tiddlers in a TiddlyWiki classi
|
|||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
/*jslint node: true */
|
/*jslint node: true, jquery: true */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var StoryNavigator = function(navigators) {
|
var StoryNavigator = function(navigators) {
|
||||||
this.navigators = navigators;
|
this.navigators = navigators;
|
||||||
}
|
};
|
||||||
|
|
||||||
StoryNavigator.prototype.navigateTo = function(title) {
|
StoryNavigator.prototype.navigateTo = function(title) {
|
||||||
var tiddlerHtml = this.navigators.store.renderTiddler("text/html",title);
|
var tiddlerHtml = this.navigators.store.renderTiddler("text/html",title);
|
||||||
if(tiddlerHtml) {
|
if(tiddlerHtml) {
|
||||||
$("<div/>").html(tiddlerHtml).appendTo("body");
|
$("<article/>").html(tiddlerHtml).appendTo("body");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.StoryNavigator = StoryNavigator;
|
exports.StoryNavigator = StoryNavigator;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ Tiddler.standardFields = {
|
|||||||
tags: { type: "tags"},
|
tags: { type: "tags"},
|
||||||
type: { type: "string"},
|
type: { type: "string"},
|
||||||
text: { type: "string"}
|
text: { type: "string"}
|
||||||
}
|
};
|
||||||
|
|
||||||
Tiddler.isStandardField = function(name) {
|
Tiddler.isStandardField = function(name) {
|
||||||
return name in Tiddler.standardFields;
|
return name in Tiddler.standardFields;
|
||||||
|
@ -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);
|
var parser = this.parseTiddler(title);
|
||||||
if(parser) {
|
if(parser) {
|
||||||
return parser.render(type,parser.children,this,title);
|
return parser.render(type,parser.children,this,asTitle ? asTitle : title);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user