mege hasContent into submit

This commit is contained in:
James Campos 2011-09-03 12:54:18 -07:00
parent 56aa4f92f1
commit f8739831c7
2 changed files with 3 additions and 8 deletions

View File

@ -1383,9 +1383,6 @@
ta.setSelectionRange(l, l);
return ta.focus();
},
hasContent: function() {
return $('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length;
},
keydown: function(e) {
if (!(e.keyCode === 13 && this.value)) {
return;
@ -1448,7 +1445,7 @@
},
submit: function(e) {
var captcha, challenge, el, qr, response;
if (!QR.hasContent()) {
if (!($('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length)) {
if (e) {
alert('Error: No text entered.');
}

View File

@ -1089,8 +1089,6 @@ QR =
l = text.length
ta.setSelectionRange l, l
ta.focus()
hasContent: ->
$('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length
keydown: (e) ->
return unless e.keyCode is 13 and @value #enter, captcha filled
QR.captchaPush @
@ -1135,8 +1133,8 @@ QR =
QR.attachNext()
submit: (e) ->
#XXX e is undefined if method is called explicitly, eg, from auto posting
unless QR.hasContent()
alert 'Error: No text entered.' if e #don't alert at the end of auto posting
unless $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length
alert 'Error: No text entered.' if e #only alert if explicitly submitting
return
{qr} = QR
$('.error', qr).textContent = ''