X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Fmediawiki%2Fmediawiki.js;h=e36d9d093d85f5e477a83b708ebf3ea80be4ec1f;hb=9507d3ad7b3f5ffd864fd32412de77b04e5a94da;hp=716264d727840a900fbd2b514f9552fbe9fed89b;hpb=d95372b9457b46a1e8933d4a3237ca2d97e14ce8;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 716264d727..e36d9d093d 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -15,10 +15,38 @@ var mw = ( function ( $, undefined ) { /** * Creates an object that can be read from or written to from prototype functions * that allow both single and multiple variables at once. + * + * @example + * + * var addies, wanted, results; + * + * // Create your address book + * addies = new mw.Map(); + * + * // This data could be coming from an external source (eg. API/AJAX) + * addies.set( { + * 'John Doe' : '10 Wall Street, New York, USA', + * 'Jane Jackson' : '21 Oxford St, London, UK', + * 'Dominique van Halen' : 'Kalverstraat 7, Amsterdam, NL' + * } ); + * + * wanted = ['Dominique van Halen', 'George Johnson', 'Jane Jackson']; + * + * // You can detect missing keys first + * if ( !addies.exists( wanted ) ) { + * // One or more are missing (in this case: "George Johnson") + * mw.log( 'One or more names were not found in your address book' ); + * } + * + * // Or just let it give you what it can + * results = addies.get( wanted, 'Middle of Nowhere, Alaska, US' ); + * mw.log( results['Jane Jackson'] ); // "21 Oxford St, London, UK" + * mw.log( results['George Johnson'] ); // "Middle of Nowhere, Alaska, US" + * * @class mw.Map * * @constructor - * @param {boolean} global Whether to store the values in the global window + * @param {boolean} [global=false] Whether to store the values in the global window * object or a exclusively in the object property 'values'. */ function Map( global ) { @@ -259,6 +287,8 @@ var mw = ( function ( $, undefined ) { }; /** + * Base library for MediaWiki. + * * @class mw * @alternateClassName mediaWiki * @singleton @@ -286,13 +316,17 @@ var mw = ( function ( $, undefined ) { Message: Message, /** - * List of configuration values + * Map of configuration values * - * Dummy placeholder. Initiated in startUp module as a new instance of mw.Map(). - * If `$wgLegacyJavaScriptGlobals` is true, this Map will have its values - * in the global window object. - * @property + * Check out [the complete list of configuration values](https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config) + * on MediaWiki.org. + * + * If `$wgLegacyJavaScriptGlobals` is true, this Map will put its values in the + * global window object. + * + * @property {mw.Map} config */ + // Dummy placeholder. Re-assigned in ResourceLoaderStartupModule with an instance of `mw.Map`. config: null, /** @@ -302,6 +336,14 @@ var mw = ( function ( $, undefined ) { libs: {}, /** + * Access container for deprecated functionality that can be moved from + * from their legacy location and attached to this object (e.g. a global + * function that is deprecated and as stop-gap can be exposed through here). + * + * This was reserved for future use but never ended up being used. + * + * @deprecated since 1.22: Let deprecated identifiers keep their original name + * and use mw.log#deprecate to create an access container for tracking. * @property */ legacy: {}, @@ -424,11 +466,11 @@ var mw = ( function ( $, undefined ) { * * @private * @param {string} text CSS text - * @param {Mixed} [nextnode] An Element or jQuery object for an element where - * the style tag should be inserted before. Otherwise appended to the ``. - * @return {HTMLElement} Node reference to the created `