Commit 2e2029b3 authored by elachlan's avatar elachlan

Issue #2887225 by arunkumark, jayesh_makwana, chishah92, Sivaprasad C,...

Issue #2887225 by arunkumark, jayesh_makwana, chishah92, Sivaprasad C, elachlan: Coding Standard issues
parent 483780b9
...@@ -4,42 +4,42 @@ ...@@ -4,42 +4,42 @@
*/ */
(function ($) { (function ($) {
'use strict';
/**
* Attaches jQuery validate behavoir to forms.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the outline behavior to the right context.
*/
Drupal.behaviors.CaptchaRefresh = {
/** attach: function (context) {
* Attaches jQuery validate behavoir to forms. $('.reload-captcha', context).not('.processed').bind('click', function () {
* $(this).addClass('processed');
* @type {Drupal~behavior} var $form = $(this).parents('form');
* // Send post query for getting new captcha data.
* @prop {Drupal~behaviorAttach} attach var date = new Date();
* Attaches the outline behavior to the right context. var baseUrl = document.location.origin;
*/ var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime();
Drupal.behaviors.CaptchaRefresh = { $.get(
url,
attach: function (context) { {},
$('.reload-captcha', context).not('.processed').bind('click', function () { function (response) {
$(this).addClass('processed'); if (response.status === 1) {
var $form = $(this).parents('form'); $('.captcha', $form).find('img').attr('src', response.data.url);
// Send post query for getting new captcha data. $('input[name=captcha_sid]', $form).val(response.data.sid);
var date = new Date(); $('input[name=captcha_token]', $form).val(response.data.token);
var baseUrl = document.location.origin; }
var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime(); else {
$.get( alert(response.message);
url, }
{}, },
function (response) { 'json'
if(response.status == 1) { );
$('.captcha', $form).find('img').attr('src', response.data.url); return false;
$('input[name=captcha_sid]', $form).val(response.data.sid); });
$('input[name=captcha_token]', $form).val(response.data.token); }
} };
else {
alert(response.message);
}
},
'json'
);
return false;
});
}
};
})(jQuery); })(jQuery);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment