add file inputs

This commit is contained in:
James Campos 2011-07-31 21:04:21 -07:00
parent 671021a8b2
commit 2f3263ddac
2 changed files with 17 additions and 3 deletions

View File

@ -1348,6 +1348,12 @@
$('input[name=email]', qr.el).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
return $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
},
add: function() {
var file, files;
file = this.parentNode.nextElementSibling.cloneNode(true);
files = $('#files', qr.el);
return $.append(files, file);
},
dialog: function(link) {
var THREAD_ID, challenge, html, spoiler, submitDisabled, submitValue;
submitValue = $('#com_submit').value;
@ -1355,7 +1361,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></div> <div><input type=file name=upfile><a>+1</a></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> <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=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> <div id=files></div> </form> <a id=error class=error></a> ";
qr.el = ui.dialog('qr', {
top: '0px',
left: '0px'
@ -1368,6 +1374,7 @@
$.bind($('#autohide', qr.el), 'click', qr.cb.autohide);
$.bind($('a[name=close]', qr.el), 'click', qr.close);
$.bind($('form', qr.el), 'submit', qr.submit);
$.bind($('a[name=add]', qr.el), 'click', qr.add);
$.bind($('img', qr.el), 'click', Recaptcha.reload);
$.bind($('input[name=recaptcha_response_field]', qr.el), 'keydown', Recaptcha.listener);
return $.append(d.body, qr.el);

View File

@ -1058,6 +1058,11 @@ qr =
$('input[name=email]', qr.el).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
$('input[name=pwd]', qr.el).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
add: ->
file = @parentNode.nextElementSibling.cloneNode true
files = $ '#files', qr.el
$.append files, file
dialog: (link) ->
submitValue = $('#com_submit').value
submitDisabled = if $('#com_submit').disabled then 'disabled' else ''
@ -1079,9 +1084,10 @@ 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></div>
<div><input type=file name=upfile><a>+1</a></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>
<div id=files></div>
</form>
<a id=error class=error></a>
"
@ -1094,6 +1100,7 @@ qr =
$.bind $('#autohide', qr.el), 'click', qr.cb.autohide
$.bind $('a[name=close]', qr.el), 'click', qr.close
$.bind $('form', qr.el), 'submit', qr.submit
$.bind $('a[name=add]', qr.el), 'click', qr.add
$.bind $('img', qr.el), 'click', Recaptcha.reload
$.bind $('input[name=recaptcha_response_field]', qr.el), 'keydown', Recaptcha.listener