QR.captchaImg

This commit is contained in:
James Campos 2011-09-03 23:12:35 -07:00
parent f205372b46
commit 5bbcee37ff
2 changed files with 23 additions and 12 deletions

View File

@ -1291,15 +1291,20 @@
}
},
captchaNode: function(e) {
var c;
c = e.target.value;
if (QR.qr) {
$('img', QR.qr).src = "http://www.google.com/recaptcha/api/image?c=" + c;
}
return QR.captcha = {
challenge: c,
QR.captcha = {
challenge: e.target.value,
time: Date.now()
};
return QR.captchaImg();
},
captchaImg: function() {
var c, qr;
qr = QR.qr;
if (!qr) {
return;
}
c = QR.captcha.challenge;
return $('img', qr).src = "http://www.google.com/recaptcha/api/image?c=" + c;
},
captchaPush: function(el) {
var captcha, captchas;
@ -1377,12 +1382,13 @@
QR.qr = qr = ui.dialog('qr', {
top: '0',
left: '0'
}, " <a class=close title=close>X</a><input type=checkbox id=autohide title=autohide> <div class=move><input placeholder=Name name=name form=qr_form class=inputtext>Quick Reply</div> <form enctype=multipart/form-data method=post action=http://sys.4chan.org/" + g.BOARD + "/post target=iframe id=qr_form> <input type=hidden name=resto value=" + tid + "> <input type=hidden name=mode value=regist> <input type=hidden name=recaptcha_challenge_field id=challenge> <input type=hidden name=recaptcha_response_field id=response> <div><input placeholder=Email name=email class=inputtext>" + QR.spoiler + "</div> <div><input placeholder=Subject name=sub class=inputtext><button>Submit</button><label>auto<input id=auto type=checkbox></label></div> <div><textarea placeholder=Comment name=com class=inputtext></textarea></div> <div><img src=http://www.google.com/recaptcha/api/image?c=" + QR.captcha.challenge + "></div> <div><input placeholder=Verification autocomplete=off id=recaptcha_response_field class=inputtext><span id=cl></span></div> <div>" + QR.file + "</div> </form> <div id=files></div> <div><input placeholder=Password name=pwd type=password class=inputtext><a id=attach>attach another file</a></div> <a class=error></a> ");
}, " <a class=close title=close>X</a><input type=checkbox id=autohide title=autohide> <div class=move><input placeholder=Name name=name form=qr_form class=inputtext>Quick Reply</div> <form enctype=multipart/form-data method=post action=http://sys.4chan.org/" + g.BOARD + "/post target=iframe id=qr_form> <input type=hidden name=resto value=" + tid + "> <input type=hidden name=mode value=regist> <input type=hidden name=recaptcha_challenge_field id=challenge> <input type=hidden name=recaptcha_response_field id=response> <div><input placeholder=Email name=email class=inputtext>" + QR.spoiler + "</div> <div><input placeholder=Subject name=sub class=inputtext><button>Submit</button><label>auto<input id=auto type=checkbox></label></div> <div><textarea placeholder=Comment name=com class=inputtext></textarea></div> <div><img></div> <div><input placeholder=Verification autocomplete=off id=recaptcha_response_field class=inputtext><span id=cl></span></div> <div>" + QR.file + "</div> </form> <div id=files></div> <div><input placeholder=Password name=pwd type=password class=inputtext><a id=attach>attach another file</a></div> <a class=error></a> ");
c = d.cookie;
$('[name=name]', qr).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
$('[name=email]', qr).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
$('[name=pwd]', qr).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
$('textarea', qr).value = text;
QR.captchaImg();
QR.captchaLength();
if (conf['Cooldown']) {
QR.cooldown();

View File

@ -1013,11 +1013,15 @@ QR =
else
QR.resetFile old
captchaNode: (e) ->
c = e.target.value
$('img', QR.qr).src = "http://www.google.com/recaptcha/api/image?c=#{c}" if QR.qr
QR.captcha =
challenge: c
challenge: e.target.value
time: Date.now()
QR.captchaImg()
captchaImg: ->
{qr} = QR
return unless qr
c = QR.captcha.challenge
$('img', qr).src = "http://www.google.com/recaptcha/api/image?c=#{c}"
captchaPush: (el) ->
{captcha} = QR
captcha.response = el.value
@ -1078,7 +1082,7 @@ QR =
<div><input placeholder=Email name=email class=inputtext>#{QR.spoiler}</div>
<div><input placeholder=Subject name=sub class=inputtext><button>Submit</button><label>auto<input id=auto type=checkbox></label></div>
<div><textarea placeholder=Comment name=com class=inputtext></textarea></div>
<div><img src=http://www.google.com/recaptcha/api/image?c=#{QR.captcha.challenge}></div>
<div><img></div>
<div><input placeholder=Verification autocomplete=off id=recaptcha_response_field class=inputtext><span id=cl></span></div>
<div>#{QR.file}</div>
</form>
@ -1092,6 +1096,7 @@ QR =
$('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
$('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
$('textarea', qr).value = text
QR.captchaImg()
QR.captchaLength()
QR.cooldown() if conf['Cooldown']
$.bind $('.close', qr), 'click', QR.close