/*\ title: js/App.js This is the main() function in the browser \*/ (function(){ /*jslint node: true, browser: true */ "use strict"; var WikiStore = require("./WikiStore.js").WikiStore, Tiddler = require("./Tiddler.js").Tiddler, tiddlerInput = require("./TiddlerInput.js"), tiddlerOutput = require("./TiddlerOutput.js"), Renderer = require("./Renderer.js").Renderer, WikiTextParser = require("./WikiTextParser.js").WikiTextParser, PlainTextParser = require("./PlainTextParser.js").PlainTextParser, JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser, JSONParser = require("./JSONParser.js").JSONParser, ImageParser = require("./ImageParser.js").ImageParser; var App = function() { var t; // Check if we're running on the server or the client this.isBrowser = typeof window !== "undefined"; // Create the main store this.store = new WikiStore(); // Register the parsers this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({store: this.store})); this.store.registerParser("text/plain",new PlainTextParser({store: this.store})); this.store.registerParser(["image/svg+xml",".svg","image/jpg",".jpg","image/jpeg",".jpeg","image/png",".png","image/gif",".gif"],new ImageParser({store: this.store})); this.store.registerParser(["application/javascript",".js"],new JavaScriptParser({store: this.store})); this.store.registerParser(["application/json",".json"],new JSONParser({store: this.store})); // Register the standard tiddler serializers and deserializers tiddlerInput.register(this.store); tiddlerOutput.register(this.store); // Add the shadow tiddlers that are built into TiddlyWiki var shadowShadowStore = new WikiStore({ shadowStore: null }), shadowShadows = [ {title: "StyleSheet", text: ""}, {title: "MarkupPreHead", text: ""}, {title: "MarkupPostHead", text: ""}, {title: "MarkupPreBody", text: ""}, {title: "MarkupPostBody", text: ""}, {title: "TabTimeline", text: "<>"}, {title: "TabAll", text: "<>"}, {title: "TabTags", text: "<>"}, {title: "TabMoreMissing", text: "<>"}, {title: "TabMoreOrphans", text: "<>"}, {title: "TabMoreShadowed", text: "<>"}, {title: "AdvancedOptions", text: "<>"}, {title: "PluginManager", text: "<>"}, {title: "SystemSettings", text: ""}, {title: "ToolbarCommands", text: "|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|"}, {title: "WindowTitle", text: "<> - <>"}, {title: "DefaultTiddlers", text: "[[GettingStarted]]"}, {title: "MainMenu", text: "[[GettingStarted]]"}, {title: "SiteTitle", text: "My TiddlyWiki"}, {title: "SiteSubtitle", text: "a reusable non-linear personal web notebook"}, {title: "SiteUrl", text: ""}, {title: "SideBarOptions", text: '<><><><><><><>'}, {title: "SideBarTabs", text: '<>'}, {title: "TabMore", text: '<>'} ]; this.store.shadows.shadows = shadowShadowStore; for(t=0; t