mediawiki-extensions-Echo/modules/special/ext.echo.special.js
Stephane Bisson 3600a271c5 Enable local bundles on mobile
Have the 'bundle' param always
controlled by the controller
instead of configured in the
API.

Change-Id: I08fb7c515f1af28fc01073702b552624cc14f2f0
2016-08-04 10:42:11 -04:00

54 lines
1.5 KiB
JavaScript

( function ( $, mw ) {
'use strict';
/*!
* Echo Special:Notifications page initialization
*/
$( document ).ready( 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 );