User:DerHexer/monobook.js

mw.loader.using( 'mediawiki.api', function () {

( new mw.Api() ).get( {

action: 'query',

prop: 'info',

intoken: 'delete',

titles: 'Madrid'

} ).done( function ( data ) {

$.ajax({

// request type ( GET or POST )

type: "POST",

// the URL to which the request is sent

url: mw.util.wikiScript('api'),

// data to be sent to the server

data: { action:'undelete', title: 'Madrid', token: data.query.pages[-1]["deletetoken"], reason: 'Restored.' },

// The type of data that you're expecting back from the server

dataType: 'json',

// Function to be called if the request succeeds

success: function( jsondata ){

jsMsg( jsondata.result );

}

})

})

});

/*

  • /