{"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","$allEditLinks","$","user","mw","CtaDrawer","contentModel","config","get","veConfig","editCount","editorPath","setupEditor","page","skin","currentPageHTMLParser","router","uri","fragment","editorOverride","overlayManager","getSingleton","isNewPage","id","firstInitDone","on","ev","elem","section","length","getParamValue","href","navigate","preventDefault","onEditLinkClick","this","add","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","token","setObject","set","parseInt","slice","getId","getPreferredEditor","visualEditorNamespaces","namespaces","isWikiText","indexOf","loadSourceEditor","hook","fire","loader","using","then","undefined","Deferred","$page","$content","$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","find","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","user_class","user_editcount","mw_version","platform","integration","page_token","getPageviewToken","session_token","version","trackSubscribe","topic","data","actionPrefix","timeStamp","duration","anonymous_user_token","bucket","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","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","Toggler","$contentContainer","prefix","headingsSelector","map","tagName","join","removeAttr","mfTempOpenSection"],"mappings":"uKACA,IAAIA,EAAIC,EAAS,iDAChBC,EAAOD,EAAS,gCAChBE,EAAuBF,EAAS,6CAChCG,EAAiBH,EAAS,0CAG1BI,EAAgBC,EAAG,2CACnBC,EAAOC,GAAGD,KACVE,EAAYR,EAAS,qCACrBS,EAAeF,GAAGG,OAAOC,IAAK,sBAC9BC,EAAWL,GAAGG,OAAOC,IAAK,wBAC1BE,EAAYN,GAAGG,OAAOC,IAAK,mBAC3BG,EAAa,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EP,IAA7BwI,EAAkB9Q,SACtB8Q,EAAoB3C,GA9BvB,SAAeA,EAAY4C,EAAQ/R,GAClC,IAAIgS,EAAmBzS,GAAGG,OAAOC,IAAK,+BAAgCsS,KAAK,SAAWC,GACrF,MAAO,KAAOA,KACXC,KAAM,KAEVhD,EAAW7F,KAAM0I,GAAmB/L,SAAU,mBAC5CmM,WAAY,gBAGoB3M,IAA7B3D,OAAOuQ,0BACJvQ,OAAOuQ,kBAGf,IAAIR,EAAS,CACZ1C,WAAYA,EACZ4C,OAAQA,EACR/R,KAAMA,EACNgR,SAAUA,IAeV9H,CAAM4I,EAAmB,WAAY3I,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$allEditLinks = $( '#ca-edit, .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 ( $allEditLinks.length === 1 ) {\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, anonid,\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// Handle the ABTest case\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\tif ( defaultEditor === 'abtest' ) {\n\t\tif ( mw.user.isAnon() ) {\n\t\t\tif ( !tokenData ) {\n\t\t\t\ttokenData = {\n\t\t\t\t\ttoken: mw.user.generateRandomSessionId(),\n\t\t\t\t\t// 90 days\n\t\t\t\t\texpires: Date.now() + 90 * 24 * 60 * 60 * 1000\n\t\t\t\t};\n\t\t\t\tmw.storage.setObject( 'MFDefaultEditorABToken', tokenData );\n\t\t\t}\n\t\t\tmw.config.set( 'wgMFSchemaEditAttemptStepAnonymousUserId', tokenData.token );\n\t\t\tanonid = parseInt( tokenData.token.slice( 0, 8 ), 16 );\n\t\t\tdefaultEditor = anonid % 2 === 0 ? 'source' : 'visual';\n\t\t\tmw.config.set( 'wgMFSchemaEditAttemptStepBucket', 'default-' + defaultEditor );\n\t\t} else if ( mw.config.get( 'wgUserEditCount' ) <= 100 ) {\n\t\t\tdefaultEditor = mw.user.getId() % 2 === 0 ? 'source' : 'visual';\n\t\t\tmw.config.set( 'wgMFSchemaEditAttemptStepBucket', 'default-' + defaultEditor );\n\t\t} else {\n\t\t\tdefaultEditor = 'preference';\n\t\t}\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$allEditLinks.on( 'click', function ( ev ) {\n\t\tonEditLinkClick( this, ev, overlayManager.router );\n\t} );\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$allEditLinks.on( 'click', function ( ev ) {\n\t\tshowLoginDrawer();\n\t\tev.preventDefault();\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$allEditLinks.on( 'click', function ( ev ) {\n\t\tmw.notify( msg );\n\t\tev.preventDefault();\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\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\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\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// 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\tvar headingsSelector = mw.config.get( 'wgMFMobileFormatterHeadings' ).map( function ( tagName ) {\n\t\t\treturn '> ' + tagName;\n\t\t} ).join( ',' );\n\t\t// Distinguish headings in content from other headings.\n\t\t$container.find( headingsSelector ).addClass( 'section-heading' )\n\t\t\t.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":""}