( function ( $, mw ) { /** * An option widget for the page filter in PageFilterWidget * * @class * @extends OO.ui.OptionWidget * @mixins OO.ui.mixin.IconElement * @mixins OO.ui.mixin.TitledElement * * @constructor * @param {Object} [config] Configuration object * @cfg {number} [unreadCount] Number of unread notifications */ mw.echo.ui.PageNotificationsOptionWidget = function MwEchoUiPageNotificationsOptionWidget( config ) { config = config || {}; // Parent mw.echo.ui.PageNotificationsOptionWidget.parent.call( this, config ); // Mixin constructors OO.ui.mixin.IconElement.call( this, config ); OO.ui.mixin.TitledElement.call( this, config ); this.count = config.unreadCount || 0; this.$label .addClass( 'mw-echo-ui-pageNotificationsOptionWidget-title-label' ); this.unreadCountLabel = new OO.ui.LabelWidget( { classes: [ 'mw-echo-ui-pageNotificationsOptionWidget-label-count' ], label: mw.language.convertNumber( this.count ) } ); // Initialization this.$element .addClass( 'mw-echo-ui-pageNotificationsOptionWidget' ) .toggleClass( 'mw-echo-ui-pageNotificationsOptionWidget-empty', !this.count ) .append( $( '