mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-28 08:00:32 +00:00
51b6e8209b
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
42 lines
906 B
JavaScript
42 lines
906 B
JavaScript
( function ( M, msg, config ) {
|
|
var GLYPH = 'share',
|
|
Icon = M.require( 'mobile.startup/Icon' );
|
|
|
|
/**
|
|
* A download icon for triggering print functionality
|
|
* @class ShareIcon
|
|
* @extends Icon
|
|
|
|
* @constructor
|
|
*/
|
|
function ShareIcon() {
|
|
var options = {};
|
|
options.tagName = 'li';
|
|
options.glyphPrefix = 'minerva';
|
|
options.title = msg( 'skin-minerva-share' );
|
|
options.name = GLYPH;
|
|
Icon.call( this, options );
|
|
}
|
|
|
|
OO.mfExtend( ShareIcon, Icon, {
|
|
/**
|
|
* onClick handler for button that invokes print function
|
|
*
|
|
* @memberof ShareIcon
|
|
* @instance
|
|
*/
|
|
onClick: function () {
|
|
navigator.share( {
|
|
title: config.get( 'wgTitle' ),
|
|
text: config.get( 'wgTitle' ),
|
|
url: window.location.href.split( '#' )[ 0 ]
|
|
} );
|
|
},
|
|
events: {
|
|
click: 'onClick'
|
|
}
|
|
} );
|
|
|
|
M.define( 'skins.minerva.share/ShareIcon', ShareIcon );
|
|
}( mw.mobileFrontend, mw.msg, mw.config ) );
|