User:Mooeypoo/articlesandbox.js

$.when( mw.loader.using( [ 'oojs-ui', 'mediawiki.util', 'mediawiki.api' ] ), $.ready).then( function {	var api = new mw.Api,		articles = {},		ARTICLE_REPO = 'User:Mooeypoo/test/articlesandbox';	api.get( { action: 'query', format: 'json', list: 'prefixsearch', pssearch: ARTICLE_REPO } )	.then( // Success function ( queryData ) { var articlesArr = queryData.query.prefixsearch; articlesArr.forEach( function ( articleData ) {				var pieces = [],					title = articleData.title;

if ( title.indexOf( ARTICLE_REPO ) !== 0 ) { return; }				pieces = title.replace( ARTICLE_REPO, '' ).split( '/' ); pieces = pieces.filter( function ( piece ) {					return !!piece; // Get rid of empty strings				} );

console.log( title, pieces ); } );		},		// Failure		function {}	); } );