diff --git a/4chan_x.user.js b/4chan_x.user.js index fc17a2628..7ba6d0511 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1738,7 +1738,7 @@ $.on(link.firstChild, 'click', function() { QR.open(); if (!g.REPLY) { - QR.threadSelector.value = 'new'; + QR.threadSelector.value = g.BOARD === 'f' ? '9999' : 'new'; } return $('textarea', QR.el).focus(); }); @@ -2418,7 +2418,7 @@ id = thread.id.slice(1); threads += ""; } - QR.threadSelector = $.el('select', { + QR.threadSelector = g.BOARD === 'f' ? $('select[name=filetag]').cloneNode(true) : $.el('select', { innerHTML: threads, title: 'Create a new thread / Reply to a thread' }); @@ -2472,7 +2472,7 @@ })); }, 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) { e.preventDefault(); } @@ -2483,17 +2483,23 @@ } QR.abort(); reply = QR.replies[0]; - threadID = g.THREAD_ID || QR.threadSelector.value; + if (g.BOARD === 'f' && !g.REPLY) { + filetag = QR.threadSelector.value; + threadID = 'new'; + } else { + threadID = g.THREAD_ID || QR.threadSelector.value; + } if (threadID === 'new') { + threadID = null; if (((_ref = g.BOARD) === 'vg' || _ref === 'q') && !reply.sub) { err = 'New threads require a subject.'; } else if (!(reply.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) { err = 'No file selected.'; + } else if (g.BOARD === 'f' && filetag === '9999') { + err = 'Invalid tag specified.'; } - } else { - if (!(reply.com || reply.file)) { - err = 'No file selected.'; - } + } else if (!(reply.com || reply.file)) { + err = 'No file selected.'; } if (QR.captchaIsEnabled && !err) { captchas = $.get('captchas', []); @@ -2544,6 +2550,7 @@ sub: reply.sub, com: reply.com, upfile: reply.file, + filetag: filetag, spoiler: reply.spoiler, textonly: textOnly, mode: 'regist', diff --git a/changelog b/changelog index 68c432a54..3ccfff60b 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- noface + Added tags support on /f/. 2.36.1 - noface diff --git a/script.coffee b/script.coffee index 8c7c4a5a9..6fc861a8f 100644 --- a/script.coffee +++ b/script.coffee @@ -1342,7 +1342,12 @@ QR = link = $.el 'h1', innerHTML: "#{if g.REPLY then 'Reply to Thread' else 'Start a Thread'}" $.on link.firstChild, 'click', -> QR.open() - QR.threadSelector.value = 'new' unless g.REPLY + unless g.REPLY + QR.threadSelector.value = + if g.BOARD is 'f' + '9999' + else + 'new' $('textarea', QR.el).focus() $.before $.id('postForm'), link @@ -1885,9 +1890,13 @@ QR = for thread in $$ '.thread' id = thread.id[1..] threads += "" - QR.threadSelector = $.el 'select' - innerHTML: threads - title: 'Create a new thread / Reply to a thread' + QR.threadSelector = + if g.BOARD is 'f' + $('select[name=filetag]').cloneNode true + else + $.el 'select' + innerHTML: threads + title: 'Create a new thread / Reply to a thread' $.prepend $('.move > span', QR.el), QR.threadSelector $.on QR.threadSelector, 'mousedown', (e) -> e.stopPropagation() $.on $('#autohide', QR.el), 'change', QR.toggleHide @@ -1933,16 +1942,22 @@ QR = QR.abort() reply = QR.replies[0] - threadID = g.THREAD_ID or QR.threadSelector.value + if g.BOARD is 'f' and not g.REPLY + filetag = QR.threadSelector.value + threadID = 'new' + else + threadID = g.THREAD_ID or QR.threadSelector.value # prevent errors if threadID is 'new' + threadID = null if g.BOARD in ['vg', 'q'] and !reply.sub err = 'New threads require a subject.' else unless reply.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm' - err = 'No file selected.' - else - unless reply.com or reply.file + err = 'No file selected.' + else if g.BOARD is 'f' and filetag is '9999' + err = 'Invalid tag specified.' + else unless reply.com or reply.file err = 'No file selected.' if QR.captchaIsEnabled and !err @@ -1994,6 +2009,7 @@ QR = sub: reply.sub com: reply.com upfile: reply.file + filetag: filetag spoiler: reply.spoiler textonly: textOnly mode: 'regist'