push captcha

This commit is contained in:
James Campos 2011-07-31 22:22:08 -07:00
parent 291f43bb25
commit ad0e5a28ae
2 changed files with 22 additions and 5 deletions

View File

@ -1237,7 +1237,8 @@
});
$.append(d.body, iframe);
$.bind(window, 'message', qr.cb.message);
return $('#recaptcha_response_field').id = '';
$('#recaptcha_response_field').id = '';
return qr.captcha = [];
},
autohide: {
set: function() {
@ -1296,6 +1297,13 @@
return qr.quote(this);
}
},
push: function() {
this.nextSibling.textContent = qr.captcha.push({
challenge: $('input[name=recaptcha_challenge_field]', qr.el).value,
response: this.value
});
return Recaptcha.reload();
},
submit: function(e) {
var id, inputfile, isQR, op;
if (conf['Auto Watch Reply'] && conf['Thread Watcher']) {
@ -1373,7 +1381,7 @@
THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id;
spoiler = $('.postarea label') ? '<label> [<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
challenge = $('input[name=recaptcha_challenge_field]').value;
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail>" + spoiler + "</div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=" + submitValue + " id=com_submit " + submitDisabled + "><label><input type=checkbox id=auto>auto</label></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=http://www.google.com/recaptcha/api/image?c=" + challenge + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off><a name=add>Upload another file</a></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> <div id=files></div> <a id=error class=error></a> ";
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail>" + spoiler + "</div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=" + submitValue + " id=com_submit " + submitDisabled + "><label><input type=checkbox id=auto>auto</label></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=http://www.google.com/recaptcha/api/image?c=" + challenge + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off><a name=captcha>0</a></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist><a name=add>upload another file</a></div> </form> <div id=files></div> <a id=error class=error></a> ";
qr.el = ui.dialog('qr', {
top: '0px',
left: '0px'
@ -2467,8 +2475,9 @@
if (e.keyCode === 13 && cooldown.duration) {
$('#auto', qr.el).checked = true;
if (conf['Auto Hide QR']) {
return qr.autohide.set();
qr.autohide.set();
}
return qr.push.call(this);
}
},
reload: function() {

View File

@ -966,6 +966,7 @@ qr =
#hack - nuke id so it doesn't grab focus when reloading
$('#recaptcha_response_field').id = ''
qr.captcha = []
autohide:
set: ->
@ -1013,6 +1014,12 @@ qr =
e.preventDefault()
qr.quote @
push: ->
@nextSibling.textContent = qr.captcha.push
challenge: $('input[name=recaptcha_challenge_field]', qr.el).value
response: @value
Recaptcha.reload()
submit: (e) ->
if conf['Auto Watch Reply'] and conf['Thread Watcher']
if g.REPLY and $('img.favicon').src is Favicon.empty
@ -1092,9 +1099,9 @@ qr =
<div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=#{submitValue} id=com_submit #{submitDisabled}><label><input type=checkbox id=auto>auto</label></div>
<div><textarea class=inputtext name=com placeholder=Comment></textarea></div>
<div><img src=http://www.google.com/recaptcha/api/image?c=#{challenge}></div>
<div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off><a name=add>Upload another file</a></div>
<div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off><a name=captcha>0</a></div>
<div><input type=file name=upfile></div>
<div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div>
<div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist><a name=add>upload another file</a></div>
</form>
<div id=files></div>
<a id=error class=error></a>
@ -1863,6 +1870,7 @@ Recaptcha =
if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running
$('#auto', qr.el).checked = true
qr.autohide.set() if conf['Auto Hide QR']
qr.push.call this
reload: ->
window.location = 'javascript:Recaptcha.reload()'
reloaded: (e) ->