dom textarea, blank iframe on receipt, comments

This commit is contained in:
James Campos 2011-09-03 13:50:29 -07:00
parent bc62b6524c
commit 98a1f8a6f4
2 changed files with 10 additions and 5 deletions

View File

@ -1367,11 +1367,12 @@
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>" + 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 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=" + 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> ");
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]) : '';
$('[name=pwd]', qr).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
$('textarea', qr).value = text;
if (conf['Cooldown']) {
QR.cooldown;
}
@ -1420,6 +1421,7 @@
},
receive: function(e) {
var data, tc, _ref;
$('iframe[name=iframe]').src = 'about:blank';
data = e.data;
if (data) {
data = JSON.parse(data);
@ -1503,8 +1505,7 @@
href: href
});
}
parent.postMessage(data, '*');
return window.location = 'about:blank';
return parent.postMessage(data, '*');
});
}
};

View File

@ -962,6 +962,9 @@ cooldown =
QR =
#FIXME DRY
#index reply
#create new thread
#sys normal post form fallback
init: ->
g.callbacks.push (root) ->
quote = $ 'a.quotejs + a', root
@ -1065,7 +1068,7 @@ QR =
<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>#{text}</textarea></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>
@ -1079,6 +1082,7 @@ QR =
$('[name=name]', qr).value = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
$('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
$('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
$('textarea', qr).value = text
QR.cooldown if conf['Cooldown']
$.bind $('.close', qr), 'click', QR.close
$.bind $('form', qr), 'submit', QR.submit
@ -1115,6 +1119,7 @@ QR =
ta.setSelectionRange i, i
ta.focus()
receive: (e) ->
$('iframe[name=iframe]').src = 'about:blank'
{data} = e
if data
data = JSON.parse data
@ -1170,7 +1175,6 @@ QR =
{textContent, href} = node
data = JSON.stringify {textContent, href}
parent.postMessage data, '*'
window.location = 'about:blank'
qr =
# TODO