PageSourceSearch

https://www.jhrl.com/sites/all/modules/bluetent/bt_leads/js/bt_leads-antibot-workaround.js?tlse4v

js jhrl.com collected 2026-10-06 13:18:07 UTC 2,509 bytes, 57 lines download raw bytes

1(function ($, Drupal) {
2
3    Drupal.behaviors.bt_leads_antibot_workaround = {
4        attach: function (context, settings) {
5            // Add a function that reacts on bt_leads form popups
6            $('body').once(function () {
7                // Select the node that will be observed for mutations
8                const targetNode = document.getElementsByTagName("body")[0];
9
10                // Options for the observer (which mutations to observe)
11                const config = { attributes: false, childList: true, subtree: false };
12
13                // Callback function to execute when mutations are observed
14                const callback = (mutationList, observer) => {
15                    for (const mutation of mutationList) {
16                        if (mutation.type === "childList") {
17                            // Search for a bt_leads form.
18                            let $form = $('body > div.reveal-modal form[id^=bt-leads]');
19
20                            if (!$form.length) {
21                                return;
22                            }
23
24                            // Form found, process the real antibot workaround.
25                            $.get('/bt-leads-antibot-workaround')
26                                .done(function (data) {
27                                    // Check antibot settings exist.
28                                    if (!settings.antibot) {
29                                        return;
30                                    }
31
32                                    // Add the forms info to antibot.
33                                    settings.antibot.forms = data;
34
35                                    // Reset the human flag.
36                                    settings.antibot.human = false;
37
38                                    // The last step, when the form is enabled, is run as usual,
39                                    // as defined in the antibot module.
40                                    // @see antibot.js.
41                                });
42                        }
43                    }
44                };
45
46                // Create an observer instance linked to the callback function
47                const observer = new MutationObserver(callback);
48
49                // Start observing the target node for configured mutations
50                observer.observe(targetNode, config);
51
52                // // Later, you can stop observing
53                // observer.disconnect();
54            });
55        }
56    }
57})(jQuery, Drupal);

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.