mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-18 03:31:34 +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
49 lines
1.9 KiB
JavaScript
49 lines
1.9 KiB
JavaScript
/**
|
|
* This module is loaded by resources/skins.minerva.mainMenu/MainMenu.js
|
|
* inside the Minerva skin. It should be moved to Minerva at our earliest possible
|
|
* convenience.
|
|
*/
|
|
mw.loader.using( [
|
|
'ext.eventLogging.subscriber'
|
|
] ).then( function () {
|
|
var M = mw.mobileFrontend,
|
|
user = mw.user,
|
|
editCount = mw.config.get( 'wgUserEditCount' ),
|
|
// Schema provided by ext.eventLogging.subscriber class
|
|
Schema = mw.eventLog.Schema, // resource-modules-disable-line
|
|
context = M.require( 'mobile.startup' ).context,
|
|
/**
|
|
* MobileWebMainMenuClickTracking schema
|
|
* https://meta.wikimedia.org/wiki/Schema:MobileWebMainMenuClickTracking
|
|
*
|
|
* @class MobileWebMainMenuClickTracking
|
|
* @singleton
|
|
*/
|
|
schemaMobileWebMainMenuClickTracking = new Schema(
|
|
'MobileWebMainMenuClickTracking',
|
|
mw.config.get( 'wgMinervaSchemaMainMenuClickTrackingSampleRate' ),
|
|
/**
|
|
* @property {Object} defaults Default options hash.
|
|
* @property {string} defaults.mobileMode whether user is in stable or beta
|
|
* @property {string} [defaults.username] Username if the user is logged in,
|
|
* otherwise - undefined.
|
|
* Assigning undefined will make event logger omit this property when sending
|
|
* the data to a server. According to the schema username is optional.
|
|
* @property {number} [defaults.userEditCount] The number of edits the user has made
|
|
* if the user is logged in, otherwise - undefined. Assigning undefined will make event
|
|
* logger omit this property when sending the data to a server. According to the schema
|
|
* userEditCount is optional.
|
|
*/
|
|
{
|
|
mode: context.getMode() || 'desktop',
|
|
username: user.getName() || undefined,
|
|
// FIXME: Use edit bucket here (T210106)
|
|
userEditCount: typeof editCount === 'number' ? editCount : undefined
|
|
}
|
|
);
|
|
|
|
mw.trackSubscribe( 'minerva.schemaMobileWebMainMenuClickTracking', function ( topic, data ) {
|
|
schemaMobileWebMainMenuClickTracking.log( data );
|
|
} );
|
|
} );
|