Javascript and Stylesheets and Extension Points define their “use scope”
"on this page or demand"
"on demand only"
"on this wiki"
"currnt user" (extension points)
I would like to suggest that usage be defined via new user groups.
Membership of such a “user group” could be defined by the user themselves or by the administrator. The administrator could define default settings.
(At the moment we only know the “advanced user”)
Constructions like this skeletal piece of javascript code:
var XWiki = (function (XWiki) {
function someLocalFunctions(p,pp) { bla }
...
var someVariables = "bla";
...
## some velocity
#set($extraVariables=$xwiki.extraFunctions(bla)
...
function init() {
require(['jquery', 'bootstrap'], function ($, bootstrap) {
...
$.ajax({
type: 'GET',
url: someUrl,
cache: false,
}).done( function(data) { .. } );
....
});
}
(XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init);
return XWiki;
}(XWiki || {}));
offer a variety of more complex applications.
(WYSIWYG) editors with different interfaces / tasks
Activation of different mouse-over effects (display preview, display author, display change data ...)
Variation of standard layouts
Of course, you could do this yourself in a script, but then these things would not be as transparent.