holly-packages
Version:
Packages for Holly app.
36 lines (29 loc) • 613 B
JavaScript
(function($) {
"use strict";
/**
* The captcha image URL.
*
* @type {String}
*/
if (!window.CAPTCHA_URL) {
window.CAPTCHA_URL = '/captcha';
}
/**
* Refresh captchas image.
*
* @param {Object} input The input element which will be cleared.
*/
$.fn.refreshCaptcha = function(input) {
if (!this.length) {
return this;
}
$(this).find('img.captcha').attr('src', CAPTCHA_URL + '?' + Math.random());
if (input === undefined) {
input = $('input.captcha');
}
if (input) {
$(input).val('');
}
return this;
};
})(jQuery);