2018-11-16 15:16:25 +00:00
|
|
|
( function ( M ) {
|
2018-09-26 23:03:20 +00:00
|
|
|
var BackToTopOverlay = M.require( 'skins.minerva.options/BackToTopOverlay' ),
|
2017-07-12 15:12:40 +00:00
|
|
|
backtotop = new BackToTopOverlay(),
|
2018-09-26 23:03:20 +00:00
|
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
2017-07-12 15:12:40 +00:00
|
|
|
browser = M.require( 'mobile.startup/Browser' ).getSingleton();
|
|
|
|
|
|
|
|
// check if browser user agent is iOS (T141598)
|
2018-09-26 23:03:20 +00:00
|
|
|
if ( browser.isIos() || !features.backToTop ) {
|
2017-07-12 15:12:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// initialize the back to top element
|
|
|
|
backtotop.appendTo( 'body' );
|
|
|
|
|
|
|
|
M.on( 'scroll', function () {
|
|
|
|
if ( $( window ).height() - $( window ).scrollTop() <= 0 ) {
|
|
|
|
backtotop.show();
|
|
|
|
} else {
|
|
|
|
backtotop.hide();
|
|
|
|
}
|
|
|
|
} );
|
2018-11-16 15:16:25 +00:00
|
|
|
}( mw.mobileFrontend ) );
|