PageSourceSearch

https://feedindiana.org/sites/all/modules/antibot/js/antibot.js?sf12gi

js feedindiana.org collected 2026-10-01 14:50:26 UTC 1,870 bytes, 59 lines download raw bytes

1/**
2 * @file
3 *   Unlock protected forms by resetting the form action to the path that
4 *   it should be, only if the current user is verified to be human.
5 */
6(function ($) {
7  Drupal.antibot = {};
8
9  Drupal.behaviors.antibot = {
10    attach: function (context) {
11      // Assume the user is not human, despite JS being enabled.
12      Drupal.settings.antibot.human = false;
13
14      // Wait for a mouse to move, indicating they are human.
15      $('body').mousemove(function() {
16        // Unlock the forms.
17        Drupal.antibot.unlockForms();
18      });
19
20      // Wait for a touch move event, indicating that they are human.
21      $('body').bind('touchmove', function() {
22        // Unlock the forms.
23        Drupal.antibot.unlockForms();
24      });
25
26      // A tab or enter key pressed can also indicate they are human.
27      $('body').keydown(function(e) {
28        if ((e.keyCode == 9) || (e.keyCode == 13)) {
29          // Unlock the forms.
30          Drupal.antibot.unlockForms();
31        }
32      });
33    }
34  };
35
36  /**
37   * Revert the action on the protected forms to what it was originally
38   * set to.
39   */
40  Drupal.antibot.unlockForms = function() {
41    // Act only if we haven't yet verified this user as being human.
42    if (!Drupal.settings.antibot.human) {
43      // Iterate all antibot forms that we need to unlock.
44      for (var id in Drupal.settings.antibot.forms) {
45        // Switch the action to the original value.
46        $('form#' + id).attr('action', Drupal.settings.antibot.forms[id].action);
47
48        // Check if a key is required.
49        if (Drupal.settings.antibot.forms[id].key) {
50          // Inject the key value.
51          $('form#' + id).find('input[name="antibot_key"]').val(Drupal.settings.antibot.forms[id].key);
52        }
53      }
54      // Mark this user as being human.
55      Drupal.settings.antibot.human = true;
56    }
57  };
58
59})(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.