Last modified: 2014-11-17 10:36:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 34958 - ResourceLoader: Allow creation of wiki-modules on a user level
ResourceLoader: Allow creation of wiki-modules on a user level
Status: NEW
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
All All
: Normal enhancement with 4 votes (vote)
: Future release
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: 27488 33836
  Show dependency treegraph
Reported: 2012-03-04 14:12 UTC by Helder
Modified: 2014-11-17 10:36 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Helder 2012-03-04 14:12:48 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
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.
Comment 1 Krinkle 2012-03-05 18:54:16 UTC
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).
Comment 2 Mark A. Hershberger 2012-03-05 22:33:50 UTC
Hrm, now I'm getting cranky because I think this is a dupe of bug 27488.  Avoiding the dupe hammer for the moment, though.
Comment 3 Bergi 2012-03-10 21:55:37 UTC
(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.
Comment 4 Krinkle 2012-05-11 17:25:16 UTC
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.
Comment 5 Helder 2012-11-01 20:35:30 UTC
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
* ...
Comment 6 Krinkle 2012-11-01 20:52:26 UTC
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.
Comment 7 Matthew Flaschen 2012-12-30 08:25:09 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.