Merge pull request #820 from ihavenoface/pull-request
Add support for post with QR and tags on /f/. Close #566
This commit is contained in:
commit
39f02cd3f4
@ -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 = 'new';
|
QR.threadSelector.value = g.BOARD === 'f' ? '9999' : 'new';
|
||||||
}
|
}
|
||||||
return $('textarea', QR.el).focus();
|
return $('textarea', QR.el).focus();
|
||||||
});
|
});
|
||||||
@ -2418,7 +2418,7 @@
|
|||||||
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 = $.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'
|
||||||
});
|
});
|
||||||
@ -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,17 +2483,23 @@
|
|||||||
}
|
}
|
||||||
QR.abort();
|
QR.abort();
|
||||||
reply = QR.replies[0];
|
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') {
|
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', []);
|
||||||
@ -2544,6 +2550,7 @@
|
|||||||
sub: reply.sub,
|
sub: reply.sub,
|
||||||
com: reply.com,
|
com: reply.com,
|
||||||
upfile: reply.file,
|
upfile: reply.file,
|
||||||
|
filetag: filetag,
|
||||||
spoiler: reply.spoiler,
|
spoiler: reply.spoiler,
|
||||||
textonly: textOnly,
|
textonly: textOnly,
|
||||||
mode: 'regist',
|
mode: 'regist',
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
master
|
master
|
||||||
|
- noface
|
||||||
|
Added tags support on /f/.
|
||||||
|
|
||||||
2.36.1
|
2.36.1
|
||||||
- noface
|
- noface
|
||||||
|
|||||||
@ -1342,7 +1342,12 @@ QR =
|
|||||||
link = $.el 'h1', innerHTML: "<a href=javascript:;>#{if g.REPLY then 'Reply to Thread' else 'Start a Thread'}</a>"
|
link = $.el 'h1', innerHTML: "<a href=javascript:;>#{if g.REPLY then 'Reply to Thread' else 'Start a Thread'}</a>"
|
||||||
$.on link.firstChild, 'click', ->
|
$.on link.firstChild, 'click', ->
|
||||||
QR.open()
|
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()
|
$('textarea', QR.el).focus()
|
||||||
$.before $.id('postForm'), link
|
$.before $.id('postForm'), link
|
||||||
|
|
||||||
@ -1885,9 +1890,13 @@ QR =
|
|||||||
for thread in $$ '.thread'
|
for thread in $$ '.thread'
|
||||||
id = thread.id[1..]
|
id = thread.id[1..]
|
||||||
threads += "<option value=#{id}>Thread #{id}</option>"
|
threads += "<option value=#{id}>Thread #{id}</option>"
|
||||||
QR.threadSelector = $.el 'select'
|
QR.threadSelector =
|
||||||
innerHTML: threads
|
if g.BOARD is 'f'
|
||||||
title: 'Create a new thread / Reply to a thread'
|
$('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
|
$.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
|
||||||
@ -1933,16 +1942,22 @@ QR =
|
|||||||
QR.abort()
|
QR.abort()
|
||||||
|
|
||||||
reply = QR.replies[0]
|
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
|
# 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
|
||||||
@ -1994,6 +2009,7 @@ QR =
|
|||||||
sub: reply.sub
|
sub: reply.sub
|
||||||
com: reply.com
|
com: reply.com
|
||||||
upfile: reply.file
|
upfile: reply.file
|
||||||
|
filetag: filetag
|
||||||
spoiler: reply.spoiler
|
spoiler: reply.spoiler
|
||||||
textonly: textOnly
|
textonly: textOnly
|
||||||
mode: 'regist'
|
mode: 'regist'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user