{"version":3,"sources":["webpack://mfModules.[name]/./src/mobile.init/BetaOptInPanel.js","webpack://mfModules.[name]/./src/mobile.init/ProgressBarWidget.js","webpack://mfModules.[name]/./src/mobile.init/editor.js","webpack://mfModules.[name]/./src/mobile.init/mobile.init.js"],"names":["Button","require","util","mfExtend","View","user","mw","BetaOptInPanel","props","call","this","extend","className","events","click .optin","click .cancel","_onCancelCallback","onCancel","templatePartials","prototype","button","template","get","defaults","postUrl","undefined","editToken","tokens","text","msg","buttons","progressive","additionalClassNames","label","options","_onCancel","ev","preventDefault","$el","removeClass","_onOptin","find","currentTarget","closest","trigger","module","exports","$bar","$","addClass","$element","append","M","router","loader","ProgressBarWidget","Overlay","overlayManager","getSingleton","$allEditLinks","popup","CtaDrawer","blacklisted","test","navigator","userAgent","contentModel","config","isEditingSupported","isSupported","veConfig","editCount","isVisualEditorEnabled","editorPath","onEditLinkClick","section","Uri","href","query","navigate","setupEditor","page","skin","uri","fragment","editorOverride","isNewPage","id","on","add","sectionId","$loading","loadingOverlay","scrollbarWidth","veAnimationDelayDeferred","abortableDataPromise","$content","preferredEditor","storage","getPreferredEditor","editorOptions","api","Api","licenseMsg","getLicenseMsg","title","titleObj","isAnon","oldId","getParamValue","contentLang","attr","contentDir","sessionId","generateRandomSessionId","visualEditorNamespaces","namespaces","initMechanism","clearLoadingVE","abort","detach","css","transform","padding-bottom","margin-bottom","padding-right","box-sizing","document","body","logInit","editor","track","action","type","mechanism","editor_interface","editing_session_id","loadSourceEditor","hook","fire","loadModule","then","isWikiText","indexOf","progressBar","showLoadingVE","Deferred","mode","dataPromise","using","libs","ve","targetLoader","requestPageData","getPrefixedDb","sessionStore","targetName","addPlugin","loadModules","overlay","VisualEditorOverlay","EditorOverlay","overlayData","stack","off","replaceCurrent","window","innerWidth","documentElement","clientWidth","noHeader","show","$page","$sectionTop","fakeScroll","enableVisualSectionEditing","prop","scrollTop","setTimeout","resolve","i","toString","getPath","history","pushState","veaction","replaceState","init","currentPage","isReadOnly","editRestrictions","hide","hideSectionEditIcons","Array","isArray","drawer","content","signupQueryParams","warning","route","checkRoute","showLoginDrawer","showSorryToast","isMissing","inNamespace","skinName","isPageContentModelEditable","PageGateway","gateway","mfUtil","$window","getWindow","$html","getDocument","context","Page","experiments","activeExperiments","Skin","eventBus","ReferencesMobileViewGateway","getCurrentPage","apply2","fn1","fn2","apply","arguments","permissions","Title","newFromText","length","push","el","getPrefixedText","protection","edit","revId","isMainPage","isWatched","hasClass","sections","getSectionsFromHTML","namespaceNumber","loadCurrentPage","updateFontSize","userFontSize","referencesGateway","debounce","emit","throttle","betaoptin","experiment","betaOptInPanel","inStable","inSample","token","set","getMode","getBucket","getUrl","returnto","appendTo","getLeadSectionElement","isPanelShown","displayBetaOptIn","console","log","mobileFrontend","deprecate"],"mappings":"gLAAA,IAAIA,EAASC,EAAS,kCACrBC,EAAOD,EAAS,gCAChBE,EAAWF,EAAS,oCACpBG,EAAOH,EAAS,gCAChBI,EAAOC,GAAGD,KASX,SAASE,EAAgBC,GACxBJ,EAAKK,KACJC,KACAR,EAAKS,QAEHC,UAAW,6BACXC,QACCC,eAAgB,WAChBC,gBAAiB,cAGnBP,IAGFE,KAAKM,kBAAoBR,EAAMS,SAGhCd,EAAUI,EAAgBH,GAKzBc,iBAAkBhB,EAAKS,UAAYP,EAAKe,UAAUD,kBACjDE,OAAQpB,EAAOmB,UAAUE,WAM1BA,SAAUf,GAAGe,SAASC,IAAK,cAAe,eAK1CC,SAAUrB,EAAKS,UAAYP,EAAKe,UAAUI,UACzCC,aAASC,EACTC,UAAWrB,EAAKsB,OAAOL,IAAK,aAC5BM,KAAMtB,GAAGuB,IAAK,uCACdC,SACC,IAAI9B,GACH+B,aAAa,EACbC,qBAAsB,QACtBC,MAAO3B,GAAGuB,IAAK,8BACZK,QACJ,IAAIlC,GACHgC,qBAAsB,SACtBC,MAAO3B,GAAGuB,IAAK,kCACZK,WAUNC,UAAW,SAAWC,GACrBA,EAAGC,iBACH3B,KAAK4B,IAAIC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2H,YAAa,YAAeE,GAGpB,YAAbD,GAGuB,OAAtBS,EAAQ2C,WACZ/H,EAAQjD,EAAMC,GAKjBpC,GACC+K,eAAgBA,GAIjBZ,EAAOtM,OAAQL,GAAGqQ,eAAgB7N,GAClCxC,GAAGoQ,IAAIE,UAAWtQ,GAAGqQ,eAAgB,iBAAkB9C,GAEvDvN,GAAGqQ,eAAeC,UAAW,mBAAoB1L,EAChD,uFACDrC,EAAOC,QAAUA","file":"mobile.init.js","sourcesContent":["var Button = require( '../mobile.startup/Button' ),\n\tutil = require( '../mobile.startup/util' ),\n\tmfExtend = require( '../mobile.startup/mfExtend' ),\n\tView = require( '../mobile.startup/View' ),\n\tuser = mw.user;\n\n/**\n * @class BetaOptInPanel\n * @extends View\n * @param {Object} props\n * @param {Function} [props.onCancel]\n * @property {Function} [_onCancelCallback]\n */\nfunction BetaOptInPanel( props ) {\n\tView.call(\n\t\tthis,\n\t\tutil.extend(\n\t\t\t{\n\t\t\t\tclassName: 'panel panel-inline visible',\n\t\t\t\tevents: {\n\t\t\t\t\t'click .optin': '_onOptin',\n\t\t\t\t\t'click .cancel': '_onCancel'\n\t\t\t\t}\n\t\t\t},\n\t\t\tprops\n\t\t)\n\t);\n\tthis._onCancelCallback = props.onCancel;\n}\n\nmfExtend( BetaOptInPanel, View, {\n\t/**\n\t * @memberof BetaOptInPanel\n\t * @instance\n\t */\n\ttemplatePartials: util.extend( {}, View.prototype.templatePartials, {\n\t\tbutton: Button.prototype.template\n\t} ),\n\t/**\n\t * @memberof BetaOptInPanel\n\t * @instance\n\t */\n\ttemplate: mw.template.get( 'mobile.init', 'Panel.hogan' ),\n\t/**\n\t * @memberof BetaOptInPanel\n\t * @instance\n\t */\n\tdefaults: util.extend( {}, View.prototype.defaults, {\n\t\tpostUrl: undefined,\n\t\teditToken: user.tokens.get( 'editToken' ),\n\t\ttext: mw.msg( 'mobile-frontend-panel-betaoptin-msg' ),\n\t\tbuttons: [\n\t\t\tnew Button( {\n\t\t\t\tprogressive: true,\n\t\t\t\tadditionalClassNames: 'optin',\n\t\t\t\tlabel: mw.msg( 'mobile-frontend-panel-ok' )\n\t\t\t} ).options,\n\t\t\tnew Button( {\n\t\t\t\tadditionalClassNames: 'cancel',\n\t\t\t\tlabel: mw.msg( 'mobile-frontend-panel-cancel' )\n\t\t\t} ).options\n\t\t]\n\t} ),\n\n\t/**\n\t * Cancel event handler\n\t * @memberof BetaOptInPanel\n\t * @instance\n\t * @param {Object} ev Event Object\n\t */\n\t_onCancel: function ( ev ) {\n\t\tev.preventDefault();\n\t\tthis.$el.removeClass( 'visible' );\n\t\tif ( this._onCancelCallback ) {\n\t\t\tthis._onCancelCallback();\n\t\t}\n\t},\n\n\t/**\n\t * Cancel event handler\n\t * @memberof BetaOptInPanel\n\t * @instance\n\t * @param {jQuery.Event} ev\n\t */\n\t_onOptin: function ( ev ) {\n\t\tthis.$el.find( ev.currentTarget ).closest( 'form' ).trigger( 'submit' );\n\t}\n} );\n\nmodule.exports = BetaOptInPanel;\n","/* global $ */\nmodule.exports = function ProgressBarWidget() {\n\tthis.$bar = $( '<div>' )\n\t\t.addClass( 'mobile-progressBarWidget-bar' );\n\tthis.$element = $( '<div>' )\n\t\t.addClass( 'mobile-progressBarWidget' )\n\t\t.append( this.$bar );\n};\n","/* global $ */\nvar M = require( '../mobile.startup/moduleLoaderSingleton' ),\n\tutil = require( '../mobile.startup/util' ),\n\trouter = mw.loader.require( 'mediawiki.router' ),\n\tProgressBarWidget = require( './ProgressBarWidget' ),\n\tOverlay = require( '../mobile.startup/Overlay' ),\n\tOverlayManager = require( '../mobile.startup/OverlayManager' ),\n\toverlayManager = OverlayManager.getSingleton(),\n\tloader = require( '../mobile.startup/rlModuleLoader' ),\n\t// #ca-edit, .mw-editsection are standard MediaWiki elements\n\t// .edit-link comes from MobileFrontend user page creation CTA\n\t// TODO: T213352 replace \"#ca-edit a, a#ca-edit\" with just \"#ca-edit\" when\n\t// cache clears and new page actions menu is served.\n\t$allEditLinks = $( '#ca-edit a, a#ca-edit, .mw-editsection a, .edit-link' ),\n\tuser = mw.user,\n\tpopup = require( '../mobile.startup/toast' ),\n\tCtaDrawer = require( '../mobile.startup/CtaDrawer' ),\n\t// FIXME: Disable on IE < 10 for time being\n\tblacklisted = /MSIE \\d\\./.test( navigator.userAgent ),\n\tcontentModel = mw.config.get( 'wgPageContentModel' ),\n\tisEditingSupported = router.isSupported() && !blacklisted,\n\tveConfig = mw.config.get( 'wgVisualEditorConfig' ),\n\teditCount = mw.config.get( 'wgUserEditCount' ),\n\t// FIXME: Should we consider default site options and user prefs?\n\tisVisualEditorEnabled = veConfig,\n\teditorPath = /^\\/editor\\/(\\d+|all)$/;\n\n/**\n * Event handler for edit link clicks. Will prevent default link\n * behaviour and will not allow propagation\n * @method\n * @ignore\n * @return {boolean}\n */\nfunction onEditLinkClick() {\n\tvar section = ( new mw.Uri( this.href ) ).query.section || 'all';\n\trouter.navigate( '#/editor/' + section );\n\t// prevent folding section when clicking Edit by stopping propagation\n\treturn false;\n}\n\n/**\n * Retrieve the user's preferred editor setting. If none is set, return the default\n * editor for this wiki.\n * @method\n * @ignore\n * @return {string} Either 'VisualEditor' or 'SourceEditor'\n */\nfunction getPreferredEditor() {\n\tvar preferredEditor = mw.storage.get( 'preferredEditor' );\n\tif ( !preferredEditor ) {\n\t\treturn mw.config.get( 'wgMFUsePreferredEditor' ) && mw.user.options.get( 'visualeditor-editor' ) === 'visualeditor' ?\n\t\t\t'VisualEditor' : 'SourceEditor';\n\t}\n\treturn preferredEditor;\n}\n\n/**\n * Initialize the edit button so that it launches the editor interface when clicked.\n * @method\n * @ignore\n * @param {Page} page The page to edit.\n * @param {Skin} skin\n */\nfunction setupEditor( page, skin ) {\n\tvar uri, fragment, editorOverride,\n\t\tisNewPage = page.options.id === 0;\n\n\t$allEditLinks.on( 'click', onEditLinkClick );\n\toverlayManager.add( editorPath, function ( sectionId ) {\n\t\tvar\n\t\t\t$loading, loadingOverlay, scrollbarWidth,\n\t\t\t$content = $( '#mw-content-text' ),\n\t\t\tpreferredEditor = getPreferredEditor(),\n\t\t\teditorOptions = {\n\t\t\t\toverlayManager: overlayManager,\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: $content.attr( 'lang' ),\n\t\t\t\tcontentDir: $content.attr( 'dir' ),\n\t\t\t\tsessionId: user.generateRandomSessionId()\n\t\t\t},\n\t\t\tveAnimationDelayDeferred, abortableDataPromise,\n\t\t\tvisualEditorNamespaces = ( veConfig && veConfig.namespaces ) || [],\n\t\t\tinitMechanism = mw.util.getParamValue( 'redlink' ) ? 'new' : 'click';\n\n\t\tfunction showLoadingVE() {\n\t\t\tvar progressBar = new ProgressBarWidget();\n\t\t\t// The progress bar has to stay visible while we swap loadingOverlay for\n\t\t\t// VisualEditorOverlay, so put it into another \"overlay\" on top of everything else.\n\t\t\t// TODO: In the future where loadingOverlay is removed (T214641#4907694),\n\t\t\t// it can be moved inside the VisualEditorOverlay.\n\t\t\t$loading = $( '<div>' )\n\t\t\t\t.addClass( 'overlay-loading-ve' )\n\t\t\t\t.append( progressBar.$element );\n\t\t\t$( document.body ).append( $loading ).addClass( 've-loading' );\n\t\t}\n\n\t\tfunction clearLoadingVE() {\n\t\t\tif ( abortableDataPromise.abort ) {\n\t\t\t\tabortableDataPromise.abort();\n\t\t\t}\n\t\t\t$loading.detach();\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\t\t\t$( '#mw-mf-page-center' ).css( {\n\t\t\t\t'padding-right': '',\n\t\t\t\t'box-sizing': ''\n\t\t\t} );\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 * @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\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}\n\n\t\t/**\n\t\t * Load source editor\n\t\t * @private\n\t\t * @ignore\n\t\t * @method\n\t\t * @return {jQuery.Promise}\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 loader.loadModule( 'mobile.editor.overlay' ).then( function () {\n\t\t\t\tvar EditorOverlay = M.require( 'mobile.editor.overlay/EditorOverlay' );\n\t\t\t\treturn new EditorOverlay( editorOptions );\n\t\t\t} );\n\t\t}\n\n\t\tif ( sectionId !== 'all' ) {\n\t\t\teditorOptions.sectionId = page.isWikiText() ? +sectionId : null;\n\t\t}\n\n\t\t// Check whether VisualEditor should be loaded\n\t\tif ( isVisualEditorEnabled &&\n\n\t\t\t// Only for pages with a wikitext content model\n\t\t\tpage.isWikiText() &&\n\n\t\t\t// Only in enabled namespaces\n\t\t\tvisualEditorNamespaces.indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 &&\n\n\t\t\t// Not on pages which are outputs of the Page Translation feature\n\t\t\tmw.config.get( 'wgTranslatePageTranslation' ) !== 'translation' &&\n\n\t\t\t(\n\t\t\t\t// If the user prefers the VisualEditor or the user has no preference and\n\t\t\t\t// the VisualEditor is the default editor for this wiki\n\t\t\t\tpreferredEditor === 'VisualEditor' ||\n\t\t\t\t// We've loaded it via the URL for this request\n\t\t\t\teditorOverride === 'VisualEditor'\n\t\t\t) &&\n\n\t\t\teditorOverride !== 'SourceEditor'\n\t\t) {\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\tshowLoadingVE();\n\t\t\tveAnimationDelayDeferred = util.Deferred();\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 || null,\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\t// Ensure the scroll animation finishes before we load the editor\n\t\t\t\treturn veAnimationDelayDeferred.then( function () {\n\t\t\t\t\treturn abortableDataPromise;\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\tmw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {\n\t\t\t\tmw.libs.ve.targetLoader.addPlugin( 'mobile.editor.ve' );\n\t\t\t\treturn mw.libs.ve.targetLoader.loadModules( editorOptions.mode );\n\t\t\t} ).then( function () {\n\t\t\t\tvar VisualEditorOverlay = M.require( 'mobile.editor.overlay/VisualEditorOverlay' ),\n\t\t\t\t\tEditorOverlay = M.require( 'mobile.editor.overlay/EditorOverlay' ),\n\t\t\t\t\toverlay;\n\t\t\t\teditorOptions.EditorOverlay = EditorOverlay;\n\t\t\t\toverlay = new VisualEditorOverlay( editorOptions );\n\t\t\t\toverlay.on( 'editor-loaded', clearLoadingVE );\n\t\t\t\treturn overlay;\n\t\t\t}, function () {\n\t\t\t\treturn loadSourceEditor();\n\t\t\t} ).then( function ( overlay ) {\n\t\t\t\t// Make sure the user did not close the overlay while we were loading\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\tloadingOverlay.off( 'hide', clearLoadingVE );\n\t\t\t\t// Clear progress bar if loading is aborted after overlay is replaced\n\t\t\t\toverlay.on( 'hide', clearLoadingVE );\n\t\t\t\toverlayManager.replaceCurrent( overlay );\n\t\t\t} );\n\n\t\t\tscrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n\t\t\t// Like loadingOverlay(), but without the spinner\n\t\t\tloadingOverlay = new Overlay( {\n\t\t\t\tclassName: 'overlay overlay-loading',\n\t\t\t\tnoHeader: true\n\t\t\t} );\n\t\t\t// Clear progress bar if loading is aborted before overlay is replaced\n\t\t\tloadingOverlay.on( 'hide', clearLoadingVE );\n\t\t\t// Should this be a subclass?\n\t\t\tloadingOverlay.show = function () {\n\t\t\t\tvar $page, $content, $sectionTop, fakeScroll, enableVisualSectionEditing;\n\t\t\t\tOverlay.prototype.show.call( this );\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\t$page = $( '#mw-mf-page-center' );\n\t\t\t\t$content = $( '#content' );\n\t\t\t\tif ( sectionId === '0' || sectionId === 'all' ) {\n\t\t\t\t\t$sectionTop = $( '#bodyContent' );\n\t\t\t\t} else {\n\t\t\t\t\t$sectionTop = $( '[data-section=\"' + sectionId + '\"]' )\n\t\t\t\t\t\t.closest( 'h1, h2, h3, h4, h5, h6' );\n\t\t\t\t}\n\t\t\t\t// If there was a scrollbar that was hidden when the overlay was shown, add a margin\n\t\t\t\t// with the same width. This is mostly so that developers testing this on desktop\n\t\t\t\t// don't go crazy when the fake scroll fails to line up.\n\t\t\t\t$page.css( {\n\t\t\t\t\t'padding-right': '+=' + scrollbarWidth,\n\t\t\t\t\t'box-sizing': 'border-box'\n\t\t\t\t} );\n\t\t\t\t// Pretend that we didn't just scroll the page to the top.\n\t\t\t\t$page.prop( 'scrollTop', this.scrollTop );\n\t\t\t\t// Then, pretend that we're scrolling to the position of the clicked heading.\n\t\t\t\tfakeScroll = $sectionTop.prop( 'offsetTop' ) - this.scrollTop;\n\t\t\t\t// Adjust for height of the toolbar.\n\t\t\t\tfakeScroll -= 48;\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\t$content.css( {\n\t\t\t\t\t// Use transform instead of scroll for smoother animation (via CSS transitions).\n\t\t\t\t\ttransform: 'translate( 0, ' + -fakeScroll + 'px )',\n\t\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\t// some extra space to allow us to scroll \"beyond the end\" of the page.\n\t\t\t\t\t'padding-bottom': '+=' + fakeScroll,\n\t\t\t\t\t'margin-bottom': '-=' + fakeScroll\n\t\t\t\t} );\n\t\t\t\tsetTimeout( veAnimationDelayDeferred.resolve, 500 );\n\t\t\t};\n\t\t\treturn loadingOverlay;\n\t\t} else {\n\t\t\treturn loadSourceEditor();\n\t\t}\n\t} );\n\n\t$( '#ca-edit a' ).prop( 'href', function ( i, href ) {\n\t\tvar uri = new mw.Uri( href );\n\t\t// By default the editor opens section 0 (lead section), rather than the whole article.\n\t\t// This might be changed in the future (T210659).\n\t\turi.query.section = 0;\n\t\treturn uri.toString();\n\t} );\n\n\tif ( !router.getPath() && ( mw.util.getParamValue( 'veaction' ) || mw.util.getParamValue( 'action' ) === '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.util.getParamValue( 'action' ) === '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 * @method\n * @ignore\n * @param {Page} currentPage\n */\nfunction hideSectionEditIcons( currentPage ) {\n\tcurrentPage.$el.find( '.mw-editsection' ).hide();\n}\n\n/**\n * Show a drawer with log in / sign up buttons.\n * @method\n * @ignore\n */\nfunction showLoginDrawer() {\n\tvar drawer = new CtaDrawer( {\n\t\tcontent: mw.msg( 'mobile-frontend-editor-disabled-anon' ),\n\t\tsignupQueryParams: {\n\t\t\twarning: 'mobile-frontend-watchlist-signup-action'\n\t\t}\n\t} );\n\t$allEditLinks.on( 'click', function ( ev ) {\n\t\tdrawer.show();\n\t\tev.preventDefault();\n\t\treturn drawer;\n\t} );\n\trouter.route( editorPath, function () {\n\t\tdrawer.show();\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 * @method\n * @ignore\n * @param {Page} currentPage\n * @param {Skin} skin\n */\nfunction init( currentPage, skin ) {\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 );\n\t} else {\n\t\thideSectionEditIcons( currentPage );\n\t\teditRestrictions = mw.config.get( 'wgRestrictionEdit' );\n\t\tif ( mw.user.isAnon() && Array.isArray( editRestrictions ) && editRestrictions.indexOf( '*' ) !== -1 ) {\n\t\t\tshowLoginDrawer();\n\t\t} else {\n\t\t\teditErrorMessage = isReadOnly ? mw.msg( 'apierror-readonly' ) : mw.msg( 'mobile-frontend-editor-disabled' );\n\t\t\tshowSorryToast( editErrorMessage );\n\t\t}\n\t}\n}\n\n/**\n * Show a toast message with sincere condolences.\n * @method\n * @ignore\n * @param {string} msg Message for sorry message\n */\nfunction showSorryToast( msg ) {\n\t$allEditLinks.on( 'click', function ( ev ) {\n\t\tpopup.show( msg );\n\t\tev.preventDefault();\n\t} );\n\trouter.route( editorPath, function () {\n\t\tpopup.show( msg );\n\t} );\n\trouter.checkRoute();\n}\n\nmodule.exports = function ( currentPage, skin ) {\n\tvar isMissing = currentPage.options.id === 0;\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 (or is blacklisted), 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) Bug 58311\n\t\tshowSorryToast( mw.msg( 'mobile-frontend-editor-uploadenable' ) );\n\t} else {\n\t\t// Edit button is currently hidden. A call to init() will update it as needed.\n\t\tinit( currentPage, skin );\n\t}\n};\n","/* global $ */\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 * @class mw.mobileFrontend\n * @singleton\n */\nvar currentPage, skin, exports,\n\tstorage = mw.storage,\n\tskinName = mw.config.get( 'skin' ),\n\tisPageContentModelEditable = mw.config.get( 'wgMFIsPageContentModelEditable' ),\n\teditor = require( './editor' ),\n\tPageGateway = require( '../mobile.startup/PageGateway' ),\n\tBetaOptInPanel = require( './BetaOptInPanel' ),\n\tgateway = new PageGateway( new mw.Api() ),\n\tutil = mw.util,\n\tmfUtil = require( '../mobile.startup/util' ),\n\t$window = mfUtil.getWindow(),\n\t$html = mfUtil.getDocument(),\n\tuser = mw.user,\n\tcontext = require( '../mobile.startup/context' ),\n\tPage = require( '../mobile.startup/Page' ),\n\texperiments = mw.experiments,\n\tactiveExperiments = mw.config.get( 'wgMFExperiments' ) || {},\n\tSkin = require( '../mobile.startup/Skin' ),\n\teventBus = require( '../mobile.startup/eventBusSingleton' ),\n\tReferencesMobileViewGateway = require( '../mobile.startup/references/ReferencesMobileViewGateway' ),\n\tpage = getCurrentPage(),\n\tskinData = {\n\t\tel: 'body',\n\t\tpage: page,\n\t\treferencesGateway: ReferencesMobileViewGateway.getSingleton(),\n\t\teventBus: eventBus\n\t};\n\nskin = new Skin( skinData );\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 * @private\n * @param {Function} fn1\n * @param {Function} fn2\n * @return {Function} which returns the results of [fn1, fn2]\n */\nfunction apply2( fn1, fn2 ) {\n\treturn function () {\n\t\treturn [\n\t\t\tfn1.apply( this, arguments ),\n\t\t\tfn2.apply( this, arguments )\n\t\t];\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 * @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 * @event scroll\n */\n\n$window\n\t.on( 'resize', apply2(\n\t\t$.debounce( 100, function () { eventBus.emit( 'resize' ); } ),\n\t\t$.throttle( 200, function () { eventBus.emit( 'resize:throttled' ); } )\n\t) )\n\t.on( 'scroll', apply2(\n\t\t$.debounce( 100, function () { eventBus.emit( 'scroll' ); } ),\n\t\t$.throttle( 200, function () { eventBus.emit( 'scroll:throttled' ); } )\n\t) );\n\n/**\n * Get current page view object\n * @return {Page}\n */\nfunction getCurrentPage() {\n\tif ( currentPage ) {\n\t\treturn currentPage;\n\t} else {\n\t\treturn loadCurrentPage();\n\t}\n}\n\n/**\n * Constructs an incomplete Page object representing the currently loaded page.\n *\n * @private\n * @return {Page}\n */\nfunction loadCurrentPage() {\n\tvar permissions = mw.config.get( 'wgRestrictionEdit', [] ),\n\t\t$content = $( '#content #bodyContent' ),\n\t\ttitle = mw.Title.newFromText( mw.config.get( 'wgRelevantPageName' ) );\n\tif ( permissions.length === 0 ) {\n\t\tpermissions.push( '*' );\n\t}\n\tcurrentPage = new Page( {\n\t\tel: $content,\n\t\ttitle: title.getPrefixedText(),\n\t\ttitleObj: title,\n\t\tprotection: {\n\t\t\tedit: permissions\n\t\t},\n\t\trevId: mw.config.get( 'wgRevisionId' ),\n\t\tisMainPage: mw.config.get( 'wgIsMainPage' ),\n\t\tisWatched: $( '#ca-watch' ).hasClass( 'watched' ),\n\t\tsections: gateway.getSectionsFromHTML( $content ),\n\t\tisMissing: mw.config.get( 'wgArticleId' ) === 0,\n\t\tid: mw.config.get( 'wgArticleId' ),\n\t\tnamespaceNumber: mw.config.get( 'wgNamespaceNumber' )\n\t} );\n\treturn currentPage;\n}\n\n/**\n * Displays a prompt to ask the user to join the mobile beta mode.\n *\n * @private\n * @param {Object} experiment sampling data\n * @param {Page} page\n */\nfunction displayBetaOptIn( experiment, page ) {\n\tvar betaOptInPanel, inStable, inSample,\n\t\ttoken = storage.get( 'mobile-betaoptin-token' );\n\n\t// local storage is supported in this case, when ~ means it was dismissed\n\tif ( token !== false && token !== '~' &&\n\t\t!page.isMainPage() && !page.inNamespace( 'special' )\n\t) {\n\t\tif ( !token ) {\n\t\t\ttoken = user.generateRandomSessionId();\n\t\t\tstorage.set( 'mobile-betaoptin-token', token );\n\t\t}\n\n\t\tinStable = context.getMode() === 'stable';\n\t\tinSample = experiments.getBucket( experiment, token ) === 'A';\n\t\tif ( inStable && ( inSample || util.getParamValue( 'debug' ) ) ) {\n\t\t\tbetaOptInPanel = new BetaOptInPanel( {\n\t\t\t\tpostUrl: util.getUrl( 'Special:MobileOptions', {\n\t\t\t\t\treturnto: page.title\n\t\t\t\t} ),\n\t\t\t\tonCancel: function () {\n\t\t\t\t\tstorage.set( 'mobile-betaoptin-token', '~' );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tbetaOptInPanel.appendTo( page.getLeadSectionElement() );\n\t\t}\n\n\t\t// let the interested parties e.g. QuickSurveys know whether the panel is shown\n\t\tmw.track( 'mobile.betaoptin', {\n\t\t\tisPanelShown: betaOptInPanel !== undefined\n\t\t} );\n\t}\n}\n\n/**\n * Updates the font size based on the current value in storage\n */\nfunction updateFontSize() {\n\t// FIXME: Ideally 'regular' would come from a shared constant\n\t// (currently not possible without using webpack)\n\tvar userFontSize = storage.get( 'userFontSize', 'regular' );\n\t$html.addClass( 'mf-font-size-' + userFontSize );\n}\n\n// Font must be updated on back button press as users may click\n// back after changing font.\n$window.on( 'pageshow', function () {\n\tupdateFontSize();\n} );\nupdateFontSize();\n\nif ( activeExperiments.betaoptin ) {\n\tdisplayBetaOptIn( activeExperiments.betaoptin, getCurrentPage() );\n}\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 ( !page.inNamespace( 'special' ) && isPageContentModelEditable ) {\n\t// TODO: Mobile editor doesn't work well with other skins yet (it looks horribly broken\n\t// without some styles that are only defined by Minerva).\n\tif ( skinName === 'minerva' ) {\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 ( context.getMode() !== null ) {\n\t\t\teditor( page, skin );\n\t\t}\n\t}\n}\n\nexports = {\n\tgetCurrentPage: getCurrentPage\n};\n\n// Make getCurrentPage available to mobile.editor and Minerva modules\nmfUtil.extend( mw.mobileFrontend, exports );\nmw.log.deprecate( mw.mobileFrontend, 'getCurrentPage', getCurrentPage );\n\nmw.mobileFrontend.deprecate( 'mobile.init/skin', skin,\n\t'instance of mobile.startup/Skin. Minerva should have no dependencies on mobile.init' ); // resource-modules-disable-line\nmodule.exports = exports;\n"],"sourceRoot":""}