mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-13 07:48:37 +00:00
f9471bcfbc
If something goes wrong with the initial api rquest the slider would either load in a broken state or say that it is loading forever. Now a message will be displayed to the user as well as the error logged to the console. Change-Id: Id763f31432feb7bd0e9ecbbeb2dd40f7ca6acaaf
28 lines
699 B
JavaScript
28 lines
699 B
JavaScript
( function ( mw, $ ) {
|
|
mw.libs.revisionSlider = mw.libs.revisionSlider || {};
|
|
|
|
/**
|
|
* Fetches up to 500 revisions at a time
|
|
*
|
|
* @param {{}} options - Options containing success /error callback, pageName and startId
|
|
*/
|
|
mw.libs.revisionSlider.fetchRevisions = function ( options ) {
|
|
$.ajax( {
|
|
url: mw.util.wikiScript( 'api' ),
|
|
data: {
|
|
action: 'query',
|
|
prop: 'revisions',
|
|
format: 'json',
|
|
rvprop: 'ids|timestamp|user|comment|parsedcomment|size|flags',
|
|
titles: options.pageName,
|
|
formatversion: 2,
|
|
rvstartid: options.startId,
|
|
'continue': '',
|
|
rvlimit: 500
|
|
},
|
|
success: options.success,
|
|
error: options.error
|
|
} );
|
|
};
|
|
}( mediaWiki, jQuery ) );
|