From d54cfc2e4277a482ea16b1ad6053458afe6ce61a Mon Sep 17 00:00:00 2001 From: joakin Date: Tue, 14 Feb 2017 21:17:06 +0100 Subject: [PATCH] Hygiene: Remove unnecessary IIFE in previewBehavior.js Change-Id: I4f6f4094ba545f827dad28e966d69e6ecec3cea2 --- resources/dist/index.js | Bin 128182 -> 128125 bytes resources/dist/index.js.map | Bin 161894 -> 161782 bytes src/previewBehavior.js | 97 ++++++++++++++++++------------------ 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/resources/dist/index.js b/resources/dist/index.js index eee3a03c8748b3ec911b7d53d084d1e6bfeee2ad..0c2b6205d8804243c9f137e3c55dbc55e18eea15 100644 GIT binary patch delta 323 zcmdn?lKt-s_6_CNCoga`nf_XwQDyRi8ywROB^V_pKe*02`Q3FjAeNY{dxH;3vrmq` z!O5(kr9W9ASb1{q4S67&Yx2e${(K5r3c2|yi8*>)oFE~=o4%9dZw5@>aMN|Vsuv^w z^w*+{LShOI1&Kw8xeC>}<$9sTsYSI4r9g7}Lu*FS=>j&4Y?Hlj8B7Xd_6_CNr&n?^N>4sosW$z*I3xSy^Vhj1-?*+aS@DJ>UvWl$d2nh;NoHPp zF&8ILNF9h3*d3D+^HTEjCP!AuPRih$Jne=&E2n}MP{EEH{(?Z3LT-LaVvZgcCqz{A zrtjp$n}L%z-gKL6oGCb2o?TR=Ah9ShSD`w$TradZwWwC16i7~f_)=`TT^J+VWY1d$ zlLhZfOrCH{hz)3lJ{RY7#(j)ZlMmdIpM39@trcfcVtGhrNlvN`&<;+{VyF{Ci*ld> zNbXj!RZ!8(%g-;c=Hdi8G4Qs`EFt&{iPQJVbVj>cs6yQ-75@2apv V46dENP>4~tIpyy5l)H?Q;sElchl2nB diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index 77fabbbe8415b347d873cf9c6fec3eb841f12f86..720b3bd60e4613a42da386a2314b55be5d75a655 100644 GIT binary patch delta 513 zcmZvYKWGzS7{+;1YkE+V6x$@C_O2#cjYnG=nkEE8zoshE{JBdkML61~_Dd*S&T=`E zp$6O>>=616uUp;3E?Qf0k=or!u$%Y?#3^9A=pyK+u3cW9=f?x@!}IMx`teP95{n+a6!DhhivZut4!1led zm$4%|k-h=F+qcXopJ;v%B&yDVO0jha~ zE;Vj0J0@2R%Ww>*#vNzbs?=s|QxIzBK_QO@XGqoHawo5I%fZ7JePB^tgOID4B$jra zq#X@n)YgE}ur5?Z2M^8efCuN++|<%RrY#)?=)De?=(jEg87zpQ!n>&ln+15aS#Z5R F{|6iFta<TI5{XTx{207ii1Ckiy-D=H{}iA`+nZf&u_x#@50i!GaAc} z`NsU05#4Z;p`A+KS70Gc}Z1zrS3~r-KLk_DkIY~&kR?kNt zj{Wx`UcU+Fs;uAnK#R}4E4Q$f`Zl~2{$*o11-nHv_{R;nxs*bONiL@l+{7OKn1W51 ztQK`$oBQjvG?5lwy6D-4K)>HO*qw&2T{HYct;~TmGA@((&y`N+^u4CIX|1G@GFN{} zBWq$LgCo3LM>i*K!^y8tLg0D^o!osLEOVS4eUm&Ik+Xss-8yM{2!ax;*Z zF+QLfm0b1Mtf3b}<|VV{i-s{fH#2{{qPH|&li}z0GWy$^=Gjt}mg*kbezl8(3U=_6 z0-segu5dYN>EVkC#`vCs3I3`e#yeGr9H^m>kE-zT85ILuQ?ZBds~F^WDuS)i#9f@K N#j|)6&srYu`U5eLwqpPQ 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 + }; +};