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); ta.setSelectionRange(i, i);
return ta.focus(); return ta.focus();
}, },
close: function() {
$.rm(QR.el);
return QR.el = null;
},
dialog: function(text) { dialog: function(text) {
var l, ta; var el, l, ta;
if (text == null) { if (text == null) {
text = ''; text = '';
} }
QR.el = ui.dialog('qr', { QR.el = el = ui.dialog('qr', {
top: '0', top: '0',
left: '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> "); }, " <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($('.close', el), 'click', QR.close);
$.bind($('#recaptcha_response_field', QR.el), 'keydown', QR.keydown); $.bind($('form', el), 'submit', QR.submit);
$.append(d.body, QR.el); $.bind($('#recaptcha_response_field', el), 'keydown', QR.keydown);
ta = $('textarea', QR.el); $.append(d.body, el);
ta = $('textarea', el);
l = text.length; l = text.length;
ta.setSelectionRange(l, l); ta.setSelectionRange(l, l);
return ta.focus(); return ta.focus();
@ -1354,8 +1359,7 @@
if (data) { if (data) {
return $.extend($('a.error', QR.el), JSON.parse(data)); return $.extend($('a.error', QR.el), JSON.parse(data));
} else { } else {
$.rm(QR.el); return QR.close();
return QR.el = null;
} }
} }
}; };

View File

@ -994,8 +994,11 @@ QR =
i = ss + text.length i = ss + text.length
ta.setSelectionRange i, i ta.setSelectionRange i, i
ta.focus() ta.focus()
close: ->
$.rm QR.el
QR.el = null
dialog: (text='') -> 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> <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> <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> <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> </form>
<a class=error></a> <a class=error></a>
" "
$.bind $('form', QR.el), 'submit', QR.submit $.bind $('.close', el), 'click', QR.close
$.bind $('#recaptcha_response_field', QR.el), 'keydown', QR.keydown $.bind $('form', el), 'submit', QR.submit
$.append d.body, QR.el $.bind $('#recaptcha_response_field', el), 'keydown', QR.keydown
ta = $ 'textarea', QR.el $.append d.body, el
ta = $ 'textarea', el
l = text.length l = text.length
ta.setSelectionRange l, l ta.setSelectionRange l, l
ta.focus() ta.focus()
@ -1065,8 +1069,7 @@ QR =
if data if data
$.extend $('a.error', QR.el), JSON.parse data $.extend $('a.error', QR.el), JSON.parse data
else else
$.rm QR.el QR.close()
QR.el = null
qr = qr =
# TODO # TODO