On 02/26/2014 02:43 AM, Patrick Masson wrote:
  Hi Boudjelda (and Marius),
 I was wondering if you ever found a solution for this? I would like to add TogetherJS to
XWiki (see: 
https://togetherjs.com/#tryitout-section) but am not sure how to insert
 the JS source into the page head.
 I went through the suggested steps:
 1st, created a new object for the page "myurl/Sandbox/WebHome/",
"Edit" -> "Objects":
 Objects of type XWiki.JavaScriptExtension
 - JavaScriptExtension 0: TogetherJS
 Code:
 document.observe('xwiki:dom:loaded', function() {
     <script
src="https://togetherjs.com/togetherjs-min.js"></script>
 }
  
I guess this way to inject the script tag does not work.
You might check your javascript error console - this should tell you it got an error when
trying to understand the script-tag.
One working option which uses bare bone javascript is shown here:
http://stackoverflow.com/questions/8578617/inject-a-script-tag-with-remote-…
(put that code inside the document.observe listener function)
if it still does not work check the html source of the page; if the $xwiki.ssx.use and
$xwiki.jsx.use
elements have been executed properly they should have created tags inside the <head>
to include the
corresponding page.
 I remember once I had the case where the includes have been generated, but they have been
empty.
Cause of that problem: I made a typo in the page name and included javascript from a page
that did not exist ...
  Then in the page I added:
 {{velocity}}
 $xwiki.jsx.use("XWiki.SkinExt")
 {{/velocity}}
 {{velocity}}
 #set ($discard = $xwiki.ssx.use('Sandbox.WebHome'))
 #set ($discard = $xwiki.jsx.use('Sandbox.WebHome'))
 {{/velocity}}
 {{html}}
 <button onclick="TogetherJS(this); return false;">Start
TogetherJS</button>
 {{/html}}
 Any ideas?
 Thanks Patrick