Jhernandez has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/337828 )
Change subject: Hygiene: Remove unnecessary IIFE in previewBehavior.js
......................................................................
Hygiene: Remove unnecessary IIFE in previewBehavior.js
Change-Id: I4f6f4094ba545f827dad28e966d69e6ecec3cea2
---
M src/previewBehavior.js
1 file changed, 47 insertions(+), 49 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups
refs/changes/28/337828/1
diff --git a/src/previewBehavior.js b/src/previewBehavior.js
index ec183ac..a8a8f8c 100644
--- a/src/previewBehavior.js
+++ b/src/previewBehavior.js
@@ -1,55 +1,53 @@
-( function ( mw, $ ) {
+var mw = window.mediaWiki;
- /**
- * @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
+ };
+};
--
To view, visit https://gerrit.wikimedia.org/r/337828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f6f4094ba545f827dad28e966d69e6ecec3cea2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits