jenkins-bot has submitted this change and it was merged.

Change subject: Make sure header is rendered before binding events to it
......................................................................


Make sure header is rendered before binding events to it

If JavaScript is not loaded at top the event is not
binded

Change-Id: I565d9cd49de4c584e5c9819d89e8e3f6fccf76ae
---
M javascripts/modules/notifications/notifications.js
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/javascripts/modules/notifications/notifications.js 
b/javascripts/modules/notifications/notifications.js
index cfdab1d..7d063ab 100644
--- a/javascripts/modules/notifications/notifications.js
+++ b/javascripts/modules/notifications/notifications.js
@@ -1,17 +1,21 @@
 ( function( M, $ ) {
        var LoadingOverlay = M.require( 'LoadingOverlay' );
 
-       $( '#secondary-button.user-button' ).on( 'click', function( ev ) {
-               var loadingOverlay = new LoadingOverlay();
+       // Once the DOM is loaded hijack the notifications button to display an 
overlay rather
+       // than linking to Special:Notifications.
+       $( function () {
+               $( '#secondary-button.user-button' ).on( 'click', function( ev 
) {
+                       var loadingOverlay = new LoadingOverlay();
 
-               loadingOverlay.show();
-               ev.preventDefault();
+                       loadingOverlay.show();
+                       ev.preventDefault();
 
-               mw.loader.using( 'mobile.notifications.overlay', function() {
-                       var NotificationsOverlay = M.require( 
'modules/notifications/NotificationsOverlay' );
+                       mw.loader.using( 'mobile.notifications.overlay', 
function() {
+                               var NotificationsOverlay = M.require( 
'modules/notifications/NotificationsOverlay' );
 
-                       loadingOverlay.hide();
-                       new NotificationsOverlay( { $badge: $( this ) } 
).show();
+                               loadingOverlay.hide();
+                               new NotificationsOverlay( { $badge: $( this ) } 
).show();
+                       } );
                } );
        } );
 }( mw.mobileFrontend, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/92794
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I565d9cd49de4c584e5c9819d89e8e3f6fccf76ae
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to