Total Complexity | 7 |
Complexity/F | 3.5 |
Lines of Code | 35 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | |||
2 | var captcha_version = 17; |
||
3 | var captcha_done = false; |
||
4 | var captcha_label = document.currentScript.getAttribute('label'); |
||
5 | var captcha_enemies = parseInt(document.currentScript.getAttribute('enemies')); |
||
6 | if (!captcha_enemies) { |
||
7 | captcha_enemies = 4; |
||
8 | } |
||
9 | |||
10 | var captcha_html = ''; |
||
11 | if (captcha_label) { |
||
12 | captcha_html = '<p>' + captcha_label + '<br>'; |
||
13 | } |
||
14 | |||
15 | captcha_html += '<iframe id="doom_captcha" src="https://vivirenremoto.github.io/doomcaptcha/captcha.html?version=' + captcha_version + '&countdown=' + document.currentScript.getAttribute('countdown') + '&enemies=' + captcha_enemies + '" style="width:300px;height:150px;border:2px black solid;"></iframe>'; |
||
16 | |||
17 | if (captcha_label) { |
||
18 | captcha_html += '</p>'; |
||
19 | } |
||
20 | |||
21 | document.write(captcha_html); |
||
22 | |||
23 | window.addEventListener('message', function (e) { |
||
24 | if (e.origin.indexOf('vivirenremoto.github.io') > -1) { |
||
25 | captcha_done = true; |
||
26 | document.getElementById('doom_captcha').style.borderColor = 'black'; |
||
27 | } |
||
28 | }, false); |
||
29 | |||
30 | document.getElementById('doom_captcha').closest('form').addEventListener('submit', function () { |
||
31 | if (!captcha_done) { |
||
32 | document.getElementById('doom_captcha').style.borderColor = 'red'; |
||
33 | event.preventDefault(); |
||
|
|||
34 | return; |
||
35 | } |
||
36 | }); |
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.