mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-14 11:16:16 +00:00
a76bd5320f
In jQuery 3 $(document).ready(...) is deprecated. https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function Change-Id: Iff3d7fb07a739fc6ff9b62a2f586c54cd9c8f315
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
( function ( $, mw ) {
|
|
'use strict';
|
|
|
|
/*!
|
|
* Echo Special:Notifications page initialization
|
|
*/
|
|
$( function () {
|
|
var specialPageContainer,
|
|
limitNotifications = 50,
|
|
links = mw.config.get( 'wgNotificationsSpecialPageLinks' ),
|
|
$content = $( '#mw-content-text' ),
|
|
echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications } ),
|
|
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 );
|
|
|
|
// Set default max prioritized action links per item.
|
|
// For general purpose we have 2, for mobile only 1
|
|
mw.echo.config.maxPrioritizedActions = mw.config.get( 'skin' ) === 'minerva' ? 1 : 2;
|
|
|
|
specialPageContainer = new mw.echo.ui.NotificationsInboxWidget(
|
|
controller,
|
|
modelManager,
|
|
{
|
|
limit: limitNotifications,
|
|
$overlay: mw.echo.ui.$overlay,
|
|
prefLink: links.preferences,
|
|
helpLink: links.help
|
|
}
|
|
);
|
|
|
|
// Overlay
|
|
$( 'body' ).append( mw.echo.ui.$overlay );
|
|
|
|
// Notifications
|
|
$content.empty().append( specialPageContainer.$element );
|
|
} );
|
|
}( jQuery, mediaWiki ) );
|