w/extensions/MobileFrontend/resources/mobile.init/init.js
/**
	 * Displays a prompt to ask the user to join the mobile beta mode.
	 *
	 * @method
	 * @private
	 * @param {Object} experiment sampling data
	 * @param {Page} page
	 * @ignore
	 */
Displays a prompt to ask the user to join the mobile beta mode.
Displays a prompt to ask the user to join the mobile beta mode .
function displayBetaOptIn( experiment, page ) {
		var betaOptinPanel, inStable, inSample,
			token = storage.get( 'mobile-betaoptin-token' );
		if ( token !== false && token !== '~' &&
			!page.isMainPage() && !page.inNamespace( 'special' )
		) {
			if ( !token ) {
				token = user.generateRandomSessionId();
				storage.set( 'mobile-betaoptin-token', token );
			}
			inStable = context.getMode() === 'stable';
			inSample = experiments.getBucket( experiment, token ) === 'A';
			if ( inStable && ( inSample || util.getParamValue( 'debug' ) ) ) {
				betaOptinPanel = new BetaOptinPanel( {
					postUrl: util.getUrl( 'Special:MobileOptions', {
						returnto: page.title
					} )
				} );
				betaOptinPanel
					.on( 'hide', function () {
						storage.set( 'mobile-betaoptin-token', '~' );
					} ).appendTo( page.getLeadSectionElement() );
			}
			mw.track( 'mobile.betaoptin', {
				isPanelShown: betaOptinPanel !== undefined
			} );
		}
	}
function displayBetaOptIn ( experiment , page ) { var betaOptinPanel , inStable , inSample , token = storage . get ( 'mobile-betaoptin-token' ) ; if ( token !== false && token !== '~' && ! page . isMainPage ( ) && ! page . inNamespace ( 'special' ) ) { if ( ! token ) { token = user . generateRandomSessionId ( ) ; storage . set ( 'mobile-betaoptin-token' , token ) ; } inStable = context . getMode ( ) === 'stable' ; inSample = experiments . getBucket ( experiment , token ) === 'A' ; if ( inStable && ( inSample || util . getParamValue ( 'debug' ) ) ) { betaOptinPanel = new BetaOptinPanel ( { postUrl : util . getUrl ( 'Special:MobileOptions' , { returnto : page . title } ) } ) ; betaOptinPanel . on ( 'hide' , function ( ) { storage . set ( 'mobile-betaoptin-token' , '~' ) ; } ) . appendTo ( page . getLeadSectionElement ( ) ) ; } mw . track ( 'mobile.betaoptin' , { isPanelShown : betaOptinPanel !== undefined } ) ; } }
Displays a prompt to ask the user to join the mobile beta mode.
Displays a prompt to ask the user to join the mobile beta mode .
// local storage is supported in this case, when ~ means it was dismissed // let the interested parties e.g. QuickSurveys know whether the panel is shown