/*<nowiki>*/
/** additional scripts **/
if ( wgIsArticle || window.location.href.indexOf( 'action=submit' ) > -1 )
{
addScript( 'MediaWiki:CollapsibleTables.js' );
hookEvent( 'load', function()
{
new CollapsibleTables();
diffwithFix();
// Extension for the deletion drop down list
if ( wgAction == 'delete' && ( delReasonBtn = document.getElementById( 'wpConfirmB' ) ) )
{
var delReasonList = document.getElementById( 'wpDeleteReasonList' );
var delLink = document.createElement( 'a' );
delLink.href = 'javascript:void(0);'
delLink.title = document.getElementById( 'wpReason' ).value;
delLink.style.fontSize = '0.9em';
delLink.style.marginLeft = '1em';
delLink.onclick = function()
{
document.getElementById( 'wpReason' ).value = this.title;
}
delReasonList.onchange = function ()
{
document.getElementById( 'wpReason' ).value = '';
this.onchange = null;
}
delLink.appendChild( document.createTextNode( 'restore default reason' ) );
delReasonBtn.parentNode.appendChild( delLink );
delete delLink, delReasonList, delReasonBtn;
}
} );
}
if ( wgPageName == 'Special:Upload' && document.getElementById( 'mw-upload-form' ) !== 'undefined' )
{
addScript( 'MediaWiki:UploadForm.js' );
hookEvent( 'load', function()
{
new UploadForm();
} );
}
/**** function addScript.js
* by Patrick Westerhoff [poke]
*/
function addScript ( pagename )
{
var script = document.createElement( 'script' );
pagename = encodeURI( pagename.replace( ' ', '_' ) );
script.src = '/index.php?title=' + pagename + '&action=raw&ctype=text/javascript';
script.type = 'text/javascript';
document.getElementsByTagName( 'head' )[0].appendChild( script );
}
/**** function diffwithFix.js
* by Patrick Westerhoff [poke]
*/
function diffwithFix ()
{
var diffSpan = document.getElementById( 'diffwith' );
if ( diffSpan == undefined )
return;
var diffLink = diffSpan.getElementsByTagName( 'a' )[0];
var diffTitle = diffSpan.title;
var xmlHttp;
try
{
xmlHttp = new XMLHttpRequest();
}
catch ( e )
{
try
{
xmlHttp = new ActiveXObject( 'Msxml2.XMLHTTP' );
}
catch ( e )
{
try
{
xmlHttp = new ActiveXObject( 'Microsoft.XMLHTTP' );
}
catch ( e )
{
diffSpan.style.fontSize = '90%';
diffSpan.innerHTML = '(Automated diff <b>not available</b>.)';
return;
}
}
}
xmlHttp.onreadystatechange = function ()
{
if ( xmlHttp.readyState != 4 )
return;
revs = xmlHttp.responseXML.getElementsByTagName( 'rev' );
if ( revs.length > 0 )
{
diffLink.href += '&oldid=' + revs[0].getAttribute( 'revid' );
diffSpan.title = '';
}
}
xmlHttp.open( 'GET', '/api.php?format=xml&action=query&prop=revisions&rvprop=ids&rvlimit=1&titles=' + diffTitle, true );
xmlHttp.send( null );
}
/*</nowiki>*/