2016-04-19 12:45:09 +00:00
|
|
|
( function ( mw, $ ) {
|
|
|
|
|
|
|
|
mw.loader.using( [ 'jquery.ui.draggable', 'jquery.ui.tooltip', 'jquery.tipsy' ], function () {
|
|
|
|
$( function () {
|
2016-05-11 09:04:13 +00:00
|
|
|
mw.track( 'counter.MediaWiki.RevisionSlider.event.init' );
|
2016-04-19 12:45:09 +00:00
|
|
|
mw.libs.revisionSlider.fetchRevisions( {
|
|
|
|
pageName: mw.config.get( 'wgPageName' ),
|
|
|
|
startId: mw.config.get( 'wgCurRevisionId' ),
|
|
|
|
|
|
|
|
success: function ( data ) {
|
2016-05-11 12:34:27 +00:00
|
|
|
var revs,
|
2016-05-10 12:42:05 +00:00
|
|
|
revisionList,
|
|
|
|
$container,
|
|
|
|
slider;
|
2016-04-19 12:45:09 +00:00
|
|
|
|
2016-05-11 12:34:27 +00:00
|
|
|
try {
|
|
|
|
revs = data.query.pages[ 0 ].revisions;
|
|
|
|
if ( !revs ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
revs.reverse();
|
|
|
|
|
|
|
|
revisionList = new mw.libs.revisionSlider.RevisionList( revs );
|
|
|
|
$container = $( '#revision-slider-container' );
|
|
|
|
slider = new mw.libs.revisionSlider.Slider( revisionList );
|
|
|
|
slider.getView().render( $container );
|
|
|
|
|
|
|
|
$( '#revision-slider-placeholder' ).remove();
|
|
|
|
} catch ( err ) {
|
|
|
|
$( '#revision-slider-placeholder' )
|
|
|
|
.html( mw.message( 'revisionslider-loading-failed' ).text() );
|
|
|
|
console.log( err );
|
|
|
|
mw.track( 'counter.MediaWiki.RevisionSlider.error.init' );
|
|
|
|
}
|
2016-05-10 12:42:05 +00:00
|
|
|
|
2016-05-11 12:34:27 +00:00
|
|
|
},
|
|
|
|
error: function ( err ) {
|
|
|
|
$( '#revision-slider-placeholder' )
|
|
|
|
.html( mw.message( 'revisionslider-loading-failed' ).text() );
|
|
|
|
console.log( err );
|
|
|
|
mw.track( 'counter.MediaWiki.RevisionSlider.error.init' );
|
2016-04-19 12:45:09 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
}( mediaWiki, jQuery ) );
|