PageSourceSearch

https://torpsbruk.nu/files/dist/4.0/js/general/jquery/captcha.js?cc=4.171790329663

js torpsbruk.nu collected 2026-09-25 09:47:57 UTC 1,691 bytes, 56 lines download raw bytes

1/**
2 * Captcha tools
3 *
4 * Usage example:
5 * <form id="theForm" onsubmit="return checkForm()">
6 * <script>
7 * function checkForm()
8 * {
9 *		if (some other validation) {
10 *			return false;
11 *		}
12 *		// key1 and key2 are generated server-side (stage 1 captcha keys)
13 *		return FSY.captcha.validate('theForm', 'key1', 'key2');
14 * }
15 * </script>
16 */
17
18(function(FSY, $, undefined) {
19    // Return this for onsubmit of the form
20    function validate(key1, key2, formID)
21    {
22        // Fetch stage 2 keys, store them in cookie and sumbit the form
23        $.getJSON('/fe-ax/?ajaxaction=get-captcha-keys&key1=' + encodeURIComponent(key1) + '&key2=' + encodeURIComponent(key2), function(data)
24        {
25            setCaptchaCookies(data.key1, data.key2);
26            $('#' + formID)[0].submit();
27        });
28
29        // Return false to stop form from submitting
30        return false;
31    }
32
33    // Used when form is submitted using ajax/xhr
34    function validateXHR(key1, key2, callback)
35    {
36        // Fetch stage 2 keys, store them in cookie and runs the callback function
37        $.getJSON('/fe-ax/?ajaxaction=get-captcha-keys&key1=' + encodeURIComponent(key1) + '&key2=' + encodeURIComponent(key2), function(data)
38        {
39            setCaptchaCookies(data.key1, data.key2);
40            callback();
41        });
42    }
43
44    function setCaptchaCookies(key1, key2)
45    {
46        document.cookie = 'captchakey1=' + encodeURIComponent(key1) + '; path=/';
47        document.cookie = 'captchakey2=' + encodeURIComponent(key2) + '; path=/';
48    }
49
50    // Public API
51    FSY.captcha = {
52        validate: validate,
53        validateXHR: validateXHR
54    };
55
56}( window.FSY = window.FSY || {}, jQuery ));

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.