mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-01 02:46:46 +00:00
1dd3af10bb
Now that we have the cog menu, it should be placed correctly in mobile and the "preferences" link should be hidden. Since MobileFrontend doesn't have the personal toolbar, and we can't cheat by using jQuery and grabbing the url of preferences, we have to get SpecialNotifications.php to output the urls to a wg variable and reading it from there. Bug: T115528 Change-Id: I6a69823d6f75c376c04e9a21d79916321e417178
49 lines
1.3 KiB
JavaScript
49 lines
1.3 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, bundle: false } ),
|
|
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
|
|
);
|
|
|
|
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 );
|