User:Qwerfjkl/scripts/allredirects.js

/*	get_allredirects.js

MediaWiki API Demos Demo of `Allredirects` module: Get the first three unique pages containing redirects to the main namespace.

MIT License

var params = { action: 'query', format: 'json', list: 'allredirects', arunique: '1', arnamespace: '0', arlimit: '3' },	api = new mw.Api; var redirects = []; api.get( params ).done( function ( data ) {	var redirects = data.query.allredirects,		r;	for ( r in redirects ) {		redirects.push( redirects[ r ].title );	} } ); alert(redirects);