PageSourceSearch

https://usadf.gov/modules/contrib/captcha/image_captcha/js/image_captcha_refresh.js?v=1

js usadf.gov collected 2026-10-02 06:18:20 UTC 1,471 bytes, 49 lines download raw bytes

1/**
2 * @file
3 * Attaches behaviors for the zipang captcha refresh module.
4 */
5
6(function ($) {
7  'use strict';
8
9  /**
10   * Attaches jQuery validate behavoir to forms.
11   *
12   * @type {Drupal~behavior}
13   *
14   * @prop {Drupal~behaviorAttach} attach
15   *  Attaches the outline behavior to the right context.
16   */
17  Drupal.behaviors.CaptchaRefresh = {
18
19    attach: function (context) {
20      $('.reload-captcha', context).not('.processed').bind('click', function () {
21        $(this).addClass('processed');
22        var $form = $(this).parents('form');
23        // Send post query for getting new captcha data.
24        var date = new Date();
25        var baseUrl = document.location.origin;
26        var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime();
27        // Adding loader.
28        $('.captcha').append('<div class="image_captcha_refresh_loader"></div>');
29        $.get(
30          url,
31          {},
32          function (response) {
33            if (response.status === 1) {
34              $('.captcha', $form).find('img').attr('src', response.data.url);
35              $('input[name=captcha_sid]', $form).val(response.data.sid);
36              $('input[name=captcha_token]', $form).val(response.data.token);
37              $('.captcha .image_captcha_refresh_loader').remove();
38            }
39            else {
40              alert(response.message);
41            }
42          },
43          'json'
44        );
45        return false;
46      });
47    }
48  };
49})(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.