mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 11:40:43 +00:00
Merge "Close HelpDialouge when clicking away from it"
This commit is contained in:
commit
a79bccf2ea
|
@ -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 || {};
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue