index reply

This commit is contained in:
James Campos 2011-09-03 14:07:38 -07:00
parent 98a1f8a6f4
commit 83a15f88ef
2 changed files with 10 additions and 9 deletions

View File

@ -1359,7 +1359,7 @@
}
}
},
dialog: function(text) {
dialog: function(text, tid) {
var c, l, m, qr, ta;
if (text == null) {
text = '';
@ -1367,7 +1367,7 @@
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>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>" + QR.spoiler + "</div> <div><input placeholder=Subject name=sub><button>Submit</button><label>auto<input id=auto type=checkbox></label></div> <div><textarea placeholder=Comment name=com></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 accept=" + QR.accept + "></div> </form> <div id=files></div> <div><input placeholder=Password name=pwd type=password><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>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>" + QR.spoiler + "</div> <div><input placeholder=Subject name=sub><button>Submit</button><label>auto<input id=auto type=checkbox></label></div> <div><textarea placeholder=Comment name=com></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 accept=" + QR.accept + "></div> </form> <div id=files></div> <div><input placeholder=Password name=pwd type=password><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]) : '';
@ -1395,8 +1395,9 @@
return QR.submit();
},
quote: function(e) {
var i, id, qr, s, sel, ss, ta, text, v, _ref;
var i, id, qr, s, sel, ss, ta, text, tid, v, _ref;
e.preventDefault();
tid = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', this).id;
id = this.textContent;
text = ">>" + id + "\n";
sel = getSelection();
@ -1407,7 +1408,7 @@
}
qr = QR.qr;
if (!qr) {
QR.dialog(text);
QR.dialog(text, tid);
return;
}
$('#autohide', qr).checked = false;

View File

@ -961,9 +961,8 @@ cooldown =
qr.autoPost()
QR =
#TODO create new thread
#FIXME DRY
#index reply
#create new thread
#sys normal post form fallback
init: ->
g.callbacks.push (root) ->
@ -1057,12 +1056,12 @@ QR =
textContent: 'Submit'
disabled: false
QR.submit() if $('#auto', QR.qr).checked
dialog: (text='') ->
dialog: (text='', tid) ->
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>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=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>
@ -1100,6 +1099,7 @@ QR =
QR.submit() #derpy, but prevents calling QR.hasContent twice
quote: (e) ->
e.preventDefault()
tid = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', @).id
id = @textContent
text = ">>#{id}\n"
sel = getSelection()
@ -1108,7 +1108,7 @@ QR =
text += ">#{s}\n"
{qr} = QR
if not qr
QR.dialog text
QR.dialog text, tid
return
$('#autohide', qr).checked = false
ta = $ 'textarea', qr