mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
Hygiene: Remove unnecessary IIFE in previewBehavior.js
Change-Id: I4f6f4094ba545f827dad28e966d69e6ecec3cea2
This commit is contained in:
parent
7b86981054
commit
d54cfc2e42
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map
vendored
BIN
resources/dist/index.js.map
vendored
Binary file not shown.
|
@ -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
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue