> I would like to start a little script before the DefaultTiddlers tiddler > starts, because the script adapts the DefaultTiddlers to the actual > date. So far I installed the InlineJavascriptPlugin and did a tiddler > StartScript with the following code:
You don't need InlineJavascriptPlugin to invoke code at startup. Just put your code into a tiddler (*without* the surrounding <script>...</ script> markers), and tag that tiddler with 'systemConfig'. Then, save and reload your document. At startup, all tiddlers tagged with 'systemConfig' are assumed to contain javascript code that is automatically invoked as a 'plugin' each time the document is opened. For an explanation of some of the differences between inline scripts and plugins, please read: http://www.tiddlytools.com/faq.html#FAQ_ScriptsAndPlugins > > document.write("The current date/time is: "+(new Date())+"<br>"); > > return "link to current user: [["+config.options.txtUserName+"]]\n"; You should avoid using 'document.write()' in inline scripts... although supported by InlineJavascriptPlugin, it takes extra overhead to convernt that output so that it doesn't completely overwrite the entire TiddlyWiki document and is, instead, written into the current tiddler. The recommended method for producing dynamic output from an inline script is to first create an output array: var out=[]; then, fill it with individual lines of output by using .push(), like this: out.push("The current date/time is: "+new Date()); out.push("link to current user: [["+config.options.txtUserName +"]]"; and, at the very end of the script, assemble the lines and return the entire result: return out.join('\n'); Of course, for simple cases, just returning a basic string will often suffice, e.g.: var out=""; if (... conditional ...) out="something" else out="something else" return out; enjoy, -e --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~----------~----~----~----~------~----~------~--~---

