2015-08-13 00:54:16 +00:00
|
|
|
( function ( mw, $ ) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
if ( mw.echo.Logger.static.clickThroughEnabled ) {
|
|
|
|
mw.loader.using( 'ext.eventLogging', function () {
|
|
|
|
mw.eventLog.setDefaults( 'EchoInteraction', {
|
|
|
|
version: mw.config.get( 'wgEchoConfig' ).version,
|
|
|
|
userId: +mw.config.get( 'wgUserId' ),
|
|
|
|
editCount: +mw.config.get( 'wgUserEditCount' )
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activate ooui
|
|
|
|
$( document ).ready( function () {
|
2015-09-07 23:54:47 +00:00
|
|
|
var $existingAlertLink = $( '#pt-notifications-alert a' ),
|
|
|
|
$existingMessageLink = $( '#pt-notifications-message a' ),
|
2015-08-13 00:54:16 +00:00
|
|
|
numAlerts = $existingAlertLink.text(),
|
|
|
|
numMessages = $existingMessageLink.text(),
|
2015-09-03 21:24:03 +00:00
|
|
|
hasUnseenAlerts = $existingAlertLink.hasClass( 'mw-echo-unseen-notifications' ),
|
|
|
|
hasUnseenMessages = $existingMessageLink.hasClass( 'mw-echo-unseen-notifications' ),
|
2015-08-13 00:54:16 +00:00
|
|
|
// Store links
|
|
|
|
links = {
|
2015-09-08 15:27:40 +00:00
|
|
|
notifications: $( '#pt-notifications-alert a' ).attr( 'href' ),
|
2015-08-13 00:54:16 +00:00
|
|
|
preferences: $( '#pt-preferences a' ).attr( 'href' )
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( $existingMessageLink.length ) {
|
|
|
|
mw.echo.ui.messageWidget = new mw.echo.ui.NotificationBadgeWidget( {
|
|
|
|
type: 'message',
|
|
|
|
markReadWhenSeen: false,
|
|
|
|
numItems: numMessages,
|
2015-09-03 21:24:03 +00:00
|
|
|
hasUnseen: hasUnseenMessages,
|
2015-08-13 00:54:16 +00:00
|
|
|
badgeIcon: 'speechBubble',
|
|
|
|
links: links
|
|
|
|
} );
|
|
|
|
$existingMessageLink.replaceWith( mw.echo.ui.messageWidget.$element );
|
|
|
|
}
|
|
|
|
|
|
|
|
mw.echo.ui.alertWidget = new mw.echo.ui.NotificationBadgeWidget( {
|
|
|
|
type: 'alert',
|
|
|
|
markReadWhenSeen: true,
|
|
|
|
numItems: numAlerts,
|
2015-09-03 21:24:03 +00:00
|
|
|
hasUnseen: hasUnseenAlerts,
|
2015-08-13 00:54:16 +00:00
|
|
|
badgeIcon: {
|
2015-09-03 21:24:03 +00:00
|
|
|
seen: 'bell',
|
|
|
|
unseen: 'bellOn'
|
2015-08-13 00:54:16 +00:00
|
|
|
},
|
|
|
|
links: links
|
|
|
|
} );
|
|
|
|
$existingAlertLink.replaceWith( mw.echo.ui.alertWidget.$element );
|
|
|
|
} );
|
|
|
|
|
|
|
|
} )( mediaWiki, jQuery );
|