// Parent
mw.rcfilters.ui.LiveUpdateButtonWidget.parent.call( this, $.extend( {
- icon: 'play',
label: mw.message( 'rcfilters-liveupdates-button' ).text()
}, config ) );
this.model.connect( this, { liveUpdateChange: 'onLiveUpdateChange' } );
this.$element.addClass( 'mw-rcfilters-ui-liveUpdateButtonWidget' );
+
+ this.setState( false );
};
/* Initialization */
};
/**
- * Respond to the 'live update' feature being turned on/off
+ * Set the button's state and change its appearance
*
* @param {boolean} enable Whether the 'live update' feature is now on/off
*/
- mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.onLiveUpdateChange = function ( enable ) {
+ mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.setState = function ( enable ) {
this.setValue( enable );
this.setIcon( enable ? 'stop' : 'play' );
+ this.setTitle( mw.message(
+ enable ?
+ 'rcfilters-liveupdates-button-title-on' :
+ 'rcfilters-liveupdates-button-title-off'
+ ).text() );
+ };
+
+ /**
+ * Respond to the 'live update' feature being turned on/off
+ *
+ * @param {boolean} enable Whether the 'live update' feature is now on/off
+ */
+ mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.onLiveUpdateChange = function ( enable ) {
+ this.setState( enable );
};
}( mediaWiki ) );