mege hasContent into submit
This commit is contained in:
parent
56aa4f92f1
commit
f8739831c7
@ -1383,9 +1383,6 @@
|
|||||||
ta.setSelectionRange(l, l);
|
ta.setSelectionRange(l, l);
|
||||||
return ta.focus();
|
return ta.focus();
|
||||||
},
|
},
|
||||||
hasContent: function() {
|
|
||||||
return $('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length;
|
|
||||||
},
|
|
||||||
keydown: function(e) {
|
keydown: function(e) {
|
||||||
if (!(e.keyCode === 13 && this.value)) {
|
if (!(e.keyCode === 13 && this.value)) {
|
||||||
return;
|
return;
|
||||||
@ -1448,7 +1445,7 @@
|
|||||||
},
|
},
|
||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
var captcha, challenge, el, qr, response;
|
var captcha, challenge, el, qr, response;
|
||||||
if (!QR.hasContent()) {
|
if (!($('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length)) {
|
||||||
if (e) {
|
if (e) {
|
||||||
alert('Error: No text entered.');
|
alert('Error: No text entered.');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1089,8 +1089,6 @@ QR =
|
|||||||
l = text.length
|
l = text.length
|
||||||
ta.setSelectionRange l, l
|
ta.setSelectionRange l, l
|
||||||
ta.focus()
|
ta.focus()
|
||||||
hasContent: ->
|
|
||||||
$('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length
|
|
||||||
keydown: (e) ->
|
keydown: (e) ->
|
||||||
return unless e.keyCode is 13 and @value #enter, captcha filled
|
return unless e.keyCode is 13 and @value #enter, captcha filled
|
||||||
QR.captchaPush @
|
QR.captchaPush @
|
||||||
@ -1135,8 +1133,8 @@ QR =
|
|||||||
QR.attachNext()
|
QR.attachNext()
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
#XXX e is undefined if method is called explicitly, eg, from auto posting
|
#XXX e is undefined if method is called explicitly, eg, from auto posting
|
||||||
unless QR.hasContent()
|
unless $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length
|
||||||
alert 'Error: No text entered.' if e #don't alert at the end of auto posting
|
alert 'Error: No text entered.' if e #only alert if explicitly submitting
|
||||||
return
|
return
|
||||||
{qr} = QR
|
{qr} = QR
|
||||||
$('.error', qr).textContent = ''
|
$('.error', qr).textContent = ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user