mediawiki-extensions-Visual.../modules/ve-mw/init/ve.init.mw.ImageInfoCache.js
James D. Forrester ada58df361 build: Bump file copyright notices for 2016
Change-Id: I3c618c196e504a80ca297a4132a17f1977a24fb7
2016-01-03 14:57:25 -08:00

51 lines
994 B
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 ) {
return new mw.Api().get(
{
action: 'query',
prop: 'imageinfo',
indexpageids: '1',
iiprop: 'size|mediatype',
titles: subqueue.join( '|' )
},
{ type: 'POST' }
);
};