mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-24 10:49:37 +00:00
Fire 'ext.echo.badge.countChange' after DOM changes
The event should fire after the count actually changes in the DOM as well as the internal workings of Echo. Change-Id: I03f1742b209305080af8784632f07dff63135d81
This commit is contained in:
parent
4a9cf5b2e2
commit
5c35535f36
|
@ -52,17 +52,17 @@
|
||||||
mw.echo.ui.BadgeLinkWidget.prototype.setCount = function ( numItems, label ) {
|
mw.echo.ui.BadgeLinkWidget.prototype.setCount = function ( numItems, label ) {
|
||||||
label = label || numItems;
|
label = label || numItems;
|
||||||
|
|
||||||
|
this.$element
|
||||||
|
.toggleClass( 'mw-echo-notifications-badge-all-read', !numItems )
|
||||||
|
.toggleClass( 'mw-echo-notifications-badge-long-label', label.length > 2 )
|
||||||
|
.attr( 'data-counter-num', numItems )
|
||||||
|
.attr( 'data-counter-text', label );
|
||||||
|
|
||||||
if ( this.count !== numItems ) {
|
if ( this.count !== numItems ) {
|
||||||
this.count = numItems;
|
this.count = numItems;
|
||||||
|
|
||||||
// Fire badge count change hook
|
// Fire badge count change hook
|
||||||
mw.hook( 'ext.echo.badge.countChange' ).fire( this.type, this.count, label );
|
mw.hook( 'ext.echo.badge.countChange' ).fire( this.type, this.count, label );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$element
|
|
||||||
.toggleClass( 'mw-echo-notifications-badge-all-read', !numItems )
|
|
||||||
.toggleClass( 'mw-echo-notifications-badge-long-label', label.length > 2 )
|
|
||||||
.attr( 'data-counter-num', numItems )
|
|
||||||
.attr( 'data-counter-text', label );
|
|
||||||
};
|
};
|
||||||
}( mediaWiki, jQuery ) );
|
}( mediaWiki, jQuery ) );
|
||||||
|
|
Loading…
Reference in a new issue