mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-26 16:40:33 +00:00
44ee12c717
This completes the changes to Echo inside the vectorvisualenhancementnext=1 feature flag Bug: T257143 Change-Id: I8f3904815c90ef1a10a2342c5c70363c8b9e1e47
30 lines
1 KiB
JavaScript
30 lines
1 KiB
JavaScript
/**
|
|
* Upgrades Echo for icon consistency.
|
|
* Undos work inside Echo to replace our button.
|
|
*/
|
|
function init() {
|
|
if ( !document.body.classList.contains( 'vector-feature-visual-enhancement-next-enabled' ) ) {
|
|
return;
|
|
}
|
|
if ( document.querySelectorAll( '#pt-notifications-alert a, #pt-notifications-notice a' ).length !== 2 ) {
|
|
return;
|
|
}
|
|
|
|
// @ts-ignore
|
|
mw.hook( 'ext.echo.NotificationBadgeWidget.onInitialize' ).add( function ( badge ) {
|
|
var $element = badge.$element;
|
|
$element.addClass( 'mw-list-item' );
|
|
|
|
var iconButtonClasses = 'mw-ui-button mw-ui-quiet mw-ui-icon mw-ui-icon-element ';
|
|
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;
|