1/* Source and licensing information for the line(s) below can be found at https://www.oiv.int/modules/contrib/captcha/modules/image_captcha/js/image_captcha_refresh.js. */ 2/** 3 * @file 4 * Attaches behaviors for the zipang captcha refresh module. 5 */ 6 7(function ($) { 8 "use strict"; 9 10 /** 11 * Attaches jQuery validate behavior to forms. 12 * 13 * @type {Drupal~behavior} 14 * 15 * @prop {Drupal~behaviorAttach} attach 16 * Attaches the outline behavior to the right context. 17 */ 18 Drupal.behaviors.CaptchaRefresh = { 19 attach: function (context) { 20 $('.reload-captcha', context).not('.processed').bind('click', function () { 21 $(this).addClass('processed'); 22 const $form = $(this).parents('form'); 23 // Send post query for getting new captcha data. 24 const date = new Date(); 25 const baseUrl = document.location.origin; 26 const url = baseUrl.replace(/\/$/g, '') + '/' + $(this).attr('href').replace(/^\//g, '') + '?' + date.getTime(); 27 // Adding loader. 28 $('.captcha').addClass('captcha--loading'); 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').removeClass('captcha--loading'); 38 } 39 else { 40 alert(response.message); 41 } 42 }, 43 'json' 44 ); 45 return false; 46 }); 47 } 48 }; 49})(jQuery); 50 51/* Source and licensing information for the above line(s) can be found at https://www.oiv.int/modules/contrib/captcha/modules/image_captcha/js/image_captcha_refresh.js. */
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.