don't clone captcha

This commit is contained in:
James Campos 2011-05-15 13:10:38 -07:00
parent 464dff2b7b
commit 55cfbf46c3
2 changed files with 11 additions and 20 deletions

View File

@ -1139,13 +1139,15 @@
}
},
dialog: function(link) {
var MAX_FILE_SIZE, THREAD_ID, clone, dialog, el, html, mail, name, pass, spoiler;
var MAX_FILE_SIZE, THREAD_ID, challenge, dialog, el, html, mail, name, pass, spoiler, src;
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value;
THREAD_ID = g.THREAD_ID || $.x('preceding::div[@class="op"][1]', link).id;
challenge = $('input[name=recaptcha_challenge_field]').value;
src = "http://www.google.com/recaptcha/api/image?c=" + challenge;
name = $('input[name=name]').value;
mail = $('input[name=email]').value;
pass = $('input[name=pwd]').value;
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form value='" + name + "'> 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=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <input type=hidden name=resto value=" + THREAD_ID + "> <div><input class=inputtext type=text name=email placeholder=E-mail value='" + mail + "'></div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=Submit id=com_submit></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div id=qr_captcha></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value='" + pass + "'><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> ";
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form value='" + name + "'> 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=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <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 value='" + mail + "'></div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=Submit id=com_submit></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=" + src + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value='" + pass + "'><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> ";
dialog = ui.dialog('qr', {
top: '0px',
left: '0px'
@ -1161,15 +1163,8 @@
});
$.after($('input[name=email]', dialog), spoiler);
}
clone = $('#recaptcha_widget_div').cloneNode(true);
$.append($('#qr_captcha', dialog), clone);
$.extend($('input[name=recaptcha_response_field]', clone), {
placeholder: 'Verification',
className: 'inputtext',
required: true
});
$.bind($('form', dialog), 'submit', qr.cb.submit);
$.bind($('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener);
$.bind($('input[name=recaptcha_response_field]', dialog), 'keydown', Recaptcha.listener);
$.append(d.body, dialog);
return dialog;
},

View File

@ -898,6 +898,8 @@ qr =
#maybe should be global
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value
THREAD_ID = g.THREAD_ID or $.x('preceding::div[@class="op"][1]', link).id
challenge = $('input[name=recaptcha_challenge_field]').value
src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
name = $('input[name=name]').value
mail = $('input[name=email]').value
pass = $('input[name=pwd]').value
@ -911,10 +913,12 @@ qr =
<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=MAX_FILE_SIZE value=#{MAX_FILE_SIZE}>
<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 value='#{mail}'></div>
<div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=Submit id=com_submit></div>
<div><textarea class=inputtext name=com placeholder=Comment></textarea></div>
<div id=qr_captcha></div>
<div><img src=#{src}></div>
<div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div>
<div><input type=file name=upfile></div>
<div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value='#{pass}'><input type=hidden name=mode value=regist></div>
</form>
@ -931,16 +935,8 @@ qr =
innerHTML: " [<input type=checkbox name=spoiler>Spoiler Image?]"
$.after $('input[name=email]', dialog), spoiler
# TODO try w/o cloning
clone = $('#recaptcha_widget_div').cloneNode(true)
$.append $('#qr_captcha', dialog), clone
$.extend $('input[name=recaptcha_response_field]', clone),
placeholder: 'Verification'
className: 'inputtext'
required: true
$.bind $('form', dialog), 'submit', qr.cb.submit
$.bind $('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener
$.bind $('input[name=recaptcha_response_field]', dialog), 'keydown', Recaptcha.listener
$.append d.body, dialog