XWIKI-8898: Add support for jquery and require.js/AMD modules.
Fixed implementation bugs.