2014-12-16 01:06:05 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki Initialization ImageInfoCache class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
( function () {
|
|
|
|
/**
|
|
|
|
* Get information about images.
|
|
|
|
* @class
|
|
|
|
* @extends ve.init.mw.ApiResponseCache
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
ve.init.mw.ImageInfoCache = function VeInitMwImageInfoCache() {
|
|
|
|
ve.init.mw.ImageInfoCache.super.call( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
OO.inheritClass( ve.init.mw.ImageInfoCache, ve.init.mw.ApiResponseCache );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.init.mw.ImageInfoCache.prototype.getRequestPromise = function ( subqueue ) {
|
2015-01-24 00:22:17 +00:00
|
|
|
return new mw.Api().get(
|
2014-12-16 01:06:05 +00:00
|
|
|
{
|
|
|
|
action: 'query',
|
|
|
|
prop: 'imageinfo',
|
|
|
|
indexpageids: '1',
|
|
|
|
iiprop: 'size|mediatype',
|
|
|
|
titles: subqueue.join( '|' )
|
|
|
|
},
|
|
|
|
{ type: 'POST' }
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.init.mw.ImageInfoCache.prototype.processPage = function ( page ) {
|
2015-02-26 21:48:50 +00:00
|
|
|
if ( page.imageinfo ) {
|
|
|
|
return page.imageinfo[0];
|
|
|
|
}
|
2014-12-16 01:06:05 +00:00
|
|
|
};
|
2015-01-31 00:41:37 +00:00
|
|
|
}() );
|