mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-11 05:46:09 +00:00
5bfd949f9a
This patch removes the remaining usages of M.on/M.off/M.emit (functionality derived from moduleLoader.js in MobileFrontend) in Minerva and continues the work of Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 (patch for MobileFrontend). This patch and the patch for MobileFrontend should be merged together as they both depend on eachother. Depends-On: Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 Bug: T156186 Change-Id: I005d2fcdbf91c2f1ac98178dfa388aa8174e7530
24 lines
693 B
JavaScript
24 lines
693 B
JavaScript
( function ( M ) {
|
|
var BackToTopOverlay = M.require( 'skins.minerva.options/BackToTopOverlay' ),
|
|
backtotop = new BackToTopOverlay(),
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
|
browser = M.require( 'mobile.startup/Browser' ).getSingleton(),
|
|
eventBus = M.require( 'mobile.startup/eventBusSingleton' );
|
|
|
|
// check if browser user agent is iOS (T141598)
|
|
if ( browser.isIos() || !features.backToTop ) {
|
|
return;
|
|
}
|
|
|
|
// initialize the back to top element
|
|
backtotop.appendTo( 'body' );
|
|
|
|
eventBus.on( 'scroll', function () {
|
|
if ( $( window ).height() - $( window ).scrollTop() <= 0 ) {
|
|
backtotop.show();
|
|
} else {
|
|
backtotop.hide();
|
|
}
|
|
} );
|
|
}( mw.mobileFrontend ) );
|