https://bugzilla.wikimedia.org/show_bug.cgi?id=27535

           Summary: Load (user) scripts like modules
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Resource Loader
        AssignedTo: tpars...@wikimedia.org
        ReportedBy: andbe...@web.de
                CC: roan.katt...@gmail.com


Today you only can load modules that are specified by MediaWiki, e.g. jQuery
extensions, RL-Gadgets and mediawiki-utilities (legacies), and static uris with
the ressource loader.

I already thought about registering user-script-modules, e.g. last lines of
http://de.wikipedia.org/wiki/Benutzer:✓/js/deSecure.js. Here other scripts can
use the mw.loader.using method, I chose "user.<usernick>.<scriptname>" for the
module name analogous to "ext.<extensionname>", "jquery.<modulename>" etc. You
already can use the mw.loader.register method to set dependencies, load some
system messages per api, specifiy css (or load from api) and design a
to-be-executed function, and then mw.loader.implement() them to your module.

But this needs up to 3 file loads (script file with function, dependencies and
implementation; messages api; css file) and is used by a call of
mw.loader.load(<static url of script file>). Also the dependencies don't work
as you use other user scripts, which would cause a request ending up in
state:missing when they're not loaded then and preventing the real implentation
by that.

A better way would be loading them one-in-all (and not module by module, see
Bug 26291), just by one simple module request that specifies project (+project
language), user, module name and i18n (message language, by default uselang).
Of course for detecting every modules' messages and dependencies either a
auxiliary page (like in the Gadget extension) or a preprocessing of the script
page would be needed. I'd propose the latter, this could be done like a /*
comment */ at the top of the page where the module creator can specify
dependencies, messages and CSS-pages to be embedded in one call of
loader.implement. The function would be either a also spezified one or the rest
of the script.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to