[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/resources/src/mediawiki/ -> mediawiki.js (summary)

Base library for MediaWiki. Exposed as globally as `mediaWiki` with `mw` as shortcut.

File Size: 2399 lines (79 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 24 functions

  log()
  Map()
  Message()
  getMarker()
  newStyleTag()
  canExpandStylesheetWith()
  addEmbeddedCSS()
  formatVersionNumber()
  pad()
  sortDependencies()
  resolve()
  filter()
  allReady()
  handlePending()
  addScript()
  execute()
  addLink()
  runScript()
  request()
  sortQuery()
  buildModulesString()
  doRequest()
  flush()
  escapeCallback()

Functions
Functions that are not part of a class:

log( msg, e )   X-Ref
Log a message to window.console, if possible. Useful to force logging of some
errors that are otherwise hard to detect (I.e., this logs also in production mode).
Gets console references in each invocation, so that delayed debugging tools work
fine. No need for optimization here, which would only result in losing logs.

param: {string} msg text for the log entry.
param: {Error} [e]

Map( values )   X-Ref
Creates an object that can be read from or written to from prototype functions
that allow both single and multiple variables at once.

param: {Object|boolean} [values] Value-bearing object to map, or boolean

Message( map, key, parameters )   X-Ref
Object constructor for messages.

Similar to the Message class in MediaWiki PHP.

Format defaults to 'text'.

param: {mw.Map} map Message storage
param: {string} key
param: {Array} [parameters]

getMarker()   X-Ref
No description

newStyleTag( text, nextnode )   X-Ref
Create a new style tag and add it to the DOM.

param: {string} text CSS text
param: {HTMLElement|jQuery} [nextnode=document.head] The element where the style tag should be
return: {HTMLElement} Reference to the created `<style>` element.

canExpandStylesheetWith( cssText )   X-Ref
Checks whether it is safe to add this css to a stylesheet.

param: {string} cssText
return: {boolean} False if a new one must be created.

addEmbeddedCSS( cssText, callback )   X-Ref
Add a bit of CSS text to the current browser page.

The CSS will be appended to an existing ResourceLoader-created `<style>` tag
or create a new one based on whether the given `cssText` is safe for extension.

param: {string} [cssText=cssBuffer] If called without cssText,
param: {Function} [callback]

formatVersionNumber( timestamp )   X-Ref
Generates an ISO8601 "basic" string from a UNIX timestamp


pad( a, b, c )   X-Ref
No description

sortDependencies( module, resolved, unresolved )   X-Ref
Resolves dependencies and detects circular references.

param: {string} module Name of the top-level module whose dependencies shall be
param: {Array} resolved Returns a topological sort of the given module and its
param: {Object} [unresolved] Hash used to track the current dependency

resolve( module )   X-Ref
Gets a list of module names that a module depends on in their proper dependency
order.

param: {string} module Module name or array of string module names
return: {Array} list of dependencies, including 'module'.

filter( states, modules )   X-Ref
Narrows a list of module names down to those matching a specific
state (see comment on top of this scope for a list of valid states).
One can also filter for 'unregistered', which will return the
modules names that don't have a registry entry.

param: {string|string[]} states Module states to filter by
param: {Array} [modules] List of module names to filter (optional, by default the entire
return: {Array} List of filtered module names

allReady( dependencies )   X-Ref
Determine whether all dependencies are in state 'ready', which means we may
execute the module or job now.

param: {Array} dependencies Dependencies (module names) to be checked.
return: {boolean} True if all dependencies are in state 'ready', false otherwise

handlePending( module )   X-Ref
A module has entered state 'ready', 'error', or 'missing'. Automatically update pending jobs
and modules that depend upon this module. if the given module failed, propagate the 'error'
state up the dependency tree; otherwise, execute all jobs/modules that now have all their
dependencies satisfied. On jobs depending on a failed module, run the error callback, if any.

param: {string} module Name of module that entered one of the states 'ready', 'error', or 'missing'.

addScript( src, callback, async )   X-Ref
Adds a script tag to the DOM, either using document.write or low-level DOM manipulation,
depending on whether document-ready has occurred yet and whether we are in async mode.

param: {string} src URL to script, will be used as the src attribute in the script tag
param: {Function} [callback] Callback which will be run when the script is done
param: {boolean} [async=false] Whether to load modules asynchronously.

execute( module )   X-Ref
Executes a loaded module, making it ready to use

param: {string} module Module name to execute

addLink( media, url )   X-Ref
Define loop-function here for efficiency
and to avoid re-using badly scoped variables.


runScript()   X-Ref
No description

request( dependencies, ready, error, async )   X-Ref
Adds a dependencies to the queue with optional callbacks to be run
when the dependencies are ready or fail

param: {string|string[]} dependencies Module name or array of string module names
param: {Function} [ready] Callback to execute when all dependencies are ready
param: {Function} [error] Callback to execute when any dependency fails
param: {boolean} [async=false] Whether to load modules asynchronously.

sortQuery( o )   X-Ref
No description

buildModulesString( moduleMap )   X-Ref
Converts a module map of the form { foo: [ 'bar', 'baz' ], bar: [ 'baz, 'quux' ] }
to a query string of the form foo.bar,baz|bar.baz,quux


doRequest( moduleMap, currReqBase, sourceLoadScript, async )   X-Ref
Asynchronously append a script tag to the end of the body
that invokes load.php

param: {Object} moduleMap Module map, see #buildModulesString
param: {Object} currReqBase Object with other parameters (other than 'modules') to use in the request
param: {string} sourceLoadScript URL of load.php
param: {boolean} async Whether to load modules asynchronously.

flush()   X-Ref
No description

escapeCallback( s )   X-Ref
HTML construction helper functions




Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1