| 1 |
( function () { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
$( () => { |
| 8 |
const limitNotifications = 50, |
| 9 |
links = mw.config.get( 'wgNotificationsSpecialPageLinks' ), |
| 10 |
|
| 11 |
|
| 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 |
|
| 32 |
|
| 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 |
|
| 46 |
$( document.body ).append( mw.echo.ui.$overlay ); |
| 47 |
|
| 48 |
|
| 49 |
$content.empty().append( specialPageContainer.$element ); |
| 50 |
} ); |
| 51 |
}() ); |