Last modified: 2014-11-17 10:36:38 UTC
From bug 27488 comment 64: ---- I've submitted this bug [bug 27488] with specific needs in mind. There is no way a know to: 1. Load user scripts in the header to allow actually running their code BEFORE the page starts to render (needed to inject CSS or faster adding of crucial elements). 2. Load user scripts in order (without the need of contacting administrators). ---- I'm not sure, but I think this probably means we need to provide a way to set "position = top" on user scripts. Maybe it is related to the need of creating modules fron wikipages (see bug 27281, bug 27561 and bug 25845), maybe not.
See also bug 27488 comment #68. I suggest to rename this bug to "Allow creation of ResourceLoader wiki-modules on a user level", which will give a user script all ResourceLoader features (including the queue 'position', which is a ResourceLoader feature and should/can only by used by ResourceLoader modules). Coming up with some kind of syntax to load imported user scripts from the top is not realistic in my opinion (nor practical).
Hrm, now I'm getting cranky because I think this is a dupe of bug 27488. Avoiding the dupe hammer for the moment, though.
(In reply to comment #0) > I'm not sure, but I think this probably means we need to provide a way to set > "position = top" on user scripts. Maybe it is related to the need of creating > modules fron wikipages (see bug 27281, bug 27561 and bug 25845), maybe not. I think we should not provide a hacky way for setting "position=top". We really should go and implement wikipage-modules. I'm just not sure to which of these three bugs this here should be marked as duplicate.
None of those 3 are dupes. We now got: * bug 34958: Support for user-level resourceloader modules * bug 27488: Support for user scripts to have use load position (this will be solved naturally by 34958, but not marking as a dupe of it, bug 34958 is just one way of solving bug 27488). These are currently filed under the MediaWiki core ResourceLoader component. That's fine for now but note that * User scripts are currently not loaded by ResourceLoader, they are "just" wiki pages loaded as raw scripts using plain HTML and JavaScript, nothing "MediaWiki"-ish about it. There is technically speaking no such feature as "user scripts" in MediaWiki. * Gadgets 3.0 will probably implement a feature that would replace (or introduce, depending on how you look at it) user scripts by allowing user-level repositories using JSON in the user space. At that point we could move these bugs to there, but lets keep it here for now.
What about allowing the user to define modules at [[Special:MyPage/modules]], e.g.: = User:Foo/modules = * someModuleName ** [[User:Foo/someModuleScript.js]] ** [[User:Foo/moreModuleScript.js]] ** [[User:Foo/someModuleStyle.css]] ** [[User:Foo/moreModuleStyle.css]] * anotherModuleName ** [[User:Foo/foo.js]] ** [[User:Foo/bar.css]] ** jquery.cookie (these are dependencies) ** mediawiki.api ** someModuleName * ...
What format it will be in is not a problem. The major barrier is the infrastructure behind it. Having an local startup module, controlling cache properly, clashing module names, foreign sources etc. The format you propose is not realistic because it doesn't make sense to invent a new format. We already solved this problem once in Gadgets with Gadgets-definition syntax. Which we then destroy in Gadgets 2.0 because it doesn't scale enough. The format will be JSON because wikitext does not scale for this kind of thing (we need scripts, styles, dependencies, messages, load position, and possibly more: skinStyles, skinScripts etc.). We already solved the format problem in Gadgets 2.0.
To update, user scripts are now loaded by ResourceLoaderUserModule. However, it's still just loading a fixed bundle of scripts (e.g. vector.js and common.js, depending on skin), which is quite different than allowing users to delineate modules.