QR.close, QR.el = el

This commit is contained in:
James Campos 2011-09-02 00:34:30 -07:00
parent 9ca7ef0ef0
commit b2f9243715
2 changed files with 22 additions and 15 deletions

View File

@ -1269,19 +1269,24 @@
ta.setSelectionRange(i, i);
return ta.focus();
},
close: function() {
$.rm(QR.el);
return QR.el = null;
},
dialog: function(text) {
var l, ta;
var el, l, ta;
if (text == null) {
text = '';
}
QR.el = ui.dialog('qr', {
QR.el = el = 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>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=" + g.THREAD_ID + "> <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></div> <div><input placeholder=Subject name=sub><button>Submit</button></div> <div><textarea placeholder=Comment name=com>" + text + "</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><span id=cl>" + ($.get('captchas', []).length) + " captchas</span></div> <div><input name=upfile type=file></div> <div><input placeholder=Password name=pwd type=password></div> </form> <a class=error></a> ");
$.bind($('form', QR.el), 'submit', QR.submit);
$.bind($('#recaptcha_response_field', QR.el), 'keydown', QR.keydown);
$.append(d.body, QR.el);
ta = $('textarea', QR.el);
$.bind($('.close', el), 'click', QR.close);
$.bind($('form', el), 'submit', QR.submit);
$.bind($('#recaptcha_response_field', el), 'keydown', QR.keydown);
$.append(d.body, el);
ta = $('textarea', el);
l = text.length;
ta.setSelectionRange(l, l);
return ta.focus();
@ -1354,8 +1359,7 @@
if (data) {
return $.extend($('a.error', QR.el), JSON.parse(data));
} else {
$.rm(QR.el);
return QR.el = null;
return QR.close();
}
}
};

View File

@ -994,8 +994,11 @@ QR =
i = ss + text.length
ta.setSelectionRange i, i
ta.focus()
close: ->
$.rm QR.el
QR.el = null
dialog: (text='') ->
QR.el = ui.dialog 'qr', top: '0', left: '0', "
QR.el = el = 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>Quick Reply</div>
<form enctype=multipart/form-data method=post action=http://sys.4chan.org/#{g.BOARD}/post target=iframe id=qr_form>
@ -1013,10 +1016,11 @@ QR =
</form>
<a class=error></a>
"
$.bind $('form', QR.el), 'submit', QR.submit
$.bind $('#recaptcha_response_field', QR.el), 'keydown', QR.keydown
$.append d.body, QR.el
ta = $ 'textarea', QR.el
$.bind $('.close', el), 'click', QR.close
$.bind $('form', el), 'submit', QR.submit
$.bind $('#recaptcha_response_field', el), 'keydown', QR.keydown
$.append d.body, el
ta = $ 'textarea', el
l = text.length
ta.setSelectionRange l, l
ta.focus()
@ -1065,8 +1069,7 @@ QR =
if data
$.extend $('a.error', QR.el), JSON.parse data
else
$.rm QR.el
QR.el = null
QR.close()
qr =
# TODO