PageSourceSearch

https://euphoria.eu/assets/invisibleRecaptcha.js

js euphoria.eu collected 2026-10-04 03:33:44 UTC 2,672 bytes, 74 lines download raw bytes

1(function(document, Nette, grecaptcha) {
2    var init = false;
3
4    // polyfill for closest() - method for traversing DOM and finding the closest parent matching given selector (form, in our case)
5    // @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
6    if (!Element.prototype.matches) {
7        Element.prototype.matches =
8            Element.prototype.msMatchesSelector ||
9            Element.prototype.mozMatchesSelector ||
10            Element.prototype.webkitMatchesSelector;
11    }
12
13    if (!Element.prototype.closest) {
14        Element.prototype.closest = function(s) {
15            var el = this;
16
17            do {
18                if (Element.prototype.matches.call(el, s)) return el;
19                el = el.parentElement || el.parentNode;
20            } while (el !== null && el.nodeType === 1);
21            return null;
22        };
23    }
24
25    Nette.recaptcha = function (grecaptcha) {
26        var items = document.getElementsByClassName('g-recaptcha');
27        var length = items.length;
28
29        if (length === 0) {
30            return;
31        }
32
33        grecaptcha.ready(function () {
34            var resolved = false;
35            var submitListenerFactory = function(form) {
36                return function (e) {
37                    // we already have reCaptcha response, or the form is invalid - or submission is prevented for some other, unknown reason
38                    if (resolved || e.defaultPrevented) {
39                        return;
40                    }
41
42                    e.preventDefault();
43
44                    grecaptcha.execute().then(function (token) {
45                        resolved = true;
46
47                        // reCaptcha token expires after 2 minutes; make it 5 seconds earlier just in case network is slow
48                        setTimeout(function(){ resolved = false; }, (2 * 60 - 5) * 1000);
49
50                        var inputs = document.getElementsByClassName('g-recaptcha-response');
51                        for (var i = 0; i < inputs.length; i++) {
52                            inputs[i].value = token;
53                        }
54
55                        form.submit();
56                    });
57                };
58            };
59
60            var form;
61            for (var i = 0; i < length; i++) {
62                grecaptcha.render(items[i]);
63
64                form = items[i].closest('form');
65                form.addEventListener('submit', submitListenerFactory(form));
66            }
67        });
68        init = true;
69    };
70
71    if (!init) {
72        Nette.recaptcha(grecaptcha);
73    }
74})(document, Nette, grecaptcha);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.