2018-11-12 13:56:38 +00:00
|
|
|
( function () {
|
2012-12-07 01:08:33 +00:00
|
|
|
'use strict';
|
2016-08-01 23:31:18 +00:00
|
|
|
|
2016-03-16 22:47:20 +00:00
|
|
|
/*!
|
|
|
|
* Echo Special:Notifications page initialization
|
2016-05-11 20:33:17 +00:00
|
|
|
*/
|
2017-01-06 13:06:39 +00:00
|
|
|
$( function () {
|
2024-03-05 22:39:09 +00:00
|
|
|
var limitNotifications = 50,
|
2016-07-23 00:23:54 +00:00
|
|
|
links = mw.config.get( 'wgNotificationsSpecialPageLinks' ),
|
2019-02-06 01:42:53 +00:00
|
|
|
// FIXME: Use CSS transition
|
2019-04-03 22:57:13 +00:00
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
2016-03-16 22:47:20 +00:00
|
|
|
$content = $( '#mw-content-text' ),
|
2016-08-04 14:42:11 +00:00
|
|
|
echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications } ),
|
2016-03-16 22:47:20 +00:00
|
|
|
unreadCounter = new mw.echo.dm.UnreadNotificationCounter( echoApi, [ 'message', 'alert' ], limitNotifications ),
|
2016-07-14 00:03:57 +00:00
|
|
|
modelManager = new mw.echo.dm.ModelManager( unreadCounter, {
|
|
|
|
type: [ 'message', 'alert' ],
|
2016-06-29 23:36:03 +00:00
|
|
|
itemsPerPage: limitNotifications,
|
2017-04-19 13:13:11 +00:00
|
|
|
readState: mw.config.get( 'wgEchoReadState' ),
|
2016-06-29 23:36:03 +00:00
|
|
|
localCounter: new mw.echo.dm.UnreadNotificationCounter(
|
|
|
|
echoApi,
|
|
|
|
[ 'message', 'alert' ],
|
|
|
|
limitNotifications,
|
|
|
|
{
|
|
|
|
localOnly: true,
|
|
|
|
source: 'local'
|
|
|
|
}
|
|
|
|
)
|
2016-07-14 00:03:57 +00:00
|
|
|
} ),
|
2016-11-18 21:16:43 +00:00
|
|
|
controller = new mw.echo.Controller( echoApi, modelManager );
|
2012-12-07 01:08:33 +00:00
|
|
|
|
2016-08-01 23:31:18 +00:00
|
|
|
// 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;
|
|
|
|
|
2024-03-05 22:39:09 +00:00
|
|
|
var specialPageContainer = new mw.echo.ui.NotificationsInboxWidget(
|
2016-06-29 23:36:03 +00:00
|
|
|
controller,
|
|
|
|
modelManager,
|
|
|
|
{
|
|
|
|
limit: limitNotifications,
|
|
|
|
$overlay: mw.echo.ui.$overlay,
|
2019-04-02 14:37:46 +00:00
|
|
|
prefLink: links.preferences
|
2016-06-29 23:36:03 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2016-03-16 22:47:20 +00:00
|
|
|
// Overlay
|
2019-02-06 01:42:53 +00:00
|
|
|
$( document.body ).append( mw.echo.ui.$overlay );
|
2012-12-07 01:08:33 +00:00
|
|
|
|
2016-06-29 23:36:03 +00:00
|
|
|
// Notifications
|
2016-03-16 22:47:20 +00:00
|
|
|
$content.empty().append( specialPageContainer.$element );
|
|
|
|
} );
|
2018-11-12 13:56:38 +00:00
|
|
|
}() );
|