SpecialVersion.js – MediaWiki
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/*****************************************************************************************
* JavaScript here will be loaded by MediaWiki:Common.js when viewing "Special:Version".
*
*****************************************************************************************/
(function() { // BEGIN WRAPPER
/*****************************************************************************************
* Variables required by all functions below
*/
var foo = ""; // Every script needs a "foo"
/*****************************************************************************************
* Check extension versions and indicate available updates.
* Maintainer: BIKI User:Fred Gandt
*/
function checkExtensionVersions() {
var tbls = document.getElementsByTagName( "table" ),
mw_version = tbls[0].getElementsByTagName( "tr" )[1].getElementsByTagName( "td" )[1].textContent,
exts = tbls[2].getElementsByTagName( "em" );
for ( var i in exts ) {
if ( typeof exts[i] == "object" ) {
var ev = exts[i].getElementsByClassName( "mw-version-ext-version" );
if ( ev[0] ) {
var en = exts[i].firstChild.textContent.trim();
$.getJSON( "https://www.mediawiki.org/w/api.php?action=query&titles=Extension:" +
encodeURIComponent( en ) + "&format=json&callback=?", function( data ) {
console.log( ev[0].textContent.replace( /[^0-9\.\s]/g, "" ).trim() ); // still just testing
}
);
}
}
}
}
/*****************************************************************************************/
/*****************************************************************************************
* Next ***
*/
// code code code
/*****************************************************************************************/
/*****************************************************************************************
* Call the functions above
*/
checkExtensionVersions();
}()); // END WRAPPER