aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Senko <jakubsenko@gmail.com>2018-02-20 08:40:24 +0100
committerMarc Alexander <admin@m-a-styles.de>2019-09-24 14:03:38 +0200
commit0f3559528abb107c542050f592c1de4fef10e693 (patch)
tree9703e2db3ac395d50fc330d01b920cc43c3377bd
parent760a03fffc84b625a85d43bacd308cad35a668f0 (diff)
downloadforums-0f3559528abb107c542050f592c1de4fef10e693.tar
forums-0f3559528abb107c542050f592c1de4fef10e693.tar.gz
forums-0f3559528abb107c542050f592c1de4fef10e693.tar.bz2
forums-0f3559528abb107c542050f592c1de4fef10e693.tar.xz
forums-0f3559528abb107c542050f592c1de4fef10e693.zip
[ticket/15564] Use es2015
PHPBB3-15564
-rw-r--r--phpBB/assets/javascript/core.js46
1 files changed, 19 insertions, 27 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index c97eb4134a..2dc3ac27d1 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1650,47 +1650,39 @@ phpbb.lazyLoadAvatars = function loadAvatars() {
});
};
-// reCAPTCHA-related variables
-var recaptcha_form = $('.g-recaptcha').parents('form'),
- submit_button = null,
- programatically_submitted = false;
+const recaptchaForm = $('.g-recaptcha').parents('form');
+let submitButton = null;
+let programaticallySubmitted = false;
-/**
- * Function is called when reCAPTCHA code is loaded
- */
-phpbb.recaptchaOnLoad = function() {
+phpbb.recaptchaOnLoad = function () {
console.log('ahoj');
- // listen to submit buttons in order to know which one was pressed
- $('input[type="submit"]').each(function() {
- $(this).on('click', function() {
- submit_button = this;
+ // Listen to submit buttons in order to know which one was pressed
+ $('input[type="submit"]').each(() => {
+ $(this).on('click', () => {
+ submitButton = this;
});
});
- recaptcha_form.on('submit', function(e) {
- if (!programatically_submitted) {
+ recaptchaForm.on('submit', e => {
+ if (!programaticallySubmitted) {
grecaptcha.execute();
e.preventDefault();
}
});
}
-/**
- * Function is called after successful solving of reCAPTCHA
- */
-phpbb.recaptchaOnSubmit = function() {
- console.log('submit');
- programatically_submitted = true;
- // if concrete button was clicked (e.g. preview instead of submit),
+phpbb.recaptchaOnSubmit = function () {
+ programaticallySubmitted = true;
+ // If concrete button was clicked (e.g. preview instead of submit),
// let's trigger the same action
- if (submit_button) {
- submit_button.click();
+ if (submitButton) {
+ submitButton.click();
} else {
- // rename input[name="submit"] so that we can submit the form
- if (typeof recaptcha_form.submit !== 'function') {
- recaptcha_form.submit.name = 'submit_btn';
+ // Rename input[name="submit"] so that we can submit the form
+ if (typeof recaptchaForm.submit !== 'function') {
+ recaptchaForm.submit.name = 'submit_btn';
}
- recaptcha_form.submit();
+ recaptchaForm.submit();
}
}