| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
( function () { |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
mw.widgets.MediaResourceQueue = function MwWidgetsMediaResourceQueue( config ) { |
| 22 |
config = config || {}; |
| 23 |
|
| 24 |
|
| 25 |
mw.widgets.MediaResourceQueue.super.call( this, config ); |
| 26 |
|
| 27 |
this.maxHeight = config.maxHeight || 200; |
| 28 |
}; |
| 29 |
|
| 30 |
|
| 31 |
OO.inheritClass( mw.widgets.MediaResourceQueue, mw.widgets.APIResultsQueue ); |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
mw.widgets.MediaResourceQueue.prototype.getFileRepos = function () { |
| 39 |
const defaultSource = [ { |
| 40 |
url: mw.util.wikiScript( 'api' ), |
| 41 |
local: '' |
| 42 |
} ]; |
| 43 |
|
| 44 |
if ( !this.fileRepoPromise ) { |
| 45 |
this.fileRepoPromise = new mw.Api().get( { |
| 46 |
action: 'query', |
| 47 |
meta: 'filerepoinfo' |
| 48 |
} ).then( |
| 49 |
( resp ) => resp.query && resp.query.repos || defaultSource, |
| 50 |
() => $.Deferred().resolve( defaultSource ) |
| 51 |
); |
| 52 |
} |
| 53 |
|
| 54 |
return this.fileRepoPromise; |
| 55 |
}; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
mw.widgets.MediaResourceQueue.prototype.getMaxHeight = function () { |
| 63 |
return this.maxHeight; |
| 64 |
}; |
| 65 |
}() ); |