Move dependencies to extension.json

Also removed unused dependency.

Bug: T135198
Change-Id: I1ee53ec9d7e123bdca84701b9557aeeeade815ff
This commit is contained in:
WMDE-Fisch 2016-06-02 18:14:34 +02:00
parent 04df38c25f
commit 1a8a4312de
2 changed files with 40 additions and 42 deletions

View file

@ -82,6 +82,7 @@
"modules/ext.RevisionSlider.SliderView.js"
],
"dependencies": [
"jquery.ui.draggable",
"ext.RevisionSlider.DiffPage",
"ext.RevisionSlider.Pointer"
],
@ -117,6 +118,9 @@
"revisionslider-label-change-size",
"revisionslider-label-user",
"revisionslider-label-comment"
],
"dependencies": [
"jquery.tipsy"
]
},
"ext.RevisionSlider.arrows.left": {

View file

@ -1,54 +1,48 @@
( function ( mw, $ ) {
mw.track( 'counter.MediaWiki.RevisionSlider.event.init' );
mw.libs.revisionSlider.fetchRevisions( {
pageName: mw.config.get( 'wgPageName' ),
startId: mw.config.get( 'wgCurRevisionId' ),
mw.loader.using( [ 'jquery.ui.draggable', 'jquery.ui.tooltip', 'jquery.tipsy' ], function () {
$( function () {
mw.track( 'counter.MediaWiki.RevisionSlider.event.init' );
mw.libs.revisionSlider.fetchRevisions( {
pageName: mw.config.get( 'wgPageName' ),
startId: mw.config.get( 'wgCurRevisionId' ),
success: function ( data ) {
var revs,
revisionList,
$container,
slider;
success: function ( data ) {
var revs,
revisionList,
$container,
slider;
try {
revs = data.query.pages[ 0 ].revisions;
if ( !revs ) {
return;
}
revs.reverse();
try {
revs = data.query.pages[ 0 ].revisions;
if ( !revs ) {
return;
}
revs.reverse();
revisionList = new mw.libs.revisionSlider.RevisionList( revs );
$container = $( '#mw-revision-slider-container' );
slider = new mw.libs.revisionSlider.Slider( revisionList );
slider.getView().render( $container );
revisionList = new mw.libs.revisionSlider.RevisionList( revs );
$container = $( '#mw-revision-slider-container' );
slider = new mw.libs.revisionSlider.Slider( revisionList );
slider.getView().render( $container );
$( '#mw-revision-slider-placeholder' ).remove();
} catch ( err ) {
if ( err === 'RS-rev-out-of-range' ) {
$( '#mw-revision-slider-placeholder' )
.text( mw.message( 'revisionslider-loading-out-of-range' ).text() );
console.log( err );
mw.track( 'counter.MediaWiki.RevisionSlider.error.outOfRange' );
} else {
$( '#mw-revision-slider-placeholder' )
.text( mw.message( 'revisionslider-loading-failed' ).text() );
console.log( err );
mw.track( 'counter.MediaWiki.RevisionSlider.error.init' );
}
}
},
error: function ( err ) {
$( '#mw-revision-slider-placeholder' ).remove();
} catch ( err ) {
if ( err === 'RS-rev-out-of-range' ) {
$( '#mw-revision-slider-placeholder' )
.text( mw.message( 'revisionslider-loading-out-of-range' ).text() );
console.log( err );
mw.track( 'counter.MediaWiki.RevisionSlider.error.outOfRange' );
} else {
$( '#mw-revision-slider-placeholder' )
.text( mw.message( 'revisionslider-loading-failed' ).text() );
console.log( err );
mw.track( 'counter.MediaWiki.RevisionSlider.error.init' );
}
} );
} );
} );
}
},
error: function ( err ) {
$( '#mw-revision-slider-placeholder' )
.text( mw.message( 'revisionslider-loading-failed' ).text() );
console.log( err );
mw.track( 'counter.MediaWiki.RevisionSlider.error.init' );
}
} );
}( mediaWiki, jQuery ) );