PageSourceSearch

https://www.msstate.edu/modules/antibot/js/antibot.js?tluxau

js msstate.edu collected 2026-09-24 08:04:59 UTC 2,006 bytes, 64 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      $('body').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      $('body').bind('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      $('body').keydown(function (e) {
35        if ((e.keyCode == 9) || (e.keyCode == 13)) {
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        $.each(drupalSettings.antibot.forms, function (id, config) {
53          // Switch the action.
54          $('form#' + config.id).attr('action', $('form#' + config.id).data('action'));
55
56          // Set the key.
57          $('form#' + config.id).find('input[name="antibot_key"]').val(config.key);
58        });
59      }
60      // Mark this user as being human.
61      drupalSettings.antibot.human = true;
62    }
63  };
64})(jQuery, 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.