mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-14 18:05:01 +00:00
5593b23aa8
Replace all occurrences of `M.require( 'mobile.startup/pathToModule' )` with `M.require( 'mobile.startup' ).pathToModule`. Where multiple requires existed, add an intermediate variable, `var mobile = M.require( 'mobile.startup' )`, and dot off that. This changes improves the consistency of MinervaNeue which currently contains a mix of require styles and eliminates any deprecated requires. Bug: T208915 Change-Id: If14f280672d914d07275197100b12421bb217b67
25 lines
689 B
JavaScript
25 lines
689 B
JavaScript
( function ( M ) {
|
|
var BackToTopOverlay = M.require( 'skins.minerva.options/BackToTopOverlay' ),
|
|
backtotop = new BackToTopOverlay(),
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
|
mobile = M.require( 'mobile.startup' ),
|
|
browser = mobile.Browser.getSingleton(),
|
|
eventBus = mobile.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 ) );
|