Debian Codegraph @

extensions/Echo/modules/mobile/notificationsFilterOverlay.js

raw symbols SCIP
1 const Overlay = require( 'mobile.startup' ).Overlay;
2
3 /**
4 * @module module:ext.echo.mobile
5 */
6
7 /**
8 * Overlay for notifications filter
9 *
10 * @class NotificationsFilterOverlay
11 * @param {Object} options
12 * @param {Function} options.onBeforeExit executes before overlay closes
13 * @param {jQuery} options.$notifReadState - notification read status widgets
14 * @param {jQuery} options.$crossWikiUnreadFilter - notification unread filter
15 */
16 function notificationsFilterOverlay( options ) {
17 // Don't call overlay.hide(), because that doesn't invoke the onBeforeExit callback (T258954)
18 // Instead, change the hash, so that the OverlayManager hides the overlay for us
19 function hideOverlay() {
20 location.hash = '#';
21 }
22
23 // Close overlay when a selection is made
24 options.$crossWikiUnreadFilter.on( 'click', hideOverlay );
25 options.$notifReadState.find( '.oo-ui-buttonElement' ).on( 'click', hideOverlay );
26
27 const $content = $( '<div>' ).append(
28 $( '<div>' )
29 .addClass( 'notifications-filter-overlay-read-state' )
30 .append( options.$notifReadState ),
31 options.$crossWikiUnreadFilter
32 );
33
34 const overlay = Overlay.make( {
35 onBeforeExit: options.onBeforeExit,
36 heading: '<strong>' + mw.message( 'echo-mobile-notifications-filter-title' ).escaped() + '</strong>',
37 className: 'overlay notifications-filter-overlay notifications-overlay navigation-drawer'
38 }, { $el: $content } );
39 return overlay;
40 }
41
42 module.exports = notificationsFilterOverlay;