mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 09:16:34 +00:00
cbad0bd363
It's presumed that skin options will eventually become the default or be removed from the skin. While they are not the default, it would be helpful to package them in one single module - as ResourceLoader modules are costly bloating the dependency graph in the MediaWiki startup module. In T167713 we talked about grouping our entry points by page rather than feature, which this seems consistent with. A page with special options enabled is different from a page without. Change-Id: Id948f913d4743532ba3442d2059a03c122419ff2
23 lines
635 B
JavaScript
23 lines
635 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();
|
|
|
|
// check if browser user agent is iOS (T141598)
|
|
if ( browser.isIos() || !features.backToTop ) {
|
|
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();
|
|
}
|
|
} );
|
|
}( mw.mobileFrontend, jQuery ) );
|