Merge "Close HelpDialouge when clicking away from it"

This commit is contained in:
jenkins-bot 2016-09-15 10:14:33 +00:00 committed by Gerrit Code Review
commit a79bccf2ea
2 changed files with 24 additions and 6 deletions

View file

@ -162,15 +162,31 @@
} );
/**
* Shows the help dialog
* Initializes the help dialog
*/
HelpDialog.show = function () {
HelpDialog.init = function () {
var windowManager = new OO.ui.WindowManager(),
dialogue = new HelpDialog( { size: 'medium', classes: [ 'revisionslider-help-dialog' ] } );
dialogue;
$( 'body' ).append( windowManager.$element );
windowManager.addWindows( [ dialogue ] );
windowManager.openWindow( dialogue );
$( 'body' )
.append( windowManager.$element )
.click( function ( event ) {
if ( $( event.target ).hasClass( 'revisionslider-help-dialog' ) ) {
HelpDialog.hide();
}
} );
HelpDialog.show = function () {
dialogue = new HelpDialog( { size: 'medium', classes: [ 'revisionslider-help-dialog' ] } );
windowManager.addWindows( [ dialogue ] );
windowManager.openWindow( dialogue );
};
HelpDialog.hide = function () {
if ( windowManager.hasWindow( dialogue ) ) {
windowManager.closeWindow( dialogue );
}
};
};
mw.libs.revisionSlider = mw.libs.revisionSlider || {};

View file

@ -15,6 +15,8 @@
mw.track( 'counter.MediaWiki.RevisionSlider.event.init' );
mw.libs.revisionSlider.userOffset = mw.user.options.values.timecorrection ? mw.user.options.values.timecorrection.split( '|' )[ 1 ] : mw.config.values.extRevisionSliderTimeOffset;
mw.libs.revisionSlider.HelpDialog.init();
api.fetchRevisionData( mw.config.get( 'wgPageName' ), {
startId: mw.config.values.extRevisionSliderNewRev,
limit: mw.libs.revisionSlider.calculateRevisionsPerWindow( 160, 16 )