> The easiest way to do this would be to add the jquery plugin to your
> MarkupPrehead tiddler.
>
> eg.
> <script type='text/javascript' src='supersleight.js'></script>
or, copy the source code from supersleight.js and paste it into a
tiddler tagged with systemConfig (i.e., make it a plugin)
> Then you'd need to make sure everytime your page is refreshed the
> function is called
> try something like this:
> var oldrestart = restart;
> restart = function(){
> jQuery('body').supersleight();
> oldrestart();};
There is another way that you can invoke this function whenever the
page is refreshed...
Rather than hijacking the core's restart() function, you could create
a tiddler called, for example, [[SiteStartup]], that would contain a
tiny inline script [1] that calls the supersleight() initialization,
like this:
<script> jQuery('body').supersleight(); </script>
Then, transclude this tiddler at the end of the PageTemplate, like
this:
<span macro='tiddler SiteStartup'></span>
Each time the PageTemplate is rendered (i.e., when the whole TW page
is drawn), the inline script in SiteStartup will be processed, and the
supersleight() init function will be invoked.
Alternatively, if you don't want to have a separate tiddler to hold
the inline script, you could use a 'hidden section' in the
PageTemplate itself, so that everything is in one place, like this:
<span macro='tiddler PageTemplate##SiteStartup'></span><!--
!SiteStartup
<script> jQuery('body').supersleight(); </script>
!end
-->
Note: there is an important (and useful) difference between using this
inline script technique and using a standard 'systemConfig' tiddler
(i.e., a plugin) to invoke custom code during startup: plugins get
loaded in *before* the initial page content has been rendered, while
the 'SiteStartup' scripts, being triggered at the end of the
PageTemplate, are processed *after* the initial rendering has been
completed. Thus, startup *scripts* can be used to manipulate the
rendered DOM elements, while plugins cannot.
enjoy,
-e