User:MSchottlender-WMF/GadgetEchoMarkAllRead.js

/** * Experimental! This gadget will mark all notifications as read when the popup opens. * Currently set to only mark 'alerts' as read. */ $(function {	mw.hook( 'ext.echo.popup.onInitialize' ).add( function ( type, controller ) { if ( type === 'alert' ) { // Add pending animation for consistency $( '#pt-notifications-alert .oo-ui-popupWidget-head' ).addClass( 'oo-ui-pendingElement-pending' ); controller.markAllRead( 'local' ) .always( function {					// Remove pending aninmation					$( '#pt-notifications-alert .oo-ui-popupWidget-head' ).removeClass( 'oo-ui-pendingElement-pending' );				} ); }	} ); } );