2013-06-18 15:23:35 +00:00
|
|
|
( function ( $, mw ) {
|
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 () {
|
2016-07-23 00:23:54 +00:00
|
|
|
var specialPageContainer,
|
2016-06-29 23:36:03 +00:00
|
|
|
limitNotifications = 50,
|
2016-07-23 00:23:54 +00:00
|
|
|
links = mw.config.get( 'wgNotificationsSpecialPageLinks' ),
|
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;
|
|
|
|
|
2016-06-29 23:36:03 +00:00
|
|
|
specialPageContainer = new mw.echo.ui.NotificationsInboxWidget(
|
|
|
|
controller,
|
|
|
|
modelManager,
|
|
|
|
{
|
|
|
|
limit: limitNotifications,
|
|
|
|
$overlay: mw.echo.ui.$overlay,
|
2016-07-23 00:23:54 +00:00
|
|
|
prefLink: links.preferences,
|
|
|
|
helpLink: links.help
|
2016-06-29 23:36:03 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2016-03-16 22:47:20 +00:00
|
|
|
// Overlay
|
|
|
|
$( '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 );
|
|
|
|
} );
|
2016-11-18 21:16:43 +00:00
|
|
|
}( jQuery, mediaWiki ) );
|