mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 02:51:50 +00:00
c843824c97
Also get rid of .join( '|' ) for API request parameters per Bartosz Bug: T147067 Change-Id: If4444cca300d65e28d6fb9003fcac5e076a5129a
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor MediaWiki Initialization ImageInfoCache class.
|
|
*
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Get information about images.
|
|
*
|
|
* @class
|
|
* @extends ve.init.mw.ApiResponseCache
|
|
* @constructor
|
|
*/
|
|
ve.init.mw.ImageInfoCache = function VeInitMwImageInfoCache() {
|
|
ve.init.mw.ImageInfoCache.super.call( this );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.init.mw.ImageInfoCache, ve.init.mw.ApiResponseCache );
|
|
|
|
/* Static methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.init.mw.ImageInfoCache.static.processPage = function ( page ) {
|
|
if ( page.imageinfo ) {
|
|
return page.imageinfo[ 0 ];
|
|
}
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.init.mw.ImageInfoCache.prototype.getRequestPromise = function ( subqueue ) {
|
|
// If you change what `iiprop`s are being fetched, update
|
|
// ve.ui.MWMediaDialog to add the same ones to the cache.
|
|
return new mw.Api().get(
|
|
{
|
|
action: 'query',
|
|
prop: 'imageinfo',
|
|
indexpageids: '1',
|
|
iiprop: 'size|mediatype',
|
|
titles: subqueue
|
|
},
|
|
{ type: 'POST' }
|
|
);
|
|
};
|