Skip to content

Commit bd4465a

Browse files
committed
Fix JS code styles
1 parent 2c2008b commit bd4465a

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* global grecaptcha */
67
define([
78
'jquery'
89
], function ($) {
@@ -35,12 +36,11 @@ define([
3536
* Show additional reCaptcha instance if any other should be visible, otherwise hide it.
3637
*/
3738
resolveVisibility: function () {
38-
reCaptchaEntities.some(
39-
(entity) => {
40-
return entity.is(":visible")
41-
// 900 is some magic z-index value of modal popups.
42-
&& (entity.closest("[data-role='modal']").length === 0 || entity.zIndex() > 900)
43-
}) ? rendererReCaptcha.show() : rendererReCaptcha.hide();
39+
reCaptchaEntities.some(function (entity) {
40+
return entity.is(':visible') &&
41+
// 900 is some magic z-index value of modal popups.
42+
(entity.closest('[data-role=\'modal\']').length === 0 || entity.zIndex() > 900);
43+
}) ? rendererReCaptcha.show() : rendererReCaptcha.hide();
4444
},
4545

4646
/**

ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
/* eslint-disable no-undef */
7-
// jscs:disable jsDoc
6+
/* global grecaptcha */
87
define(
98
[
109
'uiComponent',
1110
'jquery',
1211
'ko',
12+
'underscore',
1313
'Magento_ReCaptchaFrontendUi/js/registry',
1414
'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader',
15-
'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer',
16-
],
17-
function (Component, $, ko, registry, reCaptchaLoader,nonInlineReCaptchaRenderer) {
15+
'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer'
16+
], function (Component, $, ko, _, registry, reCaptchaLoader, nonInlineReCaptchaRenderer) {
1817
'use strict';
1918

2019
return Component.extend({
@@ -24,6 +23,9 @@ define(
2423
reCaptchaId: 'recaptcha'
2524
},
2625

26+
/**
27+
* @inheritdoc
28+
*/
2729
initialize: function () {
2830
this._super();
2931
this._loadApi();
@@ -116,7 +118,7 @@ define(
116118
);
117119

118120
if (parameters.size === 'invisible' && parameters.badge !== 'inline') {
119-
nonInlineReCaptchaRenderer.add($reCaptcha, parameters)
121+
nonInlineReCaptchaRenderer.add($reCaptcha, parameters);
120122
}
121123

122124
// eslint-disable-next-line no-undef
@@ -161,6 +163,11 @@ define(
161163
}
162164
},
163165

166+
/**
167+
* Validates reCAPTCHA
168+
* @param {*} state
169+
* @returns {jQuery}
170+
*/
164171
validateReCaptcha: function (state) {
165172
if (!this.getIsInvisibleRecaptcha()) {
166173
return $(document).find('input[type=checkbox].required-captcha').prop('checked', state);
@@ -188,5 +195,4 @@ define(
188195
return this.reCaptchaId;
189196
}
190197
});
191-
}
192-
);
198+
});

0 commit comments

Comments
 (0)