PageSourceSearch

https://europeanfilmgateway.eu/modules/contrib/antibot/js/antibot.js?tk1ud0

js europeanfilmgateway.eu collected 2026-10-02 03:24:03 UTC 2,225 bytes, 70 lines download raw bytes

1/**
2 * @file
3 * Unlock protected forms.
4 *
5 * This works by resetting the form action to the path that It should be as well
6 * as injecting the secret form key, only if the current user is verified to be
7 * human which is done by waiting for a mousemove, swipe, or tab/enter key to be
8 * pressed.
9 */
10
11(function (Drupal, drupalSettings) {
12  "use strict";
13
14  Drupal.antibot = {};
15
16  Drupal.behaviors.antibot = {
17    attach: function (context) {
18      // Assume the user is not human, despite JS being enabled.
19      drupalSettings.antibot.human = false;
20
21      // Wait for a mouse to move, indicating they are human.
22      document.body.addEventListener('mousemove', function () {
23        // Unlock the forms.
24        Drupal.antibot.unlockForms();
25      });
26
27      // Wait for a touch move event, indicating that they are human.
28      document.body.addEventListener('touchmove', function () {
29        // Unlock the forms.
30        Drupal.antibot.unlockForms();
31      });
32
33      // A tab or enter key pressed can also indicate they are human.
34      document.body.addEventListener('keydown', function (e) {
35        if ((e.code == 'Tab') || (e.code == 'Enter')) {
36          // Unlock the forms.
37          Drupal.antibot.unlockForms();
38        }
39      });
40    }
41  };
42
43  /**
44   * Unlock all locked forms.
45   */
46  Drupal.antibot.unlockForms = function () {
47    // Act only if we haven't yet verified this user as being human.
48    if (!drupalSettings.antibot.human) {
49      // Check if there are forms to unlock.
50      if (drupalSettings.antibot.forms != undefined) {
51        // Iterate all antibot forms that we need to unlock.
52        Object.values(drupalSettings.antibot.forms).forEach(function (config) {
53          // Switch the action.
54          const form = document.getElementById(config.id);
55          if (form) {
56            form.setAttribute('action', form.getAttribute('data-action'));
57
58            // Set the key.
59            const input = form.querySelector('input[name="antibot_key"]');
60            if (input) {
61              input.value = config.key;
62            }
63          }
64        });
65      }
66      // Mark this user as being human.
67      drupalSettings.antibot.human = true;
68    }
69  };
70})(Drupal, drupalSettings);

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.