{"version":3,"sources":["webpack://mfModules.[name]/./src/mobile.init/editor.js","webpack://mfModules.[name]/./src/mobile.init/editorLoadingOverlay.js","webpack://mfModules.[name]/./src/mobile.init/eventLogging/schemaEditAttemptStep.js","webpack://mfModules.[name]/./src/mobile.init/eventLogging/schemaVisualEditorFeatureUse.js","webpack://mfModules.[name]/./src/mobile.init/lazyLoadedImages.js","webpack://mfModules.[name]/./src/mobile.init/mobile.init.js","webpack://mfModules.[name]/./src/mobile.init/toggling.js"],"names":["M","require","util","editorLoadingOverlay","OverlayManager","$editTab","$","user","mw","CtaDrawer","contentModel","config","get","veConfig","editCount","editorPath","onEditLinkClick","elem","ev","router","section","length","getParamValue","href","navigate","preventDefault","setupEditor","page","skin","currentPageHTMLParser","uri","fragment","editorOverride","overlayManager","getSingleton","isNewPage","id","firstInitDone","on","this","hook","add","$content","find","sectionId","animationDelayDeferred","abortableDataPromise","loadingOverlay","overlayPromise","scrollTop","window","pageYOffset","$contentText","editorOptions","fakeScroll","api","Api","licenseMsg","getLicenseMsg","title","titleObj","isAnon","oldId","contentLang","attr","contentDir","sessionId","Uri","query","editingStatsId","generateRandomSessionId","initMechanism","logInit","editor","track","action","type","mechanism","editor_interface","editing_session_id","shouldLoadVisualEditor","isVisualEditorEnabled","preferredEditor","defaultEditor","tokenData","options","storage","getObject","expires","Date","now","remove","getPreferredEditor","visualEditorNamespaces","namespaces","isWikiText","indexOf","loadSourceEditor","fire","loader","using","then","undefined","Deferred","$page","$sectionTop","enableVisualSectionEditing","document","body","addClass","closest","prop","getBoundingClientRect","top","css","transform","setTimeout","resolve","abort","removeClass","mode","dataPromise","libs","ve","targetLoader","requestPageData","getPrefixedDb","sessionStore","targetName","addPlugin","loadModules","VisualEditorOverlay","SourceEditorOverlay","Promise","all","overlay","getLoadingPromise","overlayData","stack","replaceCurrent","error","apiResponse","back","show","appendChild","$el","notify","getErrorMessage","msg","i","editUri","toString","e","getPath","history","pushState","veaction","replaceState","init","currentPage","isReadOnly","editRestrictions","hide","hideSectionEditIcons","Array","isArray","drawer","showLoginDrawer","content","signupQueryParams","warning","route","checkRoute","bindEditLinksLoginDrawer","$link","bindEditLinksSorryToast","message","parseDom","module","exports","isMissing","isEditingSupported","isSupported","inNamespace","fakeToolbar","Overlay","afterShow","afterHide","$fakeToolbar","className","noHeader","isBorderBox","onBeforeExit","exit","prototype","call","appendTo","Schema","sampleRate","actionPrefixMap","timing","schemaEditAttemptStep","trackdebug","exists","eventLog","firstChange","saveIntent","saveAttempt","saveSuccess","saveFailure","page_id","revision_id","page_title","page_ns","user_id","getId","user_class","user_editcount","mw_version","platform","integration","page_token","getPageviewToken","session_token","version","trackSubscribe","topic","data","actionPrefix","timeStamp","duration","anonymous_user_token","bucket","token","cookie","Math","round","event","ready","log","warn","abort_type","computeDuration","is_oversample","inSample","console","apply","arguments","defaults","eventName","customData","extend","dispatch","schemaVisualEditorFeatureUse","feature","editingSessionId","lazyImageLoader","$container","imagePlaceholders","queryPlaceholders","addEventListener","loadImages","observer","IntersectionObserver","entries","forEach","entry","placeholder","target","isIntersecting","loadImage","unobserve","rootMargin","threshold","observe","placeholderClass","url","USER_FONT_SIZE_REGULAR","USER_FONT_SIZES","toggling","lazyLoadedImages","skinName","isPageContentModelEditable","editorAvailableSkins","$window","getWindow","Skin","eventBus","apply2","fn1","fn2","updateFontSize","userFontSize","fontSize","fontClass","documentElement","classList","debounce","emit","throttle","URL","location","searchParams","has","delete","Toggler","$contentContainer","prefix","removeAttr","mfTempOpenSection"],"mappings":"uKACA,IAAIA,EAAIC,EAAS,iDAChBC,EAAOD,EAAS,gCAChBE,EAAuBF,EAAS,6CAChCG,EAAiBH,EAAS,0CAI1BI,EAAWC,EAAG,YAEdC,EAAOC,GAAGD,KACVE,EAAYR,EAAS,qCACrBS,EAAeF,GAAGG,OAAOC,IAAK,sBAC9BC,EAAWL,GAAGG,OAAOC,IAAK,wBAC1BE,EAAYN,GAAGG,OAAOC,IAAK,mBAC3BG,EAAa,8BAYd,SAASC,EA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aAMzDrG,OAAOkN,iBAAkB,YAAY,WACpC+B,OAGDA,IAKKjP,OAAOmM,SAAWnM,OAAOmM,QAAQN,KAAO7L,OAAOmM,QAAQN,IAAIO,OAC9D9O,GAAGG,OAAOC,IAAK,mCAChByO,QAAQN,IAAKvO,GAAG4I,IAAK,qCAKhBW,EAAYwB,YAAa,YAAemG,IAIM,IAA9CC,EAAqB3L,QAASyL,IAGG,OAAhCjR,GAAGG,OAAOC,IAAK,aACnB6D,EAAQsF,EAAalI,EAAuBD,GAK/C2P,IACAC,IAKAhR,GAAG2F,OAAOC,MAAO,oBAAqBC,MAAM,WAC3CoG,IACAoD,Q,gDCpJD3E,EAAOC,QAAU,WAChB,IACCpB,EAAc9J,EAAS,sCAATA,GACdgT,EAAUhT,EAAS,mCACnB8R,EAAW9R,EAAS,6CA+BnB8J,EAAYwB,YAAa,YACM,SAAhC/K,GAAGG,OAAOC,IAAK,aAEfJ,GAAGgC,KAAM,oBAAqBC,KAAK,SAAWwN,GAC7C,IAAIiD,EAAoBjD,EAAWtN,KAAM,qBAEP,IAA7BuQ,EAAkB7R,SACtB6R,EAAoBjD,GA3BvB,SAAeA,EAAYkD,EAAQxR,GAGlCsO,EAAWtN,KAAM,oBAAqByQ,WAAY,gBAGhB9M,IAA7BpD,OAAOmQ,0BACJnQ,OAAOmQ,kBAGf,IAAIJ,EAAS,CACZhD,WAAYA,EACZkD,OAAQA,EACRxR,KAAMA,EACNoQ,SAAUA,IAeVjI,CAAMoJ,EAAmB,WAAYnJ,S","file":"mobile.init.js","sourcesContent":["/* global $ */\nvar M = require( '../mobile.startup/moduleLoaderSingleton' ),\n\tutil = require( '../mobile.startup/util' ),\n\teditorLoadingOverlay = require( './editorLoadingOverlay' ),\n\tOverlayManager = require( '../mobile.startup/OverlayManager' ),\n\t// #ca-edit, .mw-editsection are standard MediaWiki elements\n\t// .edit-link comes from MobileFrontend user page creation CTA\n\t// Links in content are handled separately to allow reloading the content (T324686)\n\t$editTab = $( '#ca-edit' ),\n\tEDITSECTION_SELECTOR = '.mw-editsection a, .edit-link',\n\tuser = mw.user,\n\tCtaDrawer = require( '../mobile.startup/CtaDrawer' ),\n\tcontentModel = mw.config.get( 'wgPageContentModel' ),\n\tveConfig = mw.config.get( 'wgVisualEditorConfig' ),\n\teditCount = mw.config.get( 'wgUserEditCount' ),\n\teditorPath = /^\\/editor\\/(\\d+|T-\\d+|all)$/;\n\n/**\n * Event handler for edit link clicks. Will prevent default link\n * behaviour and will not allow propagation\n *\n * @method\n * @ignore\n * @param {HTMLElement} elem\n * @param {jQuery.Event} ev\n * @param {Router} router\n */\nfunction onEditLinkClick( elem, ev, router ) {\n\tvar section;\n\tif ( $( EDITSECTION_SELECTOR ).length === 0 ) {\n\t\t// If section edit links are not available, the only edit link\n\t\t// should allow editing the whole page (T232170)\n\t\tsection = 'all';\n\t} else {\n\t\tsection = mw.util.getParamValue( 'section', elem.href ) || 'all';\n\t}\n\t// Don't do anything for section edit links for different pages (transcluded)\n\tif ( mw.config.get( 'wgPageName' ) !== mw.util.getParamValue( 'title', elem.href ) ) {\n\t\treturn;\n\t}\n\trouter.navigate( '#/editor/' + section );\n\t// DO NOT USE stopPropagation or you'll break click tracking in WikimediaEvents\n\t// You DO NOT NEED to\n\t// prevent folding section when clicking Edit by stopping propagation\n\t// as this is a concern of the Toggler class and taken care of by inspecting\n\t// !ev.target.href (see Toggler.js)\n\t// avoid navigating to ?action=edit\n\tev.preventDefault();\n}\n\n/**\n * Retrieve the user's preferred editor setting. If none is set, return the default\n * editor for this wiki.\n *\n * @method\n * @ignore\n * @return {string} Either 'VisualEditor' or 'SourceEditor'\n */\nfunction getPreferredEditor() {\n\tvar defaultEditor, tokenData,\n\t\tpreferredEditor = mw.user.options.get( 'mobile-editor' ) || mw.storage.get( 'preferredEditor' );\n\tif ( preferredEditor ) {\n\t\treturn preferredEditor;\n\t}\n\tdefaultEditor = mw.config.get( 'wgMFDefaultEditor' );\n\t// Cleaning up after ABTest, remove soon\n\ttokenData = mw.storage.getObject( 'MFDefaultEditorABToken' );\n\tif ( tokenData && tokenData.expires < Date.now() ) {\n\t\t// The storage never expires by itself. We should keep this for a while, even if we remove\n\t\t// the rest of this code, to clean up after ourselves.\n\t\tmw.storage.remove( 'MFDefaultEditorABToken' );\n\t\ttokenData = null;\n\t}\n\tswitch ( defaultEditor ) {\n\t\tcase 'source':\n\t\t\treturn 'SourceEditor';\n\t\tcase 'visual':\n\t\t\treturn 'VisualEditor';\n\t\tcase 'preference':\n\t\t\t// First check if the user has actually used the desktop editor.\n\t\t\t// This is done hackily by checking if they have the preference\n\t\t\t// set to suppress the welcome dialog or user education popups. (T261423)\n\t\t\tif ( mw.user.options.get( 'visualeditor-hidebetawelcome' ) || mw.user.options.get( 'visualeditor-hideusered' ) ) {\n\t\t\t\treturn mw.user.options.get( 'visualeditor-editor' ) === 'visualeditor' ? 'VisualEditor' : 'SourceEditor';\n\t\t\t} else {\n\t\t\t\t// We don't know what their preference is.\n\t\t\t\t// For now, continue to give them the source editor.\n\t\t\t\treturn 'SourceEditor';\n\t\t\t}\n\t}\n\t// In the event of misconfiguration, fall back to source\n\treturn 'SourceEditor';\n}\n\n/**\n * Initialize the edit button so that it launches the editor interface when clicked.\n *\n * @method\n * @ignore\n * @param {Page} page The page to edit.\n * @param {Skin} skin\n * @param {PageHTMLParser} currentPageHTMLParser\n * @param {Router} router\n */\nfunction setupEditor( page, skin, currentPageHTMLParser, router ) {\n\tvar uri, fragment, editorOverride,\n\t\toverlayManager = OverlayManager.getSingleton(),\n\t\tisNewPage = page.id === 0,\n\t\tfirstInitDone = false;\n\n\t$editTab.on( 'click', function ( ev ) {\n\t\tonEditLinkClick( this, ev, overlayManager.router );\n\t} );\n\tmw.hook( 'wikipage.content' ).add( function ( $content ) {\n\t\t$content.find( EDITSECTION_SELECTOR ).on( 'click', function ( ev ) {\n\t\t\tonEditLinkClick( this, ev, overlayManager.router );\n\t\t} );\n\t} );\n\n\toverlayManager.add( editorPath, function ( sectionId ) {\n\t\tvar\n\t\t\tscrollTop = window.pageYOffset,\n\t\t\t$contentText = $( '#mw-content-text' ),\n\t\t\teditorOptions = {\n\t\t\t\toverlayManager: overlayManager,\n\t\t\t\tcurrentPageHTMLParser: currentPageHTMLParser,\n\t\t\t\tfakeScroll: 0,\n\t\t\t\tapi: new mw.Api(),\n\t\t\t\tlicenseMsg: skin.getLicenseMsg(),\n\t\t\t\ttitle: page.title,\n\t\t\t\ttitleObj: page.titleObj,\n\t\t\t\tisAnon: user.isAnon(),\n\t\t\t\tisNewPage: isNewPage,\n\t\t\t\teditCount: editCount,\n\t\t\t\toldId: mw.util.getParamValue( 'oldid' ),\n\t\t\t\tcontentLang: $contentText.attr( 'lang' ),\n\t\t\t\tcontentDir: $contentText.attr( 'dir' ),\n\t\t\t\tsessionId: mw.config.get( 'wgWMESchemaEditAttemptStepSessionId' ) ||\n\t\t\t\t\tmw.Uri().query.editingStatsId ||\n\t\t\t\t\tuser.generateRandomSessionId()\n\t\t\t},\n\t\t\tanimationDelayDeferred, abortableDataPromise, loadingOverlay, overlayPromise,\n\t\t\tinitMechanism = mw.util.getParamValue( 'redlink' ) ? 'new' : 'click';\n\n\t\tif ( sectionId !== 'all' ) {\n\t\t\teditorOptions.sectionId = page.isWikiText() ? sectionId : undefined;\n\t\t}\n\n\t\tfunction showLoading() {\n\t\t\tvar $page, $content, $sectionTop, fakeScroll, enableVisualSectionEditing;\n\n\t\t\t$( document.body ).addClass( 've-loading' );\n\n\t\t\t$page = $( '#mw-mf-page-center' );\n\t\t\t$content = $( '#content' );\n\t\t\tif ( sectionId === '0' || sectionId === 'all' ) {\n\t\t\t\t$sectionTop = $( '#bodyContent' );\n\t\t\t} else {\n\t\t\t\t$sectionTop = $( '[data-section=\"' + sectionId + '\"]' )\n\t\t\t\t\t.closest( 'h1, h2, h3, h4, h5, h6' );\n\t\t\t\t// When loading on action=edit URLs, there is no page content\n\t\t\t\tif ( !$sectionTop.length ) {\n\t\t\t\t\t$sectionTop = $( '#bodyContent' );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Pretend that we didn't just scroll the page to the top.\n\t\t\t$page.prop( 'scrollTop', scrollTop );\n\t\t\t// Then, pretend that we're scrolling to the position of the clicked heading.\n\t\t\tfakeScroll = $sectionTop[0].getBoundingClientRect().top;\n\t\t\t// Adjust for height of the toolbar.\n\t\t\tfakeScroll -= 48;\n\t\t\tif ( shouldLoadVisualEditor() ) {\n\t\t\t\tenableVisualSectionEditing = veConfig.enableVisualSectionEditing === true ||\n\t\t\t\t\t// === ve.init.mw.MobileArticleTarget.static.trackingName\n\t\t\t\t\tveConfig.enableVisualSectionEditing === 'mobile';\n\t\t\t\tif ( sectionId === '0' || sectionId === 'all' || enableVisualSectionEditing ) {\n\t\t\t\t\t// Adjust for surface padding. Only needed if we're at the beginning of the doc.\n\t\t\t\t\tfakeScroll -= 16;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( sectionId === '0' || sectionId === 'all' ) {\n\t\t\t\t\tfakeScroll -= 16;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$content.css( {\n\t\t\t\t// Use transform instead of scroll for smoother animation (via CSS transitions).\n\t\t\t\ttransform: 'translate( 0, ' + -fakeScroll + 'px )',\n\t\t\t\t// If the clicked heading is near the end of the page, we might need to insert\n\t\t\t\t// some extra space to allow us to scroll \"beyond the end\" of the page.\n\t\t\t\t'padding-bottom': '+=' + fakeScroll,\n\t\t\t\t'margin-bottom': '-=' + fakeScroll\n\t\t\t} );\n\t\t\teditorOptions.fakeScroll = fakeScroll;\n\t\t\tsetTimeout( animationDelayDeferred.resolve, 500 );\n\t\t}\n\n\t\tfunction clearLoading() {\n\t\t\tif ( abortableDataPromise && abortableDataPromise.abort ) {\n\t\t\t\tabortableDataPromise.abort();\n\t\t\t}\n\n\t\t\t$( '#content' ).css( {\n\t\t\t\ttransform: '',\n\t\t\t\t'padding-bottom': '',\n\t\t\t\t'margin-bottom': ''\n\t\t\t} );\n\n\t\t\t$( document.body ).removeClass( 've-loading' );\n\t\t}\n\n\t\t/**\n\t\t * Log init event to edit schema.\n\t\t * Need to log this from outside the Overlay object because that module\n\t\t * won't have loaded yet.\n\t\t *\n\t\t * @private\n\t\t * @ignore\n\t\t * @param {string} editor name e.g. wikitext or visualeditor\n\t\t * @method\n\t\t */\n\t\tfunction logInit( editor ) {\n\t\t\tif ( firstInitDone ) {\n\t\t\t\teditorOptions.sessionId = user.generateRandomSessionId();\n\t\t\t}\n\t\t\tmw.track( 'mf.schemaEditAttemptStep', {\n\t\t\t\taction: 'init',\n\t\t\t\ttype: 'section',\n\t\t\t\tmechanism: initMechanism,\n\t\t\t\t/* eslint-disable camelcase */\n\t\t\t\teditor_interface: editor,\n\t\t\t\tediting_session_id: editorOptions.sessionId\n\t\t\t\t/* eslint-enable camelcase */\n\t\t\t} );\n\t\t\tfirstInitDone = true;\n\t\t}\n\n\t\t/**\n\t\t * Check whether VisualEditor should be loaded\n\t\t *\n\t\t * @private\n\t\t * @ignore\n\t\t * @method\n\t\t * @return {bool}\n\t\t */\n\t\tfunction shouldLoadVisualEditor() {\n\t\t\tvar\n\t\t\t\t// FIXME: Should we consider default site options and user prefs?\n\t\t\t\tisVisualEditorEnabled = !!veConfig,\n\t\t\t\tpreferredEditor = getPreferredEditor(),\n\t\t\t\tvisualEditorNamespaces = ( veConfig && veConfig.namespaces ) || [];\n\n\t\t\treturn isVisualEditorEnabled &&\n\n\t\t\t\t// Only for pages with a wikitext content model\n\t\t\t\tpage.isWikiText() &&\n\n\t\t\t\t// Only in enabled namespaces\n\t\t\t\tvisualEditorNamespaces.indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 &&\n\n\t\t\t\t// Not on pages which are outputs of the Page Translation feature\n\t\t\t\tmw.config.get( 'wgTranslatePageTranslation' ) !== 'translation' &&\n\n\t\t\t\t(\n\t\t\t\t\t// If the user prefers the VisualEditor or the user has no preference and\n\t\t\t\t\t// the VisualEditor is the default editor for this wiki\n\t\t\t\t\tpreferredEditor === 'VisualEditor' ||\n\t\t\t\t\t// We've loaded it via the URL for this request\n\t\t\t\t\teditorOverride === 'VisualEditor'\n\t\t\t\t) &&\n\n\t\t\t\teditorOverride !== 'SourceEditor';\n\t\t}\n\n\t\t/**\n\t\t * Load source editor\n\t\t *\n\t\t * @private\n\t\t * @ignore\n\t\t * @method\n\t\t * @return {jQuery.Promise} Promise resolved with the editor overlay\n\t\t */\n\t\tfunction loadSourceEditor() {\n\t\t\tlogInit( 'wikitext' );\n\t\t\t// Inform other interested code that we're loading the editor\n\t\t\tmw.hook( 'mobileFrontend.editorOpening' ).fire();\n\n\t\t\treturn mw.loader.using( 'mobile.editor.overlay' ).then( function () {\n\t\t\t\tvar SourceEditorOverlay = M.require( 'mobile.editor.overlay/SourceEditorOverlay' );\n\t\t\t\treturn new SourceEditorOverlay( editorOptions );\n\t\t\t} );\n\t\t}\n\n\t\t/**\n\t\t * Load visual editor. If it fails to load for any reason, load the source editor instead.\n\t\t *\n\t\t * @private\n\t\t * @ignore\n\t\t * @method\n\t\t * @return {jQuery.Promise} Promise resolved with the editor overlay\n\t\t */\n\t\tfunction loadVisualEditorMaybe() {\n\t\t\tlogInit( 'visualeditor' );\n\t\t\t// Inform other interested code that we're loading the editor\n\t\t\tmw.hook( 'mobileFrontend.editorOpening' ).fire();\n\n\t\t\teditorOptions.mode = 'visual';\n\t\t\teditorOptions.dataPromise = mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {\n\t\t\t\tabortableDataPromise = mw.libs.ve.targetLoader.requestPageData(\n\t\t\t\t\teditorOptions.mode,\n\t\t\t\t\teditorOptions.titleObj.getPrefixedDb(),\n\t\t\t\t\t{\n\t\t\t\t\t\tsessionStore: true,\n\t\t\t\t\t\tsection: editorOptions.sectionId === undefined ?\n\t\t\t\t\t\t\tnull : editorOptions.sectionId,\n\t\t\t\t\t\toldId: editorOptions.oldId || undefined,\n\t\t\t\t\t\t// Should be ve.init.mw.MobileArticleTarget.static.trackingName,\n\t\t\t\t\t\t// but the class hasn't loaded yet.\n\t\t\t\t\t\ttargetName: 'mobile'\n\t\t\t\t\t} );\n\t\t\t\treturn abortableDataPromise;\n\t\t\t} );\n\n\t\t\treturn mw.loader.using( 'ext.visualEditor.targetLoader' )\n\t\t\t\t.then( function () {\n\t\t\t\t\tmw.libs.ve.targetLoader.addPlugin( 'mobile.editor.ve' );\n\t\t\t\t\treturn mw.libs.ve.targetLoader.loadModules( editorOptions.mode );\n\t\t\t\t} )\n\t\t\t\t.then( function () {\n\t\t\t\t\tvar VisualEditorOverlay = M.require( 'mobile.editor.overlay/VisualEditorOverlay' ),\n\t\t\t\t\t\tSourceEditorOverlay = M.require( 'mobile.editor.overlay/SourceEditorOverlay' );\n\t\t\t\t\teditorOptions.SourceEditorOverlay = SourceEditorOverlay;\n\t\t\t\t\treturn new VisualEditorOverlay( editorOptions );\n\t\t\t\t}, function () {\n\t\t\t\t\treturn loadSourceEditor();\n\t\t\t\t} );\n\t\t}\n\n\t\tanimationDelayDeferred = util.Deferred();\n\n\t\t// showLoading() has to run after the overlay has opened, which disables page scrolling.\n\t\t// clearLoading() has to run after the loading overlay is hidden in any way\n\t\t// (either when loading is aborted, or when the editor overlay is shown instead).\n\t\tloadingOverlay = editorLoadingOverlay( showLoading, clearLoading );\n\n\t\tif ( shouldLoadVisualEditor() ) {\n\t\t\toverlayPromise = loadVisualEditorMaybe();\n\t\t} else {\n\t\t\toverlayPromise = loadSourceEditor();\n\t\t}\n\n\t\t// Wait for the scroll animation to finish before we show the editor overlay\n\t\tutil.Promise.all( [ overlayPromise, animationDelayDeferred ] ).then( function ( overlay ) {\n\t\t\t// Wait for the data to load before we show the editor overlay\n\t\t\toverlay.getLoadingPromise().then( function () {\n\t\t\t\t// Make sure the user did not close the loading overlay while we were waiting\n\t\t\t\tvar overlayData = overlayManager.stack[0];\n\t\t\t\tif ( !overlayData || overlayData.overlay !== loadingOverlay ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Show the editor!\n\t\t\t\toverlayManager.replaceCurrent( overlay );\n\t\t\t}, function ( error, apiResponse ) {\n\t\t\t\t// Could not load the editor.\n\t\t\t\toverlayManager.router.back();\n\t\t\t\tif ( error.show ) {\n\t\t\t\t\t// Probably a blockMessageDrawer returned because the user is blocked.\n\t\t\t\t\tdocument.body.appendChild( error.$el[ 0 ] );\n\t\t\t\t\terror.show();\n\t\t\t\t} else if ( apiResponse ) {\n\t\t\t\t\tmw.notify( editorOptions.api.getErrorMessage( apiResponse ) );\n\t\t\t\t} else {\n\t\t\t\t\tmw.notify( mw.msg( 'mobile-frontend-editor-error-loading' ) );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn loadingOverlay;\n\t} );\n\n\t$( '#ca-edit a' ).prop( 'href', function ( i, href ) {\n\t\ttry {\n\t\t\tvar editUri = new mw.Uri( href );\n\t\t\t// By default the editor opens section 0 (lead section), rather than the whole article.\n\t\t\t// This might be changed in the future (T210659).\n\t\t\teditUri.query.section = '0';\n\t\t\treturn editUri.toString();\n\t\t} catch ( e ) {\n\t\t\t// T106244 - the href couldn't be parsed likely due to invalid UTF-8\n\t\t\treturn href;\n\t\t}\n\t} );\n\n\t// We use wgAction instead of getParamValue('action') as the former can be\n\t// overridden by hooks to stop the editor loading automatically.\n\tif ( !router.getPath() && ( mw.util.getParamValue( 'veaction' ) || mw.config.get( 'wgAction' ) === 'edit' ) ) {\n\t\tif ( mw.util.getParamValue( 'veaction' ) === 'edit' ) {\n\t\t\teditorOverride = 'VisualEditor';\n\t\t} else if ( mw.util.getParamValue( 'veaction' ) === 'editsource' ) {\n\t\t\teditorOverride = 'SourceEditor';\n\t\t}\n\t\t// else: action=edit, for which we allow the default to take effect\n\t\tfragment = '#/editor/' + ( mw.util.getParamValue( 'section' ) || ( mw.config.get( 'wgAction' ) === 'edit' ? 'all' : '0' ) );\n\t\t// eslint-disable-next-line no-restricted-properties\n\t\tif ( window.history && history.pushState ) {\n\t\t\turi = mw.Uri();\n\t\t\tdelete uri.query.action;\n\t\t\tdelete uri.query.veaction;\n\t\t\tdelete uri.query.section;\n\t\t\t// Note: replaceState rather than pushState, because we're\n\t\t\t// just reformatting the URL to the equivalent-meaning for the\n\t\t\t// mobile site.\n\t\t\thistory.replaceState( null, document.title, uri.toString() + fragment );\n\t\t} else {\n\t\t\trouter.navigate( fragment );\n\t\t}\n\t}\n}\n\n/**\n * Hide any section id icons in the page. This will not hide the edit icon in the page action\n * menu.\n *\n * @method\n * @ignore\n * @param {PageHTMLParser} currentPageHTMLParser\n */\nfunction hideSectionEditIcons( currentPageHTMLParser ) {\n\tcurrentPageHTMLParser.$el.find( '.mw-editsection' ).hide();\n}\n\n/**\n * Show a drawer with log in / sign up buttons.\n *\n * @method\n * @ignore\n * @param {Router} router\n */\nfunction bindEditLinksLoginDrawer( router ) {\n\tvar drawer;\n\tfunction showLoginDrawer() {\n\t\tif ( !drawer ) {\n\t\t\tdrawer = new CtaDrawer( {\n\t\t\t\tcontent: mw.msg( 'mobile-frontend-editor-disabled-anon' ),\n\t\t\t\tsignupQueryParams: {\n\t\t\t\t\twarning: 'mobile-frontend-watchlist-signup-action'\n\t\t\t\t}\n\t\t\t} );\n\t\t\tdocument.body.appendChild( drawer.$el[ 0 ] );\n\t\t}\n\t\tdrawer.show();\n\t}\n\t$editTab.on( 'click', function ( ev ) {\n\t\tshowLoginDrawer();\n\t\tev.preventDefault();\n\t} );\n\tmw.hook( 'wikipage.content' ).add( function ( $content ) {\n\t\t$content.find( EDITSECTION_SELECTOR ).on( 'click', function ( ev ) {\n\t\t\tshowLoginDrawer();\n\t\t\tev.preventDefault();\n\t\t} );\n\t} );\n\trouter.route( editorPath, function () {\n\t\tshowLoginDrawer();\n\t} );\n\trouter.checkRoute();\n}\n\n/**\n * Setup the editor if the user can edit the page otherwise show a sorry toast.\n *\n * @method\n * @ignore\n * @param {Page} currentPage\n * @param {PageHTMLParser} currentPageHTMLParser\n * @param {Skin} skin\n * @param {Router} router\n */\nfunction init( currentPage, currentPageHTMLParser, skin, router ) {\n\tvar isReadOnly, isEditable, editErrorMessage, editRestrictions;\n\t// see: https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific\n\tisReadOnly = mw.config.get( 'wgMinervaReadOnly' );\n\tisEditable = !isReadOnly && mw.config.get( 'wgIsProbablyEditable' );\n\n\tif ( isEditable ) {\n\t\t// Edit button updated in setupEditor.\n\t\tsetupEditor( currentPage, skin, currentPageHTMLParser, router );\n\t} else {\n\t\thideSectionEditIcons( currentPageHTMLParser );\n\t\teditRestrictions = mw.config.get( 'wgRestrictionEdit' );\n\t\tif ( mw.user.isAnon() && Array.isArray( editRestrictions ) && !editRestrictions.length ) {\n\t\t\tbindEditLinksLoginDrawer( router );\n\t\t} else {\n\t\t\tvar $link = $( '<a>' ).attr( 'href', '/wiki/' + mw.config.get( 'wgPageName' ) + '?action=edit' );\n\t\t\teditErrorMessage = isReadOnly ? mw.msg( 'apierror-readonly' ) : mw.message( 'mobile-frontend-editor-disabled', $link ).parseDom();\n\t\t\tbindEditLinksSorryToast( editErrorMessage, router );\n\t\t}\n\t}\n}\n\n/**\n * Wire up events that ensure we\n * show a toast message with sincere condolences when user navigates to\n * #/editor or clicks on an edit button\n *\n * @method\n * @ignore\n * @param {string} msg Message for sorry message\n * @param {Router} router\n */\nfunction bindEditLinksSorryToast( msg, router ) {\n\t$editTab.on( 'click', function ( ev ) {\n\t\tmw.notify( msg );\n\t\tev.preventDefault();\n\t} );\n\tmw.hook( 'wikipage.content' ).add( function ( $content ) {\n\t\t$content.find( EDITSECTION_SELECTOR ).on( 'click', function ( ev ) {\n\t\t\tmw.notify( msg );\n\t\t\tev.preventDefault();\n\t\t} );\n\t} );\n\trouter.route( editorPath, function () {\n\t\tmw.notify( msg );\n\t} );\n\trouter.checkRoute();\n}\n\nmodule.exports = function ( currentPage, currentPageHTMLParser, skin ) {\n\tvar isMissing = currentPage.id === 0,\n\t\trouter = mw.loader.require( 'mediawiki.router' ),\n\t\tisEditingSupported = router.isSupported();\n\n\tif ( contentModel !== 'wikitext' ) {\n\t\t// Only load the wikitext editor on wikitext. Otherwise we'll rely on the fallback behaviour\n\t\t// (You can test this on MediaWiki:Common.css) ?action=edit url (T173800)\n\t\treturn;\n\t}\n\n\tif ( mw.util.getParamValue( 'undo' ) ) {\n\t\t// Our fancy editor doesn't support undo, but we can rely on the fallback.\n\t\treturn;\n\t}\n\n\tif ( !isEditingSupported ) {\n\t\t// Browser doesn't support mobile editor use the fallback editor.\n\t\treturn;\n\t}\n\n\tif ( currentPage.inNamespace( 'file' ) && isMissing ) {\n\t\t// Is a new file page (enable upload image only) T60311\n\t\tbindEditLinksSorryToast( mw.msg( 'mobile-frontend-editor-uploadenable' ), router );\n\t} else {\n\t\t// Edit button is currently hidden. A call to init() will update it as needed.\n\t\tinit( currentPage, currentPageHTMLParser, skin, router );\n\t}\n};\n","var\n\tfakeToolbar = require( './fakeToolbar' ),\n\tOverlay = require( '../mobile.startup/Overlay' );\n\n/**\n * Like loadingOverlay(), but with a fake editor toolbar instead of the spinner.\n *\n * @param {Function} afterShow Callback which runs after overlay is shown\n * @param {Function} afterHide Callback which runs after overlay is hidden\n * @return {Overlay}\n */\nfunction editorLoadingOverlay( afterShow, afterHide ) {\n\tvar\n\t\t$fakeToolbar = fakeToolbar(),\n\t\toverlay = new Overlay( {\n\t\t\tclassName: 'overlay overlay-loading',\n\t\t\tnoHeader: true,\n\t\t\tisBorderBox: false,\n\t\t\tonBeforeExit: function ( exit ) {\n\t\t\t\texit();\n\t\t\t\tafterHide();\n\t\t\t}\n\t\t} );\n\n\toverlay.show = function () {\n\t\tOverlay.prototype.show.call( this );\n\t\tafterShow();\n\t};\n\n\t$fakeToolbar.appendTo( overlay.$el.find( '.overlay-content' ) );\n\n\t// Animate the toolbar sliding into place.\n\t$fakeToolbar.addClass( 'toolbar-hidden' );\n\tsetTimeout( function () {\n\t\t$fakeToolbar.addClass( 'toolbar-shown' );\n\t\tsetTimeout( function () {\n\t\t\t$fakeToolbar.addClass( 'toolbar-shown-done' );\n\t\t}, 250 );\n\t} );\n\n\treturn overlay;\n}\n\nmodule.exports = editorLoadingOverlay;\n","module.exports = function () {\n\tvar trackdebug = !!mw.util.getParamValue( 'trackdebug' ),\n\t\tutil = require( '../../mobile.startup/util' );\n\n\tif ( !mw.config.exists( 'wgWMESchemaEditAttemptStepSamplingRate' ) ) {\n\t\treturn;\n\t}\n\n\t( function () {\n\t\tvar // Schema class is provided by ext.eventLogging\n\t\t\tSchema = mw.eventLog.Schema,\n\t\t\tuser = mw.user,\n\t\t\tsampleRate = mw.config.get( 'wgWMESchemaEditAttemptStepSamplingRate' ),\n\t\t\tactionPrefixMap = {\n\t\t\t\tfirstChange: 'first_change',\n\t\t\t\tsaveIntent: 'save_intent',\n\t\t\t\tsaveAttempt: 'save_attempt',\n\t\t\t\tsaveSuccess: 'save_success',\n\t\t\t\tsaveFailure: 'save_failure'\n\t\t\t},\n\t\t\ttiming = {},\n\t\t\t/**\n\t\t\t * Edit schema\n\t\t\t * https://meta.wikimedia.org/wiki/Schema:EditAttemptStep\n\t\t\t */\n\t\t\t/* eslint-disable camelcase */\n\t\t\tschemaEditAttemptStep = new Schema(\n\t\t\t\t'EditAttemptStep',\n\t\t\t\tsampleRate,\n\t\t\t\t{\n\t\t\t\t\tpage_id: mw.config.get( 'wgArticleId' ),\n\t\t\t\t\trevision_id: mw.config.get( 'wgRevisionId' ),\n\t\t\t\t\tpage_title: mw.config.get( 'wgPageName' ),\n\t\t\t\t\tpage_ns: mw.config.get( 'wgNamespaceNumber' ),\n\t\t\t\t\tuser_id: user.getId(),\n\t\t\t\t\tuser_class: user.isAnon() ? 'IP' : undefined,\n\t\t\t\t\tuser_editcount: mw.config.get( 'wgUserEditCount', 0 ),\n\t\t\t\t\tmw_version: mw.config.get( 'wgVersion' ),\n\t\t\t\t\tplatform: 'phone',\n\t\t\t\t\tintegration: 'page',\n\t\t\t\t\tpage_token: user.getPageviewToken(),\n\t\t\t\t\tsession_token: user.sessionId(),\n\t\t\t\t\tversion: 1\n\t\t\t\t}\n\t\t\t);\n\t\t\t/* eslint-enable camelcase */\n\n\t\tfunction log() {\n\t\t\t// mw.log is a no-op unless resource loader is in debug mode, so\n\t\t\t// this allows trackdebug to work independently (T211698)\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log.apply( console, arguments );\n\t\t}\n\n\t\tfunction computeDuration( action, event, timeStamp ) {\n\t\t\t// This is duplicated from the VisualEditor extension\n\t\t\t// (ve.init.mw.trackSubscriber.js). Changes to this should be kept in\n\t\t\t// sync with that file, so the data remains consistent.\n\t\t\tif ( event.timing !== undefined ) {\n\t\t\t\treturn event.timing;\n\t\t\t}\n\n\t\t\tswitch ( action ) {\n\t\t\t\tcase 'ready':\n\t\t\t\t\treturn timeStamp - timing.init;\n\t\t\t\tcase 'loaded':\n\t\t\t\t\treturn timeStamp - timing.init;\n\t\t\t\tcase 'firstChange':\n\t\t\t\t\treturn timeStamp - timing.ready;\n\t\t\t\tcase 'saveIntent':\n\t\t\t\t\treturn timeStamp - timing.ready;\n\t\t\t\tcase 'saveAttempt':\n\t\t\t\t\treturn timeStamp - timing.saveIntent;\n\t\t\t\tcase 'saveSuccess':\n\t\t\t\tcase 'saveFailure':\n\t\t\t\t\t// HERE BE DRAGONS: the caller must compute these themselves\n\t\t\t\t\t// for sensible results. Deliberately sabotage any attempts to\n\t\t\t\t\t// use the default by returning -1\n\t\t\t\t\tmw.log.warn( 'mf.schemaEditAttemptStep: Do not rely on default timing value for saveSuccess/saveFailure' );\n\t\t\t\t\treturn -1;\n\t\t\t\tcase 'abort':\n\t\t\t\t\tswitch ( event.abort_type ) {\n\t\t\t\t\t\tcase 'preinit':\n\t\t\t\t\t\t\treturn timeStamp - timing.init;\n\t\t\t\t\t\tcase 'nochange':\n\t\t\t\t\t\tcase 'switchwith':\n\t\t\t\t\t\tcase 'switchwithout':\n\t\t\t\t\t\tcase 'switchnochange':\n\t\t\t\t\t\tcase 'abandon':\n\t\t\t\t\t\t\treturn timeStamp - timing.ready;\n\t\t\t\t\t\tcase 'abandonMidsave':\n\t\t\t\t\t\t\treturn timeStamp - timing.saveAttempt;\n\t\t\t\t\t}\n\t\t\t\t\tmw.log.warn( 'mf.schemaEditAttemptStep: Unrecognized abort type', event.type );\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tmw.log.warn( 'mf.schemaEditAttemptStep: Unrecognized action', action );\n\t\t\treturn -1;\n\t\t}\n\n\t\tmw.trackSubscribe( 'mf.schemaEditAttemptStep', function ( topic, data ) {\n\t\t\tvar actionPrefix = actionPrefixMap[ data.action ] || data.action,\n\t\t\t\ttimeStamp = mw.now(),\n\t\t\t\tduration = 0;\n\n\t\t\t// These are always the same for every event, but they can't be set in defaults,\n\t\t\t// because the mw.config values are not present yet then, because they are set\n\t\t\t// by JS code in editor.js. This is a little silly.\n\t\t\tif ( !mw.storage.get( 'preferredEditor' ) ) {\n\t\t\t\t// This check serves to stop us logging the id/bucket after the user has\n\t\t\t\t// switched editors for the first time. Future pageloads won't even set\n\t\t\t\t// the config values.\n\t\t\t\tif ( mw.config.get( 'wgMFSchemaEditAttemptStepAnonymousUserId' ) ) {\n\t\t\t\t\t// eslint-disable-next-line camelcase\n\t\t\t\t\tdata.anonymous_user_token = mw.config.get( 'wgMFSchemaEditAttemptStepAnonymousUserId' );\n\t\t\t\t}\n\t\t\t\tif ( mw.config.get( 'wgMFSchemaEditAttemptStepBucket' ) ) {\n\t\t\t\t\tdata.bucket = mw.config.get( 'wgMFSchemaEditAttemptStepBucket' );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( !data.anonymous_user_token ) {\n\t\t\t\t// DiscussionTools a/b test\n\t\t\t\tif ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {\n\t\t\t\t\tdata.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );\n\t\t\t\t}\n\t\t\t\tif ( mw.user.isAnon() ) {\n\t\t\t\t\tvar token = mw.cookie.get( 'DTABid', '' );\n\t\t\t\t\tif ( token ) {\n\t\t\t\t\t\t// eslint-disable-next-line camelcase\n\t\t\t\t\t\tdata.anonymous_user_token = token;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Schema's kind of a mess of special properties\n\t\t\tif ( data.action === 'init' || data.action === 'abort' || data.action === 'saveFailure' ) {\n\t\t\t\tdata[ actionPrefix + '_type' ] = data.type;\n\t\t\t}\n\t\t\tif ( data.action === 'init' || data.action === 'abort' ) {\n\t\t\t\tdata[ actionPrefix + '_mechanism' ] = data.mechanism;\n\t\t\t}\n\t\t\tif ( data.action !== 'init' ) {\n\t\t\t\t// Schema actually does have an init_timing field, but we don't want to\n\t\t\t\t// store it because it's not meaningful.\n\t\t\t\tduration = Math.round( computeDuration( data.action, data, timeStamp ) );\n\t\t\t\tdata[ actionPrefix + '_timing' ] = duration;\n\t\t\t}\n\t\t\tif ( data.action === 'saveFailure' ) {\n\t\t\t\tdata[ actionPrefix + '_message' ] = data.message;\n\t\t\t}\n\n\t\t\t// Remove renamed properties\n\t\t\tdelete data.type;\n\t\t\tdelete data.mechanism;\n\t\t\tdelete data.timing;\n\t\t\tdelete data.message;\n\t\t\t// eslint-disable-next-line camelcase\n\t\t\tdata.is_oversample =\n\t\t\t\t!mw.eventLog.inSample( 1 / sampleRate );\n\n\t\t\tif ( data.action === 'abort' && data.abort_type !== 'switchnochange' ) {\n\t\t\t\ttiming = {};\n\t\t\t} else {\n\t\t\t\ttiming[ data.action ] = timeStamp;\n\t\t\t}\n\n\t\t\t// Switching between visual and source produces a chain of\n\t\t\t// abort/ready/loaded events and no init event, so suppress them for\n\t\t\t// consistency with desktop VE's logging.\n\t\t\tif ( data.abort_type === 'switchnochange' ) {\n\t\t\t\t// The initial abort, flagged as a switch\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( timing.abort ) {\n\t\t\t\t// An abort was previously logged\n\t\t\t\tif ( data.action === 'ready' ) {\n\t\t\t\t\t// Just discard the ready\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( data.action === 'loaded' ) {\n\t\t\t\t\t// Switch has finished; remove the abort timing so we stop discarding events.\n\t\t\t\t\tdelete timing.abort;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( trackdebug ) {\n\t\t\t\tlog( topic + '.' + data.action, duration + 'ms', data, schemaEditAttemptStep.defaults );\n\t\t\t} else {\n\t\t\t\tschemaEditAttemptStep.log( data, (\n\t\t\t\t\tmw.config.get( 'wgWMESchemaEditAttemptStepOversample' ) ||\n\t\t\t\t\tmw.config.get( 'wgMFSchemaEditAttemptStepOversample' ) === 'all' ||\n\t\t\t\t\t// wikitext / visualeditor\n\t\t\t\t\tdata.editor_interface === mw.config.get( 'wgMFSchemaEditAttemptStepOversample' )\n\t\t\t\t) ? 1 : sampleRate );\n\n\t\t\t\t// T309013: Also log via the Metrics Platform:\n\t\t\t\tvar eventName = 'eas.mf.' + actionPrefix,\n\t\t\t\t\tcustomData = util.extend(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Platform can be derived from the agent_client_platform_family\n\t\t\t\t\t\t\t// context attribute mixed in by the JavaScript Metrics Platform\n\t\t\t\t\t\t\t// Client. The context attribute will be \"desktop_browser\" or\n\t\t\t\t\t\t\t// \"mobile_browser\" depending on whether the MobileFrontend extension\n\t\t\t\t\t\t\t// has signalled that it is enabled.\n\t\t\t\t\t\t\t// platform: 'phone',\n\n\t\t\t\t\t\t\tintegration: 'page'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdata\n\t\t\t\t\t);\n\n\t\t\t\tdelete customData.action;\n\n\t\t\t\t// Sampling rate (and therefore whether a stream should oversample) is captured in\n\t\t\t\t// the stream config ($wgEventStreams).\n\t\t\t\tdelete customData.is_oversample;\n\n\t\t\t\tmw.eventLog.dispatch( eventName, customData );\n\t\t\t}\n\t\t} );\n\n\t}() );\n};\n","module.exports = function () {\n\tvar trackdebug = !!mw.util.getParamValue( 'trackdebug' );\n\n\tif ( !mw.config.exists( 'wgWMESchemaEditAttemptStepSamplingRate' ) ) {\n\t\treturn;\n\t}\n\n\t// VisualEditorFeatureUse is intended to log whenever EditAttemptStep\n\t// does, so this file references its config for sampling rates and\n\t// oversampling.\n\n\t( function () {\n\t\tvar // Schema class provided by ext.eventLogging\n\t\t\tSchema = mw.eventLog.Schema,\n\t\t\tuser = mw.user,\n\t\t\tsampleRate = mw.config.get( 'wgWMESchemaEditAttemptStepSamplingRate' ),\n\t\t\t/**\n\t\t\t * Feature use schema\n\t\t\t * https://meta.wikimedia.org/wiki/Schema:VisualEditorFeatureUse\n\t\t\t */\n\t\t\t/* eslint-disable camelcase */\n\t\t\tschemaVisualEditorFeatureUse = new Schema(\n\t\t\t\t'VisualEditorFeatureUse',\n\t\t\t\tsampleRate,\n\t\t\t\t{\n\t\t\t\t\tuser_id: user.getId(),\n\t\t\t\t\tuser_editcount: mw.config.get( 'wgUserEditCount', 0 ),\n\t\t\t\t\tplatform: 'phone',\n\t\t\t\t\tintegration: 'page'\n\t\t\t\t}\n\t\t\t);\n\t\t\t/* eslint-enable camelcase */\n\n\t\tfunction log() {\n\t\t\t// mw.log is a no-op unless resource loader is in debug mode, so\n\t\t\t// this allows trackdebug to work independently (T211698)\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log.apply( console, arguments );\n\t\t}\n\n\t\tmw.trackSubscribe( 'mf.schemaVisualEditorFeatureUse', function ( topic, data ) {\n\t\t\tvar event = {\n\t\t\t\tfeature: data.feature,\n\t\t\t\taction: data.action,\n\t\t\t\teditingSessionId: data.editing_session_id,\n\t\t\t\t// eslint-disable-next-line camelcase\n\t\t\t\teditor_interface: data.editor_interface\n\t\t\t};\n\n\t\t\tif ( trackdebug ) {\n\t\t\t\tlog( topic, event, schemaVisualEditorFeatureUse.defaults );\n\t\t\t} else {\n\t\t\t\tschemaVisualEditorFeatureUse.log( event, (\n\t\t\t\t\tmw.config.get( 'wgWMESchemaEditAttemptStepOversample' ) ||\n\t\t\t\t\tmw.config.get( 'wgMFSchemaEditAttemptStepOversample' ) === 'visualeditor' ||\n\t\t\t\t\tmw.config.get( 'wgMFSchemaEditAttemptStepOversample' ) === 'all'\n\t\t\t\t) ? 1 : sampleRate );\n\n\t\t\t\t// T309602: Also log via the Metrics Platform:\n\t\t\t\tvar eventName = 'vefu.' + data.action;\n\n\t\t\t\t/* eslint-disable camelcase */\n\t\t\t\tvar customData = {\n\t\t\t\t\tfeature: data.feature,\n\t\t\t\t\tediting_session_id: data.editing_session_id,\n\t\t\t\t\teditor_interface: data.editor_interface,\n\t\t\t\t\tintegration: 'page'\n\t\t\t\t};\n\t\t\t\t/* eslint-enable camelcase */\n\n\t\t\t\tmw.eventLog.dispatch( eventName, customData );\n\t\t\t}\n\t\t} );\n\n\t}() );\n};\n","/* global $ */\nconst lazyImageLoader = require( '../mobile.startup/lazyImages/lazyImageLoader' );\n\n/**\n * Initialise lazy loading images to supplement the HTML changes inside the\n * MobileFormatter.\n *\n * @param {jQuery} $container\n */\nfunction init( $container ) {\n\tconst imagePlaceholders = lazyImageLoader.queryPlaceholders( $container[ 0 ] );\n\n\t// Regardless of whether or not lazy load is turned on\n\t// We need to load in all images before print\n\twindow.addEventListener( 'beforeprint', function () {\n\t\tlazyImageLoader.loadImages( imagePlaceholders );\n\t} );\n\n\tif ( !mw.config.get( 'wgMFLazyLoadImages' ) ) {\n\t\treturn;\n\t}\n\n\tif ( 'IntersectionObserver' in window ) {\n\t\tconst observer = new IntersectionObserver(\n\t\t\t( entries ) => {\n\t\t\t\tentries.forEach( ( entry ) => {\n\t\t\t\t\tconst placeholder = entry.target;\n\t\t\t\t\t// If intersecting load image and stop observing it to free up resources.\n\t\t\t\t\tif ( entry.isIntersecting ) {\n\t\t\t\t\t\tlazyImageLoader.loadImage( placeholder );\n\t\t\t\t\t\tobserver.unobserve( placeholder );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t},\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API\n\t\t\t{\n\t\t\t\t// Setup the area for observing.\n\t\t\t\t// By default the root is the viewport.\n\t\t\t\t// We want the detection area to be as tall as 150% of the viewport height,\n\t\t\t\t// allowing elements to be detected before they reach the viewport.\n\t\t\t\t// This is achieved with a 50% bottom margin.\n\t\t\t\trootMargin: '0px 0px 50% 0px',\n\t\t\t\t// The default is 0 (meaning as soon as even one pixel is visible,\n\t\t\t\t// the callback will be run), however we explicitly set this so that\n\t\t\t\t// it is clear we have made this choice in case we want to revisit later.\n\t\t\t\tthreshold: 0\n\t\t\t}\n\t\t);\n\n\t\t// observe all the placeholders\n\t\timagePlaceholders.forEach( ( placeholder ) => {\n\t\t\tobserver.observe( placeholder );\n\t\t} );\n\t} else {\n\t\t/**\n\t\t * Adds the following class to identify the tap to click images on\n\t\t * older browsers that do not support IntersectionObserver:\n\t\t * lazy-image-placeholder--tap\n\t\t */\n\t\t// eslint-disable-next-line mediawiki/class-doc\n\t\t$( imagePlaceholders ).addClass( `${lazyImageLoader.placeholderClass}--tap` );\n\n\t\t// Tap to show (see T246767)\n\t\tdocument.addEventListener( 'click', function ( ev ) {\n\t\t\tif ( imagePlaceholders.indexOf( ev.target ) > -1 ) {\n\t\t\t\tlazyImageLoader.loadImage( ev.target );\n\t\t\t}\n\t\t} );\n\t}\n}\n\nmodule.exports = function () {\n\tmw.hook( 'wikipage.content' ).add( init );\n};\n","// FIXME: make this an object with a constructor to facilitate testing\n// (see https://bugzilla.wikimedia.org/show_bug.cgi?id=44264)\n/**\n * mobileFrontend namespace\n *\n * @class mw.mobileFrontend\n * @singleton\n */\nvar skin,\n\turl,\n\t{ USER_FONT_SIZE_REGULAR, USER_FONT_SIZES } = require( '../constants' ),\n\tstorage = mw.storage,\n\ttoggling = require( './toggling' ),\n\tlazyLoadedImages = require( './lazyLoadedImages' ),\n\tskinName = mw.config.get( 'skin' ),\n\tisPageContentModelEditable = mw.config.get( 'wgMFIsPageContentModelEditable' ),\n\teditorAvailableSkins = mw.config.get( 'wgMFEditorAvailableSkins' ),\n\teditor = require( './editor' ),\n\tcurrentPage = require( '../mobile.startup/currentPage' )(),\n\tcurrentPageHTMLParser = require( '../mobile.startup/currentPageHTMLParser' )(),\n\tmfUtil = require( '../mobile.startup/util' ),\n\t$window = mfUtil.getWindow(),\n\tSkin = require( '../mobile.startup/Skin' ),\n\teventBus = require( '../mobile.startup/eventBusSingleton' ),\n\tschemaEditAttemptStep = require( './eventLogging/schemaEditAttemptStep' ),\n\tschemaVisualEditorFeatureUse = require( './eventLogging/schemaVisualEditorFeatureUse' );\n\nskin = Skin.getSingleton();\n\n/**\n * Given 2 functions, it returns a function that will run both with it's\n * context and parameters and return the results combined\n *\n * @private\n * @param {Function} fn1\n * @param {Function} fn2\n * @return {Function} which returns void\n */\nfunction apply2( fn1, fn2 ) {\n\treturn function () {\n\t\tfn1.apply( this, arguments );\n\t\tfn2.apply( this, arguments );\n\t};\n}\n\n/**\n * The `window`'s resize event debounced at 100 ms.\n * The `resize:throttled` event is the `window`'s\n * resize event throttled to 200 ms.\n *\n * @event resize\n */\n\n/**\n * The `window`'s scroll event debounced at 100 ms.\n * The `scroll:throttled` event is the `window`'s\n * scroll event throttled to 200 ms.\n *\n * @event scroll\n */\n\n$window\n\t.on( 'resize', apply2(\n\t\tmw.util.debounce( function () { eventBus.emit( 'resize' ); }, 100 ),\n\t\tmw.util.throttle( function () { eventBus.emit( 'resize:throttled' ); }, 200 )\n\t) )\n\t.on( 'scroll', apply2(\n\t\tmw.util.debounce( function () { eventBus.emit( 'scroll' ); }, 100 ),\n\t\tmw.util.throttle( function () { eventBus.emit( 'scroll:throttled' ); }, 200 )\n\t) );\n\n/**\n * Updates the font size based on the current value in storage\n */\nfunction updateFontSize() {\n\tconst userFontSize = storage.get( 'userFontSize', USER_FONT_SIZE_REGULAR );\n\t// The following classes are used here:\n\t// * mf-font-size-small\n\t// * mf-font-size-regular\n\t// * mf-font-size-large\n\t// * mf-font-size-x-large\n\t/* eslint-disable mediawiki/class-doc */\n\tUSER_FONT_SIZES.forEach( function ( fontSize ) {\n\t\tconst fontClass = `mf-font-size-${fontSize}`;\n\t\tif ( fontSize === userFontSize ) {\n\t\t\tdocument.documentElement.classList.add( fontClass );\n\t\t} else {\n\t\t\t// If Safari's back/forward cache is being used the previous class may be present.\n\t\t\tdocument.documentElement.classList.remove( fontClass );\n\t\t}\n\t} );\n\t/* eslint-enable mediawiki/class-doc */\n}\n\n// Hide URL flags used to pass state through reloads\n// venotify is normally handled in ve.init.mw.DesktopArticleTarget.init.js\n// but that's not loaded on mobile\n// eslint-disable-next-line no-restricted-properties\nif ( window.history && history.pushState ) {\n\t// eslint-disable-next-line no-restricted-properties\n\turl = new URL( window.location.href );\n\tif ( url.searchParams.has( 'venotify' ) || url.searchParams.has( 'mfnotify' ) ) {\n\t\turl.searchParams.delete( 'venotify' );\n\t\turl.searchParams.delete( 'mfnotify' );\n\t\t// eslint-disable-next-line no-restricted-properties\n\t\twindow.history.replaceState( null, document.title, url.toString() );\n\t}\n}\n\n// Font must be updated on back button press as users may click\n// back after changing font.\nwindow.addEventListener( 'pageshow', function () {\n\tupdateFontSize();\n} );\n\nupdateFontSize();\n\n// Recruit volunteers through the console\n// (note console.log may not be a function so check via apply)\n/* eslint-disable no-console */\nif ( window.console && window.console.log && window.console.log.apply &&\n\t\tmw.config.get( 'wgMFEnableJSConsoleRecruitment' ) ) {\n\tconsole.log( mw.msg( 'mobile-frontend-console-recruit' ) );\n}\n/* eslint-enable no-console */\n\n// setup editor\nif ( !currentPage.inNamespace( 'special' ) && isPageContentModelEditable ) {\n\t// Mobile editor commonly doesn't work well with other skins than Minerva (it looks horribly\n\t// broken without some styles that are only defined by Minerva). So we only enable it for the\n\t// skin that wants it.\n\tif ( editorAvailableSkins.indexOf( skinName ) !== -1 ) {\n\t\t// TODO: This code should not even be loaded on desktop.\n\t\t// Remove this check when that is fixed (T216537).\n\t\tif ( mw.config.get( 'wgMFMode' ) !== null ) {\n\t\t\teditor( currentPage, currentPageHTMLParser, skin );\n\t\t}\n\t}\n}\n\ntoggling();\nlazyLoadedImages();\n\n// Set up recording for the events we track. The module 'ext.eventLogging'\n// should already be loaded (this doesn't trigger a new HTTP request), but we\n// don't specify a hard dependency because EventLogging may not be installed.\nmw.loader.using( 'ext.eventLogging' ).then( function () {\n\tschemaEditAttemptStep();\n\tschemaVisualEditorFeatureUse();\n} );\n","module.exports = function () {\n\tvar\n\t\tcurrentPage = require( '../mobile.startup/currentPage' )(),\n\t\tToggler = require( '../mobile.startup/Toggler' ),\n\t\teventBus = require( '../mobile.startup/eventBusSingleton' );\n\n\t/**\n\t * Initialises toggling code.\n\t *\n\t * @method\n\t * @param {jQuery.Object} $container to enable toggling on\n\t * @param {string} prefix a prefix to use for the id.\n\t * @param {Page} page The current page\n\t * @ignore\n\t */\n\tfunction init( $container, prefix, page ) {\n\t\t// Only handle headings in content processed by MakeSectionsTransform.\n\t\t// Remove event handler added by MakeSectionsTransform::interimTogglingSupport().\n\t\t$container.find( '.section-heading' ).removeAttr( 'onclick' );\n\t\t// Cleanup global as it is no longer needed. We check if it's undefined because\n\t\t// there is no guarantee this won't be run on other skins e.g. Vector or cached HTML.\n\t\tif ( window.mfTempOpenSection !== undefined ) {\n\t\t\tdelete window.mfTempOpenSection;\n\t\t}\n\t\t// eslint-disable-next-line no-new\n\t\tnew Toggler( {\n\t\t\t$container: $container,\n\t\t\tprefix: prefix,\n\t\t\tpage: page,\n\t\t\teventBus: eventBus\n\t\t} );\n\t}\n\n\tif (\n\t\t// Avoid this running on Watchlist.\n\t\t!currentPage.inNamespace( 'special' ) &&\n\t\tmw.config.get( 'wgAction' ) === 'view'\n\t) {\n\t\tmw.hook( 'wikipage.content' ).add( function ( $container ) {\n\t\t\tvar $contentContainer = $container.find( '.mw-parser-output' );\n\t\t\t// If there was no mw-parser-output wrapper, just use the parent.\n\t\t\tif ( $contentContainer.length === 0 ) {\n\t\t\t\t$contentContainer = $container;\n\t\t\t}\n\t\t\tinit( $contentContainer, 'content-', currentPage );\n\t\t} );\n\t}\n};\n"],"sourceRoot":""}