Hello Pacal,
You might be interested by JavaScript Extensions. See
http://code.xwiki.org/xwiki/bin/view/Plugins/SkinExtensionsPlugin
Here you will be able to have XWiki object hold your javascript code,
and refer to it from other pages. You will benefit from caching (You can
even define the caching policy in your JavaScript Extension object).
Regards,
Jerome.
Pascal Voitot wrote:
> Hello,
> I would like to write a document containing some javascript functions... For
> example:
> in "MySpace.MyJSDoc":
> {pre}
> print('This is my javascript');
> {/pre}
>
> Then, instead of using Velocity #includeMacros, I would like to use it with
> the classical external javascript link "<script src=""/> and take advantage
> of usual JS caching features of web browsers in order not to load this JS
> everytime... Thus, keeping a way of editing my javascript online...
>
> In the middle of a page, I would like to put something like:
> ... Some wiki content to render...
> <script type="text/javascript"
> src="$xwiki.getURL('MySpace.MyJSDoc')?xpage=plain"/>
> ... Some wiki content to render...
>
> (I use "xpage=plain" to retrieve only the JS content...)
>
> But it appears that web browsers don't wait until the whole page is received
> and make a nested call to the XWiki engine immediately after reading the
> <script src=""> and the receiving of the remaining part of the page is
> simply stopped at this stage (XWiki seems to trash the remaining part of the
> page).
>
> So my questions:
> is my idea totally stupid?
> if not, do you have an idea to make it possible or at least, at first sight,
> do you see what happens exactly to give me some clues before going deeper
> with debuggers?
>
> best regards
> Pascal
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs