mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-14 19:24:42 +00:00
2f14374d0a
Removed padding for the tooltips of Slider left, right arrows and help button. Bug: T255752 Change-Id: Iec9d5bc765f627291c9b9824dbd98877d9ee496d
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
( function () {
|
|
/**
|
|
* Module containing presentation logic for the helper button
|
|
*/
|
|
var HelpButtonView = {
|
|
|
|
/**
|
|
* Renders the help button and renders and adds the popup for it.
|
|
*
|
|
* @return {jQuery} the help button object
|
|
*/
|
|
render: function () {
|
|
var helpButton, helpPopup;
|
|
|
|
helpButton = new OO.ui.ButtonWidget( {
|
|
icon: 'helpNotice',
|
|
framed: false,
|
|
classes: [ 'mw-revslider-show-help' ]
|
|
} );
|
|
helpPopup = new OO.ui.PopupWidget( {
|
|
$content: $( '<p>' ).text( mw.msg( 'revisionslider-show-help-tooltip' ) ),
|
|
$floatableContainer: helpButton.$element,
|
|
width: 200,
|
|
classes: [ 'mw-revslider-tooltip', 'mw-revslider-help-tooltip' ]
|
|
} );
|
|
helpButton.connect( this, {
|
|
click: 'showDialog'
|
|
} );
|
|
helpButton.$element
|
|
.on( 'mouseover', function () {
|
|
helpPopup.toggle( true );
|
|
} )
|
|
.on( 'mouseout', function () {
|
|
helpPopup.toggle( false );
|
|
} )
|
|
.children().attr( {
|
|
'aria-haspopup': 'true',
|
|
'aria-label': mw.msg( 'revisionslider-show-help-tooltip' )
|
|
} );
|
|
|
|
$( 'body' ).append( helpPopup.$element );
|
|
|
|
return helpButton.$element;
|
|
},
|
|
|
|
showDialog: function () {
|
|
mw.libs.revisionSlider.HelpDialog.show();
|
|
}
|
|
};
|
|
|
|
mw.libs.revisionSlider = mw.libs.revisionSlider || {};
|
|
mw.libs.revisionSlider.HelpButtonView = HelpButtonView;
|
|
}() );
|