Corrections.

This commit is contained in:
noface 2012-11-16 19:06:41 +01:00
parent 63ffca71d5
commit 53127cd8c6
3 changed files with 36 additions and 35 deletions

View File

@ -1738,7 +1738,7 @@
$.on(link.firstChild, 'click', function() { $.on(link.firstChild, 'click', function() {
QR.open(); QR.open();
if (!g.REPLY) { if (!g.REPLY) {
QR.threadSelector.value = g.BOARD !== 'f' ? 'new' : '9999'; QR.threadSelector.value = g.BOARD === 'f' ? '9999' : 'new';
} }
return $('textarea', QR.el).focus(); return $('textarea', QR.el).focus();
}); });
@ -2418,10 +2418,10 @@
id = thread.id.slice(1); id = thread.id.slice(1);
threads += "<option value=" + id + ">Thread " + id + "</option>"; threads += "<option value=" + id + ">Thread " + id + "</option>";
} }
QR.threadSelector = g.BOARD !== 'f' ? $.el('select', { QR.threadSelector = g.BOARD === 'f' ? $('select[name=filetag]').cloneNode(true) : $.el('select', {
innerHTML: threads, innerHTML: threads,
title: 'Create a new thread / Reply to a thread' title: 'Create a new thread / Reply to a thread'
}) : $('select[name="filetag"]'); });
$.prepend($('.move > span', QR.el), QR.threadSelector); $.prepend($('.move > span', QR.el), QR.threadSelector);
$.on(QR.threadSelector, 'mousedown', function(e) { $.on(QR.threadSelector, 'mousedown', function(e) {
return e.stopPropagation(); return e.stopPropagation();
@ -2472,7 +2472,7 @@
})); }));
}, },
submit: function(e) { submit: function(e) {
var callbacks, captcha, captchas, challenge, err, m, opts, post, reply, response, textOnly, threadID, _ref; var callbacks, captcha, captchas, challenge, err, filetag, m, opts, post, reply, response, textOnly, threadID, _ref;
if (e != null) { if (e != null) {
e.preventDefault(); e.preventDefault();
} }
@ -2483,19 +2483,23 @@
} }
QR.abort(); QR.abort();
reply = QR.replies[0]; reply = QR.replies[0];
if (!((g.BOARD === 'f') && !g.REPLY)) { if (g.BOARD === 'f' && !g.REPLY) {
filetag = QR.threadSelector.value;
threadID = 'new';
} else {
threadID = g.THREAD_ID || QR.threadSelector.value; threadID = g.THREAD_ID || QR.threadSelector.value;
} }
if (threadID === 'new') { if (threadID === 'new') {
threadID = null;
if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) {
err = 'New threads require a subject.'; err = 'New threads require a subject.';
} else if (!(reply.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) { } else if (!(reply.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) {
err = 'No file selected.'; err = 'No file selected.';
} else if (g.BOARD === 'f' && filetag === '9999') {
err = 'Invalid tag specified.';
} }
} else { } else if (!(reply.com || reply.file)) {
if (!(reply.com || reply.file)) { err = 'No file selected.';
err = 'No file selected.';
}
} }
if (QR.captchaIsEnabled && !err) { if (QR.captchaIsEnabled && !err) {
captchas = $.get('captchas', []); captchas = $.get('captchas', []);
@ -2546,7 +2550,7 @@
sub: reply.sub, sub: reply.sub,
com: reply.com, com: reply.com,
upfile: reply.file, upfile: reply.file,
filetag: !g.REPLY ? QR.threadSelector.value : void 0, filetag: filetag,
spoiler: reply.spoiler, spoiler: reply.spoiler,
textonly: textOnly, textonly: textOnly,
mode: 'regist', mode: 'regist',
@ -2594,10 +2598,7 @@
err = $.el('span', { err = $.el('span', {
innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".<br>Warning reason: " + bs[1].innerHTML : "You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason." innerHTML: /^You were issued a warning/.test($('.boxcontent', doc).textContent.trim()) ? "You were issued a warning on " + bs[0].innerHTML + " as " + bs[3].innerHTML + ".<br>Warning reason: " + bs[1].innerHTML : "You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason."
}); });
} else if (err = doc.getElementById('errmsg') || (err = $('center', doc))) { } else if (err = doc.getElementById('errmsg')) {
if ($('font', err)) {
err.textContent = err.textContent.replace(/Return$/, '');
}
if ((_ref = $('a', err)) != null) { if ((_ref = $('a', err)) != null) {
_ref.target = '_blank'; _ref.target = '_blank';
} }
@ -2605,9 +2606,6 @@
err = 'Connection error with sys.4chan.org.'; err = 'Connection error with sys.4chan.org.';
} }
if (err) { if (err) {
if (err.nodeName === 'CENTER') {
err = err.textContent;
}
if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') { if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') {
if (/mistyped/i.test(err.textContent)) { if (/mistyped/i.test(err.textContent)) {
err.textContent = 'Error: You seem to have mistyped the CAPTCHA.'; err.textContent = 'Error: You seem to have mistyped the CAPTCHA.';

View File

@ -1,4 +1,6 @@
master master
- noface
Added tags support on /f/.
2.36.1 2.36.1
- noface - noface

View File

@ -1343,11 +1343,11 @@ QR =
$.on link.firstChild, 'click', -> $.on link.firstChild, 'click', ->
QR.open() QR.open()
unless g.REPLY unless g.REPLY
QR.threadSelector.value = QR.threadSelector.value =
unless g.BOARD is 'f' if g.BOARD is 'f'
'new' '9999'
else else
'9999' 'new'
$('textarea', QR.el).focus() $('textarea', QR.el).focus()
$.before $.id('postForm'), link $.before $.id('postForm'), link
@ -1891,12 +1891,12 @@ QR =
id = thread.id[1..] id = thread.id[1..]
threads += "<option value=#{id}>Thread #{id}</option>" threads += "<option value=#{id}>Thread #{id}</option>"
QR.threadSelector = QR.threadSelector =
unless g.BOARD is 'f' if g.BOARD is 'f'
$('select[name=filetag]').cloneNode true
else
$.el 'select' $.el 'select'
innerHTML: threads innerHTML: threads
title: 'Create a new thread / Reply to a thread' title: 'Create a new thread / Reply to a thread'
else
$ 'select[name="filetag"]'
$.prepend $('.move > span', QR.el), QR.threadSelector $.prepend $('.move > span', QR.el), QR.threadSelector
$.on QR.threadSelector, 'mousedown', (e) -> e.stopPropagation() $.on QR.threadSelector, 'mousedown', (e) -> e.stopPropagation()
$.on $('#autohide', QR.el), 'change', QR.toggleHide $.on $('#autohide', QR.el), 'change', QR.toggleHide
@ -1942,17 +1942,22 @@ QR =
QR.abort() QR.abort()
reply = QR.replies[0] reply = QR.replies[0]
unless (g.BOARD is 'f') and not g.REPLY if g.BOARD is 'f' and not g.REPLY
filetag = QR.threadSelector.value
threadID = 'new'
else
threadID = g.THREAD_ID or QR.threadSelector.value threadID = g.THREAD_ID or QR.threadSelector.value
# prevent errors # prevent errors
if threadID is 'new' if threadID is 'new'
threadID = null
if g.BOARD in ['vg', 'q'] and !reply.sub if g.BOARD in ['vg', 'q'] and !reply.sub
err = 'New threads require a subject.' err = 'New threads require a subject.'
else unless reply.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm' else unless reply.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
err = 'No file selected.' err = 'No file selected.'
else else if g.BOARD is 'f' and filetag is '9999'
unless reply.com or reply.file err = 'Invalid tag specified.'
else unless reply.com or reply.file
err = 'No file selected.' err = 'No file selected.'
if QR.captchaIsEnabled and !err if QR.captchaIsEnabled and !err
@ -2004,7 +2009,7 @@ QR =
sub: reply.sub sub: reply.sub
com: reply.com com: reply.com
upfile: reply.file upfile: reply.file
filetag: QR.threadSelector.value unless g.REPLY filetag: filetag
spoiler: reply.spoiler spoiler: reply.spoiler
textonly: textOnly textonly: textOnly
mode: 'regist' mode: 'regist'
@ -2047,16 +2052,12 @@ QR =
"You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.<br>Warning reason: #{bs[1].innerHTML}" "You were issued a warning on #{bs[0].innerHTML} as #{bs[3].innerHTML}.<br>Warning reason: #{bs[1].innerHTML}"
else else
"You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason." "You are banned! ;_;<br>Please click <a href=//www.4chan.org/banned target=_blank>HERE</a> to see the reason."
else if err = doc.getElementById('errmsg') or err = $('center', doc) # error! else if err = doc.getElementById 'errmsg' # error!
if $ 'font', err
err.textContent = err.textContent.replace /Return$/, ''
$('a', err)?.target = '_blank' # duplicate image link $('a', err)?.target = '_blank' # duplicate image link
else unless msg = $ 'b', doc else unless msg = $ 'b', doc
err = 'Connection error with sys.4chan.org.' err = 'Connection error with sys.4chan.org.'
if err if err
if err.nodeName is 'CENTER'
err = err.textContent
if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.' if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.'
# Remove the obnoxious 4chan Pass ad. # Remove the obnoxious 4chan Pass ad.
if /mistyped/i.test err.textContent if /mistyped/i.test err.textContent