mediawiki-extensions-Visual.../modules/ve-mw/init/ve.init.mw.ImageInfoCache.js
Alex Monk 8e48f94580 Use mw.Api to run requests rather than our own stuff in ve.init.mw.Target
Bug: T58659
Bug: T89435
Change-Id: I18162f04c50f48606378aed62ee99fccdc3159f6
2015-02-25 01:57:22 +00:00

43 lines
960 B
JavaScript

/*!
* 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 ) {
return new mw.Api().get(
{
action: 'query',
prop: 'imageinfo',
indexpageids: '1',
iiprop: 'size|mediatype',
titles: subqueue.join( '|' )
},
{ type: 'POST' }
);
};
/**
* @inheritdoc
*/
ve.init.mw.ImageInfoCache.prototype.processPage = function ( page ) {
return page.imageinfo[0];
};
}() );