Mootools
The Mootools JavaScript framework offers some excellent, easy to use components for implementing Ajax functionality. To use Mootools, download the code from mootools.net/download (put a tick in the ajax item near the bottom of the list and then click the download button) and save it in your extensions directory.
The code needs to be loaded by the MediaWiki page, which can be achieved a number of ways:
- By leaving it up to the MediaWiki extension which requires Mootools and following that extensions installation instructions
- By adding something like
<script type="text/javascript" src="/wiki/extensions/Javascript/mootools.js"></script>
directly into your skin file - By adding the Mootools code into your
MediaWiki:Common.js
article
Problem: undefinedundefined... appears below edit buttons
editThis problem occurs in MediaWiki versions prior to 1.10, it can be fixed by replacing the /wiki/skins/common/wikibits.js file with the 1.10 version or by implementing the following specific change:
Lines 375 to 380 of MW1.9.x's wikibits.js file are shown here:
for (var i in mwEditButtons) {
mwInsertEditButton(toolbar, mwEditButtons[i]);
}
for (i in mwCustomEditButtons) {
mwInsertEditButton(toolbar, mwCustomEditButtons[i]);
}
The syntax of each of those for-loops needs to be changed to only address the numerical keys since some other components (such as Mootools) add additional methods and properties to those objects. The code in MW1.10.x has been refined to account for such behaviour as follows:
for (var i = 0; i < mwEditButtons.length; i++) {
mwInsertEditButton(toolbar, mwEditButtons[i]);
}
for (var i = 0; i < mwCustomEditButtons.length; i++) {
mwInsertEditButton(toolbar, mwCustomEditButtons[i]);
}
Live preview problem
editCurrently including Mootools conflicts with the new experimental live preview feature in MediaWiki.
See also
edit- mootools.net - The Mootools website