2 * MediaWiki Widgets - MediaResourceQueue class.
4 * @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
10 * MediaWiki media resource queue.
13 * @extends mw.widgets.APIResultsQueue
16 * @param {Object} [config] Configuration options
17 * @cfg {number} maxHeight The maximum height of the media, used in the
18 * search call to the API.
20 mw.widgets.MediaResourceQueue = function MwWidgetsMediaResourceQueue( config ) {
21 config = config || {};
24 mw.widgets.MediaResourceQueue.super.call( this, config );
26 this.maxHeight = config.maxHeight || 200;
30 OO.inheritClass( mw.widgets.MediaResourceQueue, mw.widgets.APIResultsQueue );
33 * Fetch the file repos.
35 * @return {jQuery.Promise} Promise that resolves when the resources are set up
37 mw.widgets.MediaResourceQueue.prototype.getFileRepos = function () {
38 var defaultSource = [ {
39 url: mw.util.wikiScript( 'api' ),
43 if ( !this.fileRepoPromise ) {
44 this.fileRepoPromise = new mw.Api().get( {
49 return resp.query && resp.query.repos || defaultSource;
52 return $.Deferred().resolve( defaultSource );
57 return this.fileRepoPromise;
61 * Get image maximum height
63 * @return {string} Image max height
65 mw.widgets.MediaResourceQueue.prototype.getMaxHeight = function () {
66 return this.maxHeight;
68 }( jQuery, mediaWiki ) );