| 1 |
( function () { |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
mw.echo.ui.ConfirmationPopupWidget = function MwEchoUiConfirmationPopupWidget( config ) { |
| 16 |
config = config || {}; |
| 17 |
|
| 18 |
|
| 19 |
mw.echo.ui.ConfirmationPopupWidget.super.call( this, config ); |
| 20 |
|
| 21 |
this.labelWidget = new OO.ui.LabelWidget( config ); |
| 22 |
this.iconWidget = new OO.ui.IconWidget( Object.assign( { icon: 'checkAll' }, config ) ); |
| 23 |
this.interval = config.interval || 2000; |
| 24 |
|
| 25 |
this.$element |
| 26 |
.addClass( 'mw-echo-ui-confirmationPopupWidget' ) |
| 27 |
.append( |
| 28 |
$( '<div>' ) |
| 29 |
.addClass( 'mw-echo-ui-confirmationPopupWidget-popup' ) |
| 30 |
.append( this.iconWidget.$element, this.labelWidget.$element ) |
| 31 |
) |
| 32 |
|
| 33 |
|
| 34 |
.hide(); |
| 35 |
}; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
OO.inheritClass( mw.echo.ui.ConfirmationPopupWidget, OO.ui.Widget ); |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
mw.echo.ui.ConfirmationPopupWidget.prototype.showAnimated = function () { |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
this.iconWidget.$element.addClass( 'oo-ui-image-invert' ); |
| 49 |
this.$element.show(); |
| 50 |
setTimeout( this.hide.bind( this ), this.interval ); |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
mw.echo.ui.ConfirmationPopupWidget.prototype.hide = function () { |
| 59 |
|
| 60 |
|
| 61 |
this.$element.fadeOut(); |
| 62 |
}; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
mw.echo.ui.ConfirmationPopupWidget.prototype.setLabel = function ( label ) { |
| 71 |
this.labelWidget.setLabel( label ); |
| 72 |
}; |
| 73 |
}() ); |