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

           Summary: An elegant way to do importScript with mw.loader
           Product: MediaWiki
           Version: 1.18-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: Resource Loader
        AssignedTo: tpars...@wikimedia.org
        ReportedBy: liang...@gmail.com
                CC: roan.katt...@gmail.com


There's no simple way to import scripts in wiki pages with RL, except for
building URLs manually. With the deprecation of legacy JS API, a good way to do
it in RL is needed. It would be better that it can be done with page revision
check as well.

Just an imagination:

1. Several scripts call a function individually:

mw.loader.pageLoad('User:Liangent/Scripts/a.js');
mw.loader.pageLoad('User:Liangent/Scripts/b.js');
mw.loader.pageLoad('User:Liangent/Scripts/c.js');

2. At the end something calls:

mw.loader.pageGo();

3. A <script
src="load.php?page[]=User:Liangent/Scripts/a.js&page[]=User:Liangent/Scripts/b.js&page[]=User:Liangent/Scripts/c.js">
is inserted. Make this call non-cachable at browser side, possibly cachable at
server side (squid level?) and invalidated on edits of any of .../a.js, b.js or
c.js.

4. In its content it imports (minified contents of) .../a.js, b.js and c.js
individually, with timestamps or revision ids in URLs and make them permanently
cached.

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