forked from leftypol/leftypol
ajax.js: do not send request if captcha does not have a response
This commit is contained in:
parent
ae6b9edf45
commit
222c4c4d27
1 changed files with 12 additions and 6 deletions
18
js/ajax.js
18
js/ajax.js
|
@ -18,7 +18,13 @@ $(window).ready(function() {
|
|||
|
||||
// Enable submit button if disabled (cache problem)
|
||||
$('input[type="submit"]').removeAttr('disabled');
|
||||
|
||||
|
||||
// In the captcha is present, halt if it does not have a response..
|
||||
if (captcha_renderer && postCaptchaId && !captcha_renderer.hasResponse(postCaptchaId)) {
|
||||
captcha_renderer.execute(postCaptchaId);
|
||||
return false;
|
||||
}
|
||||
|
||||
var setup_form = function($form) {
|
||||
$form.submit(function() {
|
||||
if (do_not_ajax)
|
||||
|
@ -27,7 +33,7 @@ $(window).ready(function() {
|
|||
var submit_txt = $(this).find('input[type="submit"]').val();
|
||||
if (window.FormData === undefined)
|
||||
return true;
|
||||
|
||||
|
||||
var formData = new FormData(this);
|
||||
formData.append('json_response', '1');
|
||||
formData.append('post', submit_txt);
|
||||
|
@ -94,11 +100,11 @@ $(window).ready(function() {
|
|||
setTimeout(function() { $(window).trigger("scroll"); }, 100);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
highlightReply(post_response.id);
|
||||
window.location.hash = post_response.id;
|
||||
$(window).scrollTop($(document).height());
|
||||
|
||||
|
||||
$(form).find('input[type="submit"]').val(submit_txt);
|
||||
$(form).find('input[type="submit"]').removeAttr('disabled');
|
||||
$(form).find('input[name="subject"],input[name="file_url"],\
|
||||
|
@ -132,10 +138,10 @@ $(window).ready(function() {
|
|||
contentType: false,
|
||||
processData: false
|
||||
}, 'json');
|
||||
|
||||
|
||||
$(form).find('input[type="submit"]').val(_('Posting...'));
|
||||
$(form).find('input[type="submit"]').attr('disabled', true);
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue