mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-25 08:05:51 +00:00
630d47792a
Bug: T335149 Change-Id: I9dad78af21ca7ee272a3661f5869e6337909dc05
29 lines
977 B
JavaScript
29 lines
977 B
JavaScript
/**
|
|
* 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 ) {
|
|
const element = badge.$element[ 0 ];
|
|
element.classList.add( 'mw-list-item' );
|
|
|
|
const iconButtonClasses = [ 'mw-ui-button', 'mw-ui-quiet', 'mw-ui-icon', 'mw-ui-icon-element' ];
|
|
if ( element.id === 'pt-notifications-alert' ) {
|
|
const anchor = element.querySelector( 'a' );
|
|
anchor.classList.add( ...iconButtonClasses, 'mw-ui-icon-bell' );
|
|
anchor.classList.remove( 'oo-ui-icon-bell' );
|
|
}
|
|
if ( element.id === 'pt-notifications-notice' ) {
|
|
|
|
const anchor = element.querySelector( 'a' );
|
|
anchor.classList.add( ...iconButtonClasses, 'mw-ui-icon-tray' );
|
|
anchor.classList.remove( 'oo-ui-icon-tray' );
|
|
}
|
|
} );
|
|
}
|
|
module.exports = init;
|