Talk:JS2 Overview

User scripts
I understand that the script loader also packages user skin js. Do you see a way to pack some additional scripts, too, which are currently just imported using importScript? Or could one query the script loader oneself to retrieve an additional batch of scripts? This would help a lot with scripts like Twinkle, which currently imports 17 seperate scripts. If it could use the script loader to retrieve them minified with one call it would speed things up quite a bit. --Amalthea 10:39, 21 April 2009 (UTC)
 * yes you want to use the mwLoad function. You need to define your classes both in javascript and in the php (if you want to support usage without the scrtiploader). see updated documentation. Mdale

Javascript Localization Alternatives
Some have pointed out that localizing msgs in javascript is problematic or difficult. (Also bug thread: bug 19190). But the alternative of packing interfaces msgs with data results on the php server side poses several difficulties:
 * We can't as easily use the data api's directly / have to proxy all the data requests and do costly HTML generation server side. (obviously its cheaper to just send the clients the data and have them do the dynamic transformations locally)
 * Any interface improvements involve both php and js modification as opposed to quick javascript changes.
 * Application complexity grows, a whole new framework has to be adopted, and code is much more difficult to review since any dynamic msg interface interaction now involves php server side html code generation.
 * Applications have to be developed in a way that avoid extra trips to the server solely for localized msgs which means merging all dynamic data requests with interface code or more round trips to the server.

Gadget extension
Currently (well, last time I checked at least), every file used from special:gadget is loaded separately. Was this extension rewritten so their javascript part also be taken into account by the script loader ? Darkoneko 07:22, 16 September 2009 (UTC)
 * the script-loader has been tested locally with the gadget extension and works well. (it groups all the mediaWiki pages and caches them per the latest revision id of the set) Mdale 06:36, 2 October 2009 (UTC)

Scripts residing in the Mediawiki-namespace and jQuery
Is it possible to get the jquery libraries through js2 if there is not php extension involved? We have scripts making use of jquery, but they reside solely on the wiki itself. I understand the problems of localization, and need for server support, but for the moment: Can we use the libraries through JS2? Do we have to write a "dummy" extension "loadjQuery" to achieve this or is there a more elegant way? --G.Hagedorn 15:36, 27 November 2009 (UTC)


 * Answering own question: We do use a manual jquery-inclusion extension, with the following code

$wgHooks['BeforePageDisplay'][] = 'wfIdentificationToolsBeforePageDisplay'; function wfIdentificationToolsBeforePageDisplay( &$out ) { global $wgOut, $wgScriptPath, $wgJsMimeType, $wgJSAutoloadClasses; /* Direct from jquery (allowed!): http://code.jquery.com/jquery-1.4.1.min.js or     from faster google servers: http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js */ $out->addScript( " var \$j=jQuery.noConflict; "); return true; }
 * In the future, some standard method to include jquery should be developed.