GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ba10d9...348b84 )
by Sebastian
03:16
created

javascript/ReCaptchaField.js   A

Complexity

Total Complexity 6
Complexity/F 1.5

Size

Lines of Code 32
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 0
eloc 20
nc 1
dl 0
loc 32
rs 10
c 5
b 0
f 0
wmc 6
mnd 1
bc 5
fnc 4
bpm 1.25
cpm 1.5
noi 2

4 Functions

Rating   Name   Duplication   Size   Complexity  
A ReCaptchaField.js ➔ reCaptchaInit 0 8 2
A ReCaptchaField.js ➔ reCaptchaOnSubmit 0 4 1
A ReCaptchaField.js ➔ reCaptchaFormOnSubmit 0 4 1
A ReCaptchaField.js ➔ reCaptchaOnloadCallback 0 9 2
1
'use strict';
2
3
function reCaptchaInit() {
4
    var element = document.createElement('script'),
5
        target = document.querySelectorAll('script')[0],
6
        protocol = 'https:' == document.location.protocol ? 'https' : 'http';
7
    element.type = 'text/javascript';
8
    element.src = protocol + '://www.google.com/recaptcha/api.js?onload=reCaptchaOnloadCallback&render=explicit&hl='.concat(window.SS_LOCALE);
9
    target.parentNode.insertBefore(element, target);
10
}
11
12
function reCaptchaOnloadCallback() {
13
    var reCaptcha = document.querySelector('.g-recaptcha');
14
15
    if (reCaptcha.dataset.size === 'invisible') {
16
        document.querySelector('#'.concat(window.ReCaptchaFormId)).addEventListener('submit', reCaptchaFormOnSubmit);
17
    }
18
19
    grecaptcha.render(reCaptcha, reCaptcha.dataset);
0 ignored issues
show
Bug introduced by
The variable grecaptcha seems to be never declared. If this is a global, consider adding a /** global: grecaptcha */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
20
}
21
22
function reCaptchaOnSubmit(token) {
23
    document.querySelector('#'.concat(window.ReCaptchaFormId, ' .g-recaptcha-response')).value = token;
24
    document.querySelector('#'.concat(window.ReCaptchaFormId)).submit();
25
}
26
27
function reCaptchaFormOnSubmit(event) {
28
    event.preventDefault();
29
    grecaptcha.execute();
0 ignored issues
show
Bug introduced by
The variable grecaptcha seems to be never declared. If this is a global, consider adding a /** global: grecaptcha */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
30
}
31
32
domReady(reCaptchaInit);
33