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-12 22:37:36 +00:00
|
|
|
const element = badge.$element[ 0 ];
|
|
|
|
element.classList.add( 'mw-list-item' );
|
2022-09-15 00:31:29 +00:00
|
|
|
|
2023-04-20 19:44:36 +00:00
|
|
|
const iconButtonClasses = [ 'mw-ui-button', 'mw-ui-quiet', 'mw-ui-icon', 'mw-ui-icon-element' ];
|
2023-04-12 22:37:36 +00:00
|
|
|
if ( element.id === 'pt-notifications-alert' ) {
|
|
|
|
const anchor = element.querySelector( 'a' );
|
2023-04-20 19:44:36 +00:00
|
|
|
anchor.classList.add( ...iconButtonClasses, 'mw-ui-icon-bell' );
|
2023-04-12 22:37:36 +00:00
|
|
|
anchor.classList.remove( 'oo-ui-icon-bell' );
|
2022-09-15 00:31:29 +00:00
|
|
|
}
|
2023-04-12 22:37:36 +00:00
|
|
|
if ( element.id === 'pt-notifications-notice' ) {
|
|
|
|
|
|
|
|
const anchor = element.querySelector( 'a' );
|
2023-04-20 19:44:36 +00:00
|
|
|
anchor.classList.add( ...iconButtonClasses, 'mw-ui-icon-tray' );
|
2023-04-12 22:37:36 +00:00
|
|
|
anchor.classList.remove( 'oo-ui-icon-tray' );
|
2022-09-15 00:31:29 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
module.exports = init;
|