2022-09-15 00:31:29 +00:00
|
|
|
/**
|
|
|
|
* Upgrades Echo for icon consistency.
|
|
|
|
* Undos work inside Echo to replace our button.
|
|
|
|
*/
|
|
|
|
function init() {
|
|
|
|
if ( document.querySelectorAll( '#pt-notifications-alert a, #pt-notifications-notice a' ).length !== 2 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mw.hook( 'ext.echo.NotificationBadgeWidget.onInitialize' ).add( function ( badge ) {
|
2023-04-11 17:22:58 +00:00
|
|
|
const $element = badge.$element;
|
2022-09-15 00:31:29 +00:00
|
|
|
$element.addClass( 'mw-list-item' );
|
|
|
|
|
2023-04-11 17:22:58 +00:00
|
|
|
const iconButtonClasses = 'mw-ui-button mw-ui-quiet mw-ui-icon mw-ui-icon-element ';
|
2022-09-15 00:31:29 +00:00
|
|
|
if ( $element.attr( 'id' ) === 'pt-notifications-alert' ) {
|
|
|
|
$element.children( 'a' ).addClass( iconButtonClasses + 'mw-ui-icon-bell' );
|
|
|
|
$element.children( 'a' ).removeClass( 'oo-ui-icon-bell' );
|
|
|
|
}
|
|
|
|
if ( $element.attr( 'id' ) === 'pt-notifications-notice' ) {
|
|
|
|
$element.children( 'a' ).addClass( iconButtonClasses + 'mw-ui-icon-tray' );
|
|
|
|
$element.children( 'a' ).removeClass( 'oo-ui-icon-tray' );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
module.exports = init;
|