Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/204972
Change subject: Simplify Drawer hide listeners ...................................................................... Simplify Drawer hide listeners * Add event listeners to window only (body and #mw-mf-page-center have the same effect) * Fix reopening of drawer when closed by scrolling (real problem was, that the hide listener wasn't removed from body on hide Change-Id: Icd36c29a13c538deaada53227eb804b3927ad41b --- M javascripts/Drawer.js 1 file changed, 4 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/72/204972/1 diff --git a/javascripts/Drawer.js b/javascripts/Drawer.js index 7eeac8c..3ee2e37 100644 --- a/javascripts/Drawer.js +++ b/javascripts/Drawer.js @@ -45,15 +45,13 @@ * ShowDrawer event handler */ onShowDrawer: function () { - var self = this; + var self = this, + $window = $( window ); setTimeout( function () { - $( 'body' ).one( 'click.drawer', $.proxy( self, 'hide' ) ); + $window.one( 'click.drawer', $.proxy( self, 'hide' ) ); if ( self.closeOnScroll ) { - $( window ).one( 'scroll.drawer', $.proxy( self, 'hide' ) ); + $window.one( 'scroll.drawer', $.proxy( self, 'hide' ) ); } - // can't use 'body' because the drawer will be closed when - // tapping on it and clicks will be prevented - $( '#mw-mf-page-center' ).one( 'click.drawer', $.proxy( self, 'hide' ) ); }, self.minHideDelay ); }, @@ -64,7 +62,6 @@ // .one() registers one callback for scroll and click independently // if one fired, get rid of the other one $( window ).off( '.drawer' ); - $( '#mw-mf-page-center' ).off( '.drawer' ); } } ); -- To view, visit https://gerrit.wikimedia.org/r/204972 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd36c29a13c538deaada53227eb804b3927ad41b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits