Debian Codegraph @

extensions/Echo/modules/special/ext.echo.special.js

raw symbols SCIP
1 ( function () {
2 'use strict';
3
4 /*!
5 * Echo Special:Notifications page initialization
6 */
7 $( () => {
8 const limitNotifications = 50,
9 links = mw.config.get( 'wgNotificationsSpecialPageLinks' ),
10 // FIXME: Use CSS transition
11 // eslint-disable-next-line no-jquery/no-global-selector
12 $content = $( '#mw-content-text' ),
13 echoApi = new mw.echo.api.EchoApi( { limit: limitNotifications } ),
14 unreadCounter = new mw.echo.dm.UnreadNotificationCounter( echoApi, [ 'message', 'alert' ], limitNotifications ),
15 modelManager = new mw.echo.dm.ModelManager( unreadCounter, {
16 type: [ 'message', 'alert' ],
17 itemsPerPage: limitNotifications,
18 readState: mw.config.get( 'wgEchoReadState' ),
19 localCounter: new mw.echo.dm.UnreadNotificationCounter(
20 echoApi,
21 [ 'message', 'alert' ],
22 limitNotifications,
23 {
24 localOnly: true,
25 source: 'local'
26 }
27 )
28 } ),
29 controller = new mw.echo.Controller( echoApi, modelManager );
30
31 // Set default max prioritized action links per item.
32 // For general purpose we have 2, for mobile only 1
33 mw.echo.config.maxPrioritizedActions = mw.config.get( 'skin' ) === 'minerva' ? 1 : 2;
34
35 const specialPageContainer = new mw.echo.ui.NotificationsInboxWidget(
36 controller,
37 modelManager,
38 {
39 limit: limitNotifications,
40 $overlay: mw.echo.ui.$overlay,
41 prefLink: links.preferences
42 }
43 );
44
45 // Overlay
46 $( document.body ).append( mw.echo.ui.$overlay );
47
48 // Notifications
49 $content.empty().append( specialPageContainer.$element );
50 } );
51 }() );