mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 17:50:39 +00:00
545d4e67ae
Add a global-wiki 'mark all as read' to the Special:Notifications page. The 'mark all as read' will makr all notifications in the given wiki. The context of the wiki changes when filters are chosen, and so the message of the button changes as well. Bug: T115528 Change-Id: Ibd9dcdf7072d6cbc1a268c18e558e6d0df28f929
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
( function ( $, mw ) {
|
|
'use strict';
|
|
/*!
|
|
* Echo Special:Notifications page initialization
|
|
*/
|
|
$( document ).ready( function () {
|
|
var prefLink, specialPageContainer,
|
|
limitNotifications = 50,
|
|
$content = $( '#mw-content-text' ),
|
|
echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications, bundle: false } ),
|
|
unreadCounter = new mw.echo.dm.UnreadNotificationCounter( echoApi, [ 'message', 'alert' ], limitNotifications ),
|
|
modelManager = new mw.echo.dm.ModelManager( unreadCounter, {
|
|
type: [ 'message', 'alert' ],
|
|
itemsPerPage: limitNotifications,
|
|
localCounter: new mw.echo.dm.UnreadNotificationCounter(
|
|
echoApi,
|
|
[ 'message', 'alert' ],
|
|
limitNotifications,
|
|
{
|
|
localOnly: true,
|
|
source: 'local'
|
|
}
|
|
)
|
|
} ),
|
|
controller = new mw.echo.Controller(
|
|
echoApi,
|
|
modelManager
|
|
);
|
|
|
|
prefLink = new mw.Uri( $( '#pt-preferences a' ).prop( 'href' ) );
|
|
prefLink.fragment = 'mw-prefsection-echo';
|
|
|
|
specialPageContainer = new mw.echo.ui.NotificationsInboxWidget(
|
|
controller,
|
|
modelManager,
|
|
{
|
|
limit: limitNotifications,
|
|
$overlay: mw.echo.ui.$overlay,
|
|
prefLink: prefLink.toString(),
|
|
helpLink: $( '#mw-indicator-mw-helplink a' ).prop( 'href' )
|
|
}
|
|
);
|
|
|
|
// Overlay
|
|
$( 'body' ).append( mw.echo.ui.$overlay );
|
|
|
|
// Notifications
|
|
$content.empty().append( specialPageContainer.$element );
|
|
} );
|
|
} )( jQuery, mediaWiki );
|