diff --git a/resources/dist/index.js b/resources/dist/index.js index eee3a03c8..0c2b6205d 100644 Binary files a/resources/dist/index.js and b/resources/dist/index.js differ diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index 77fabbbe8..720b3bd60 100644 Binary files a/resources/dist/index.js.map and b/resources/dist/index.js.map differ diff --git a/src/previewBehavior.js b/src/previewBehavior.js index ec183ac78..40d16f608 100644 --- a/src/previewBehavior.js +++ b/src/previewBehavior.js @@ -1,55 +1,54 @@ -( function ( mw, $ ) { +var mw = window.mediaWiki, + $ = jQuery; - /** - * @typedef {Object} ext.popups.PreviewBehavior - * @property {String} settingsUrl - * @property {Function} showSettings - * @property {Function} previewDwell - * @property {Function} previewAbandon - */ +/** + * @typedef {Object} ext.popups.PreviewBehavior + * @property {String} settingsUrl + * @property {Function} showSettings + * @property {Function} previewDwell + * @property {Function} previewAbandon + */ - /** - * Creates an instance of `ext.popups.PreviewBehavior`. - * - * If the user is logged out, then clicking the cog should show the settings - * modal. - * - * If the user is logged in, then clicking the cog should send them to the - * Special:Preferences page with the "Beta features" tab open if Page Previews - * is enabled as a beta feature, or the "Appearance" tab otherwise. - * - * @param {mw.Map} config - * @param {mw.User} user - * @param {Object} actions The action creators bound to the Redux store - * @return {ext.popups.PreviewBehavior} - */ - module.exports = function ( config, user, actions ) { - var isBetaFeature = config.get( 'wgPopupsBetaFeature' ), - rawTitle, - settingsUrl, - showSettings = $.noop; +/** + * Creates an instance of `ext.popups.PreviewBehavior`. + * + * If the user is logged out, then clicking the cog should show the settings + * modal. + * + * If the user is logged in, then clicking the cog should send them to the + * Special:Preferences page with the "Beta features" tab open if Page Previews + * is enabled as a beta feature, or the "Appearance" tab otherwise. + * + * @param {mw.Map} config + * @param {mw.User} user + * @param {Object} actions The action creators bound to the Redux store + * @return {ext.popups.PreviewBehavior} + */ +module.exports = function ( config, user, actions ) { + var isBetaFeature = config.get( 'wgPopupsBetaFeature' ), + rawTitle, + settingsUrl, + showSettings = $.noop; - if ( user.isAnon() ) { - showSettings = function ( event ) { - event.preventDefault(); + if ( user.isAnon() ) { + showSettings = function ( event ) { + event.preventDefault(); - actions.showSettings(); - }; - } else { - rawTitle = 'Special:Preferences#mw-prefsection-'; - rawTitle += isBetaFeature ? 'betafeatures' : 'rendering'; - - settingsUrl = mw.Title.newFromText( rawTitle ) - .getUrl(); - } - - return { - settingsUrl: settingsUrl, - showSettings: showSettings, - previewDwell: actions.previewDwell, - previewAbandon: actions.abandon, - previewShow: actions.previewShow + actions.showSettings(); }; - }; + } else { + rawTitle = 'Special:Preferences#mw-prefsection-'; + rawTitle += isBetaFeature ? 'betafeatures' : 'rendering'; -}( mediaWiki, jQuery ) ); + settingsUrl = mw.Title.newFromText( rawTitle ) + .getUrl(); + } + + return { + settingsUrl: settingsUrl, + showSettings: showSettings, + previewDwell: actions.previewDwell, + previewAbandon: actions.abandon, + previewShow: actions.previewShow + }; +};