User:Pathoschild/Scripts/MooTools
This script became obsolete when MediaWiki enabled jQuery by default.
This page is kept for historical interest. Any policies mentioned may be obsolete. If you want to revive the topic, you can use the talk page or start a discussion on the community forum. |
WikiMooTools is an implementation of MooTools extended with wiki-specific functions. MooTools is a compact object-oriented JavaScript framework that simplifies cross-browser scripting.
Library functions
editMooTools modules
editThis implementation includes the MooTools 1.2.4 modules that are most useful for wikis. Click the linked module names for their documentation.
|
|
|
Get edit token (wmt_token
)
edit
Retrieves an edit token for the given session and wiki (required to perform database changes like editing, deletion, protection, emailing, etc). The same token can be reused throughout the session for any task requiring a token, and is valid for both the API and MediaWiki web interface.
syntax | wmt_token(object) |
parameters |
An object with any of the following properties:
|
return value | null . |
example |
wmt_token({
onSuccess:cTokenSuccess,
onFailure:cTokenFailure
});
function cTokenSuccess(token) {
alert('The token is ' + token);
}
function cTokenFailure(xhr) {
alert('An error occured: ' + xhr.status + ' ' + xhr.statusText);
}
|
Miscellaneous tasks
editCreate loading indicator (wmt_loader
)
edit
Returns a customizable loading indicator (default appearance: Loading...).
syntax | wmt_loader(object) |
parameters |
An object with any of the following optional properties:
|
return value | An element containing the loader. |
example |
$('bodyContent').adopt(wmt_loader());
|
Get list of titles matching prefix (wmt_prefixindex
)
edit
Retrieves a list of titles matching the given prefix in the given namespace, optionally restricted to the current title's subpages.
syntax | wmt_prefixindex(object) |
parameters |
An object with any of the following optional properties:
|
return value | null . |
example |
wmt_prefixindex({
title:'Pathoschild',
namespace:2, // 2=user
subpagesOnly:true,
onSuccess:cTokenSuccess,
onFailure:cTokenFailure
});
function cTokenSuccess(pages) {
alert('User:Pathoschild has ' + pages.length + ' subpages.');
}
function cTokenFailure(xhr) {
alert('An error occured: ' + xhr.status + ' ' + xhr.statusText);
}
|
Installation
editThis is still in early development, and not ready for general use.