mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
Merge "Make middle-clicking badge work"
This commit is contained in:
commit
a206bdd9ef
|
@ -33,9 +33,14 @@
|
|||
};
|
||||
|
||||
// Respond to click on the notification button and load the UI on demand
|
||||
$( '.mw-echo-notification-badge-nojs' ).click( function () {
|
||||
$( '.mw-echo-notification-badge-nojs' ).click( function ( e ) {
|
||||
var myType = $( this ).parent().prop( 'id' ) === 'pt-notifications-alert' ? 'alert' : 'message',
|
||||
time = mw.now();
|
||||
|
||||
if ( e.which !== 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dim the button while we load
|
||||
$( this ).addClass( 'mw-echo-notifications-badge-dimmed' );
|
||||
|
||||
|
@ -56,7 +61,8 @@
|
|||
numItems: numMessages,
|
||||
hasUnseen: hasUnseenMessages,
|
||||
badgeIcon: 'speechBubble',
|
||||
links: links
|
||||
links: links,
|
||||
href: $existingMessageLink.attr( 'href' )
|
||||
} );
|
||||
// HACK: avoid late debouncedUpdateThemeClasses
|
||||
mw.echo.ui.messageWidget.badgeButton.debouncedUpdateThemeClasses();
|
||||
|
@ -81,7 +87,8 @@
|
|||
seen: 'bell',
|
||||
unseen: 'bellOn'
|
||||
},
|
||||
links: links
|
||||
links: links,
|
||||
href: $existingAlertLink.attr( 'href' )
|
||||
} );
|
||||
// HACK: avoid late debouncedUpdateThemeClasses
|
||||
mw.echo.ui.alertWidget.badgeButton.debouncedUpdateThemeClasses();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* unseen: 'bellOn',
|
||||
* seen: 'bell'
|
||||
* } }
|
||||
* @cfg {string} [href] URL the badge links to
|
||||
*/
|
||||
mw.echo.ui.BadgeLinkWidget = function MwEchoUiBadgeLinkWidget( config ) {
|
||||
config = config || {};
|
||||
|
@ -30,6 +31,10 @@
|
|||
OO.ui.mixin.FlaggedElement.call( this, $.extend( {}, config, { $flagged: this.$element } ) );
|
||||
|
||||
this.$element.addClass( 'mw-echo-notifications-badge' );
|
||||
|
||||
if ( config.href !== undefined && OO.ui.isSafeUrl( config.href ) ) {
|
||||
this.$element.attr( 'href', config.href );
|
||||
}
|
||||
};
|
||||
|
||||
OO.inheritClass( mw.echo.ui.BadgeLinkWidget, OO.ui.Widget );
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* unseen: 'bellOn',
|
||||
* seen: 'bell'
|
||||
* } }
|
||||
* @cfg {string} [href] URL the badge links to
|
||||
*/
|
||||
mw.echo.ui.NotificationBadgeWidget = function MwEchoUiNotificationBadgeButtonPopupWidget( config ) {
|
||||
var buttonFlags, allNotificationsButton, preferencesButton, footerButtonGroupWidget, $footer;
|
||||
|
@ -52,7 +53,8 @@
|
|||
// The following messages can be used here:
|
||||
// tooltip-pt-notifications-alert
|
||||
// tooltip-pt-notifications-message
|
||||
title: mw.msg( 'tooltip-pt-notifications-' + this.type )
|
||||
title: mw.msg( 'tooltip-pt-notifications-' + this.type ),
|
||||
href: config.href
|
||||
} );
|
||||
|
||||
// View model
|
||||
|
|
Loading…
Reference in a new issue