Implement ability to create wiki-modules at a user level
OpenPublic

Description

From @Nux's comment on T29488#313444

I've submitted this bug (T29488) with specific needs in mind. There is no way I 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 from wikipages, maybe not.

See also:

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz34958.
He7d3r created this task.Via LegacyMar 4 2012, 2:12 PM
Krinkle added a comment.Via ConduitMar 5 2012, 6:54 PM

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).

MarkAHershberger added a comment.Via ConduitMar 5 2012, 10:33 PM

Hrm, now I'm getting cranky because I think this is a dupe of bug 27488. Avoiding the dupe hammer for the moment, though.

bzimport added a comment.Via ConduitMar 10 2012, 9:55 PM

a.d.bergi wrote:

(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.

Krinkle added a comment.Via ConduitMay 11 2012, 5:25 PM

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.
He7d3r added a comment.Via ConduitNov 1 2012, 8:35 PM

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
  • ...
Krinkle added a comment.Via ConduitNov 1 2012, 8:52 PM

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.

Mattflaschen added a comment.Via ConduitDec 30 2012, 8:25 AM

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.

Schnark added a subscriber: Schnark.Via WebNov 24 2014, 8:48 AM
He7d3r awarded a token.Via WebNov 24 2014, 12:54 PM
Krinkle changed the title from "ResourceLoader: Allow creation of wiki-modules on a user level" to "Implement ability to create wiki-modules at a user level".Via WebNov 25 2014, 8:47 PM
Krinkle edited the task description. (Show Details)
Krinkle removed a subscriber: Unknown Object (MLST).
Krinkle removed a project: Future-Release.
Krinkle set Security to None.
Krenair added a subscriber: Krenair.Via WebDec 29 2014, 10:58 PM
Ricordisamoa added a subscriber: Ricordisamoa.Via WebJan 10 2015, 4:14 PM
SamB added a project: JavaScript.Via WebApr 8 2015, 9:15 PM
SamB added a subscriber: SamB.
He7d3r edited the task description. (Show Details)Via WebApr 8 2015, 10:28 PM
He7d3r added a subscriber: Nux.
Krinkle moved this task to Triaged on the MediaWiki-ResourceLoader workboard.Via WebApr 28 2015, 6:48 PM
Liuxinyu970226 added a subscriber: Liuxinyu970226.Via WebApr 29 2015, 1:46 AM
PerfektesChaos added a subscriber: PerfektesChaos.Via WebJul 9 2015, 10:22 AM

Add Comment