mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-29 07:20:47 +00:00
Added library modules to browser template
Now we can include things like jQuery easily
This commit is contained in:
parent
2083b7959e
commit
5322d3cdfd
@ -518,6 +518,7 @@ $tw.plugins.registerPlugin($tw.config.root + "/kernel/tiddlerdeserializer/dom","
|
|||||||
$tw.plugins.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerPlugins);
|
$tw.plugins.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerPlugins);
|
||||||
|
|
||||||
// Load the JavaScript system tiddlers from the DOM
|
// Load the JavaScript system tiddlers from the DOM
|
||||||
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("libraryModules")),true);
|
||||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("pluginModules")),true);
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("pluginModules")),true);
|
||||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernelPrefix")),true);
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernelPrefix")),true);
|
||||||
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernel")),true);
|
$tw.wiki.addTiddlers($tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernel")),true);
|
||||||
|
@ -68,6 +68,23 @@ exports["application/x-tiddler-module"] = function(tiddler) {
|
|||||||
).render("text/html");
|
).render("text/html");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports["application/x-tiddler-library"] = function(tiddler) {
|
||||||
|
var attributes = {
|
||||||
|
type: "text/javascript"
|
||||||
|
}, // The script type is set to text/javascript for compatibility with old browsers
|
||||||
|
text = tiddler.fields.text;
|
||||||
|
for(var f in tiddler.fields) {
|
||||||
|
if(f !== "text") {
|
||||||
|
attributes["data-tiddler-" + f] = tiddler.getFieldString(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $tw.Tree.Element(
|
||||||
|
"script",
|
||||||
|
attributes,
|
||||||
|
[$tw.Tree.Raw(text)]
|
||||||
|
).render("text/html");
|
||||||
|
};
|
||||||
|
|
||||||
exports["application/x-tiddler-html-div"] = function(tiddler) {
|
exports["application/x-tiddler-html-div"] = function(tiddler) {
|
||||||
var result = [],
|
var result = [],
|
||||||
fields = [],
|
fields = [],
|
||||||
|
@ -31,12 +31,16 @@ type: text/x-tiddlywiki-html
|
|||||||
</noscript>
|
</noscript>
|
||||||
<!----------- Miscellaneous shadow tiddlers ----------->
|
<!----------- Miscellaneous shadow tiddlers ----------->
|
||||||
<div id="shadowArea" style="display:none;">
|
<div id="shadowArea" style="display:none;">
|
||||||
<<include "[is[shadow]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-html-div>>
|
<<include "[is[shadow]] -[type[text/css]] -[type[application/javascript]has[module-type]] -[type[application/javascript]library[yes]] -[[$:/core/boot.js]] -[[$:/core/bootprefix.js]]" application/x-tiddler-html-div>>
|
||||||
</div>
|
</div>
|
||||||
<!----------- Ordinary tiddlers ----------->
|
<!----------- Ordinary tiddlers ----------->
|
||||||
<div id="storeArea" style="display:none;">
|
<div id="storeArea" style="display:none;">
|
||||||
<<include "[!is[shadow]]" application/x-tiddler-html-div>>
|
<<include "[!is[shadow]]" application/x-tiddler-html-div>>
|
||||||
</div>
|
</div>
|
||||||
|
<!----------- Library modules ----------->
|
||||||
|
<div id="libraryModules" style="display:none;">
|
||||||
|
<<include "[is[shadow]type[application/javascript]library[yes]]" application/x-tiddler-library>>
|
||||||
|
</div>
|
||||||
<!----------- Boot kernel prologue ----------->
|
<!----------- Boot kernel prologue ----------->
|
||||||
<div id="bootKernelPrefix" style="display:none;">
|
<div id="bootKernelPrefix" style="display:none;">
|
||||||
<<include "$:/core/bootprefix.js" application/javascript>>
|
<<include "$:/core/bootprefix.js" application/javascript>>
|
||||||
|
Loading…
Reference in New Issue
Block a user