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 ( 802a3b...83f843 )
by Sebastian
02:02
created

javascript/ReCaptchaField.js   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 41
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 25
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 41
rs 9.28

5 Functions

Rating   Name   Duplication   Size   Complexity  
A ReCaptchaField.js ➔ reCaptchaInit 0 8 2
A ReCaptchaField.js ➔ reCaptchaOnSubmit 0 4 1
A ReCaptchaField.js ➔ reCaptchaForm 0 3 1
A ReCaptchaField.js ➔ reCaptchaFormOnSubmit 0 4 1
A ReCaptchaField.js ➔ reCaptchaOnloadCallback 0 9 2
1
/** global: grecaptcha */
2
3
(function (window, document) {
4
    'use strict';
5
6
    function reCaptchaInit() {
7
        var element = document.createElement('script'),
8
            target = document.querySelectorAll('script')[0],
9
            protocol = 'https:' == document.location.protocol ? 'https' : 'http';
10
        element.type = 'text/javascript';
11
        element.src = protocol + '://www.google.com/recaptcha/api.js?onload=reCaptchaOnloadCallback&render=explicit&hl='.concat(window.SS_LOCALE);
12
        target.parentNode.insertBefore(element, target);
13
    }
14
15
    function reCaptchaOnloadCallback() {
16
        var reCaptcha = document.querySelector('.g-recaptcha');
17
18
        if (reCaptcha.dataset.size === 'invisible') {
19
            reCaptchaForm().addEventListener('submit', reCaptchaFormOnSubmit);
20
        }
21
22
        grecaptcha.render(reCaptcha, reCaptcha.dataset);
23
    }
24
25
    function reCaptchaOnSubmit(token) {
26
        document.querySelector('#'.concat(window.ReCaptchaFormId, ' .g-recaptcha-response')).value = token;
27
        reCaptchaForm().submit();
28
    }
29
30
    function reCaptchaForm() {
31
        return document.querySelector('#'.concat(window.ReCaptchaFormId));
32
    }
33
34
    function reCaptchaFormOnSubmit(event) {
35
        event.preventDefault();
36
        grecaptcha.execute();
37
    }
38
39
    domReady(reCaptchaInit);
40
41
    window.reCaptchaOnloadCallback = reCaptchaOnloadCallback;
42
    window.reCaptchaOnSubmit = reCaptchaOnSubmit;
43
})(window, document);
44
45