2018-09-17 23:37:57 +00:00
|
|
|
( function ( M, config ) {
|
2019-01-03 23:26:54 +00:00
|
|
|
var shareIcon = M.require( 'skins.minerva.share/shareIcon' ),
|
2018-09-17 23:37:57 +00:00
|
|
|
features = config.get( 'wgMinervaFeatures', {} );
|
|
|
|
|
|
|
|
/**
|
2019-01-03 23:26:54 +00:00
|
|
|
* Checks whether shareIcon is available for given user agent
|
2018-09-17 23:37:57 +00:00
|
|
|
*
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
|
|
|
function isShareAvailable() {
|
|
|
|
return navigator.share !== undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if browser supports share feature and the feature is enabled
|
|
|
|
if ( isShareAvailable() && features.shareButton ) {
|
|
|
|
// Because the page actions are floated to the right, their order in the
|
|
|
|
// DOM is reversed in the display. The watchstar is last in the DOM and
|
|
|
|
// left-most in the display. Since we want the download button to be to
|
|
|
|
// the left of the watchstar, we put it after it in the DOM.
|
2019-01-03 23:26:54 +00:00
|
|
|
shareIcon( navigator ).$el.insertAfter( '#ca-watch' );
|
2018-09-17 23:37:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}( mw.mobileFrontend, mw.config ) );
|