mediawiki-skins-MinervaNeue/resources/skins.minerva.options/share.js
Piotr Miazga 51b6e8209b Add share icon as mobile web beta feature
Add a new beta feature - share icon. When user opts into beta
the share icon will be visible on supported devices (Android OS
and Chrome browser).

Bug: T181195
Change-Id: Ie4b9dd05eea9b63422bd174048d8b1251cb02bf4
2018-10-12 22:08:28 +02:00

24 lines
818 B
JavaScript

( function ( M, config ) {
var ShareIcon = M.require( 'skins.minerva.share/ShareIcon' ),
features = config.get( 'wgMinervaFeatures', {} );
/**
* Checks whether ShareIcon is available for given user agent
*
* @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.
new ShareIcon().$el.insertAfter( '#ca-watch' );
}
}( mw.mobileFrontend, mw.config ) );