Jhernandez has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/337823 )
Change subject: Hygiene: Remove unnecessary IIFE in
changeListeners/footerLink.js
......................................................................
Hygiene: Remove unnecessary IIFE in changeListeners/footerLink.js
Change-Id: Id1535ce6af0d2dda0e58b784180d3d072844daa8
---
M src/changeListeners/footerLink.js
1 file changed, 63 insertions(+), 65 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups
refs/changes/23/337823/1
diff --git a/src/changeListeners/footerLink.js
b/src/changeListeners/footerLink.js
index eaa1b9e..a94d8e5 100644
--- a/src/changeListeners/footerLink.js
+++ b/src/changeListeners/footerLink.js
@@ -1,74 +1,72 @@
-( function ( mw, $ ) {
+var mw = window.mediaWiki;
- /**
- * Creates the link element and appends it to the footer element.
- *
- * The following elements are considered to be the footer element
(highest
- * priority to lowest):
- *
- * # `#footer-places`
- * # `#f-list`
- * # The parent element of `#footer li`, which is either an `ol` or
`ul`.
- *
- * @return {jQuery} The link element
- */
- function createFooterLink() {
- var $link = $( '<li>' ).append(
- $( '<a>' )
- .attr( 'href', '#' )
- .text( mw.message(
'popups-settings-enable' ).text() )
- ),
- $footer;
+/**
+ * Creates the link element and appends it to the footer element.
+ *
+ * The following elements are considered to be the footer element (highest
+ * priority to lowest):
+ *
+ * # `#footer-places`
+ * # `#f-list`
+ * # The parent element of `#footer li`, which is either an `ol` or `ul`.
+ *
+ * @return {jQuery} The link element
+ */
+function createFooterLink() {
+ var $link = $( '<li>' ).append(
+ $( '<a>' )
+ .attr( 'href', '#' )
+ .text( mw.message( 'popups-settings-enable'
).text() )
+ ),
+ $footer;
- // As yet, we don't know whether the link should be visible.
- $link.hide();
+ // As yet, we don't know whether the link should be visible.
+ $link.hide();
- // From
https://en.wikipedia.org/wiki/MediaWiki:Gadget-ReferenceTooltips.js,
- // which was written by Yair rand
<https://en.wikipedia.org/wiki/User:Yair_rand>.
- $footer = $( '#footer-places, #f-list' );
+ // From
https://en.wikipedia.org/wiki/MediaWiki:Gadget-ReferenceTooltips.js,
+ // which was written by Yair rand
<https://en.wikipedia.org/wiki/User:Yair_rand>.
+ $footer = $( '#footer-places, #f-list' );
- if ( $footer.length === 0 ) {
- $footer = $( '#footer li' ).parent();
- }
-
- $footer.append( $link );
-
- return $link;
+ if ( $footer.length === 0 ) {
+ $footer = $( '#footer li' ).parent();
}
- /**
- * Creates an instance of the footer link change listener.
- *
- * The change listener covers the following behaviour:
- *
- * * The "Enable previews" link (the "link") is appended to the footer
menu
- * (see `createFooterLink` above).
- * * When Page Previews are disabled, then the link is shown;
otherwise, the
- * link is hidden.
- * * When the user clicks the link, then the `showSettings` bound action
- * creator is called.
- *
- * @param {Object} boundActions
- * @return {ext.popups.ChangeListener}
- */
- module.exports = function ( boundActions ) {
- var $footerLink;
+ $footer.append( $link );
- return function ( prevState, state ) {
- if ( $footerLink === undefined ) {
- $footerLink = createFooterLink();
- $footerLink.click( function ( e ) {
- e.preventDefault();
- boundActions.showSettings();
- } );
- }
+ return $link;
+}
- if ( state.settings.shouldShowFooterLink ) {
- $footerLink.show();
- } else {
- $footerLink.hide();
- }
- };
+/**
+ * Creates an instance of the footer link change listener.
+ *
+ * The change listener covers the following behaviour:
+ *
+ * * The "Enable previews" link (the "link") is appended to the footer menu
+ * (see `createFooterLink` above).
+ * * When Page Previews are disabled, then the link is shown; otherwise, the
+ * link is hidden.
+ * * When the user clicks the link, then the `showSettings` bound action
+ * creator is called.
+ *
+ * @param {Object} boundActions
+ * @return {ext.popups.ChangeListener}
+ */
+module.exports = function ( boundActions ) {
+ var $footerLink;
+
+ return function ( prevState, state ) {
+ if ( $footerLink === undefined ) {
+ $footerLink = createFooterLink();
+ $footerLink.click( function ( e ) {
+ e.preventDefault();
+ boundActions.showSettings();
+ } );
+ }
+
+ if ( state.settings.shouldShowFooterLink ) {
+ $footerLink.show();
+ } else {
+ $footerLink.hide();
+ }
};
-
-}( mediaWiki, jQuery ) );
+};
--
To view, visit https://gerrit.wikimedia.org/r/337823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1535ce6af0d2dda0e58b784180d3d072844daa8
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