From 1a8a4312de4bd2f1d4b0fe59b01559d2781f83b7 Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Thu, 2 Jun 2016 18:14:34 +0200 Subject: [PATCH] Move dependencies to extension.json Also removed unused dependency. Bug: T135198 Change-Id: I1ee53ec9d7e123bdca84701b9557aeeeade815ff --- extension.json | 4 ++ modules/ext.RevisionSlider.init.js | 78 ++++++++++++++---------------- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/extension.json b/extension.json index f5d95b38..71420ff9 100644 --- a/extension.json +++ b/extension.json @@ -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": { diff --git a/modules/ext.RevisionSlider.init.js b/modules/ext.RevisionSlider.init.js index 0311ac92..68b83612 100644 --- a/modules/ext.RevisionSlider.init.js +++ b/modules/ext.RevisionSlider.init.js @@ -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 ) );