Separate the whole thread selector/flash tag deal.
This commit is contained in:
parent
40bd083357
commit
bda10a5a0d
@ -5882,7 +5882,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(QR.cooldown.count, 1000);
|
setTimeout(QR.cooldown.count, 1000);
|
||||||
isReply = g.BOARD.ID === 'f' ? g.VIEW === 'thread' : QR.nodes.thread.value !== 'new';
|
isReply = QR.nodes.thread.value !== 'new';
|
||||||
if (isReply) {
|
if (isReply) {
|
||||||
post = QR.posts[0];
|
post = QR.posts[0];
|
||||||
isSage = /sage/i.test(post.email);
|
isSage = /sage/i.test(post.email);
|
||||||
@ -5943,7 +5943,7 @@
|
|||||||
text = !text && post === OP && (!QR.nodes || QR.nodes.el.hidden) ? "" : ">>" + post + "\n" + text;
|
text = !text && post === OP && (!QR.nodes || QR.nodes.el.hidden) ? "" : ">>" + post + "\n" + text;
|
||||||
QR.open();
|
QR.open();
|
||||||
ta = QR.nodes.com;
|
ta = QR.nodes.com;
|
||||||
if (QR.nodes.thread && !ta.value) {
|
if (!ta.value) {
|
||||||
QR.nodes.thread.value = OP.ID;
|
QR.nodes.thread.value = OP.ID;
|
||||||
}
|
}
|
||||||
caretPos = ta.selectionStart;
|
caretPos = ta.selectionStart;
|
||||||
@ -6018,11 +6018,7 @@
|
|||||||
return $.addClass(QR.nodes.el, 'dump');
|
return $.addClass(QR.nodes.el, 'dump');
|
||||||
},
|
},
|
||||||
resetThreadSelector: function() {
|
resetThreadSelector: function() {
|
||||||
if (g.BOARD.ID === 'f') {
|
if (g.VIEW === 'thread') {
|
||||||
if (g.VIEW === 'index') {
|
|
||||||
return QR.nodes.flashTag.value = '9999';
|
|
||||||
}
|
|
||||||
} else if (g.VIEW === 'thread') {
|
|
||||||
return QR.nodes.thread.value = g.THREAD;
|
return QR.nodes.thread.value = g.THREAD;
|
||||||
} else {
|
} else {
|
||||||
return QR.nodes.thread.value = 'new';
|
return QR.nodes.thread.value = 'new';
|
||||||
@ -6450,12 +6446,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var dialog, key, mimeTypes, name, nodes, thread, threads, _i, _len, _ref, _ref1;
|
var dialog, mimeTypes, name, nodes, thread, _i, _len, _ref;
|
||||||
dialog = UI.dialog('qr', 'top:0;right:0;', "<div>\n <input type=checkbox id=autohide title=Auto-hide>\n <span class=move></span>\n <a href=javascript:; class=close title=Close>×</a>\n</div>\n<form>\n <div class=persona>\n <input id=dump-button type=button title='Dump list' value=+>\n <input data-name=name title=Name placeholder=Name class=field size=1>\n <input data-name=email title=E-mail placeholder=E-mail class=field size=1>\n <input data-name=sub title=Subject placeholder=Subject class=field size=1>\n </div>\n <div id=dump-list-container>\n <div id=dump-list></div>\n <a id=add-post href=javascript:; title=\"Add a post\">+</a>\n </div>\n <div class=textarea>\n <textarea data-name=com title=Comment placeholder=Comment class=field></textarea>\n <span id=char-count></span>\n </div>\n <div id=file-n-submit>\n <input id=qr-file-button type=button value='Choose files'>\n <span id=qr-filename-container>\n <span id=qr-no-file>No selected file</span>\n <span id=qr-filename></span>\n </span>\n <a id=qr-filerm href=javascript:; title='Remove file' tabindex=-1>×</a>\n <input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=-1>\n <input type=submit>\n </div>\n <input type=file multiple>\n</form>".replace(/>\s+</g, '><'));
|
dialog = UI.dialog('qr', 'top:0;right:0;', "<div>\n <input type=checkbox id=autohide title=Auto-hide>\n <select title='Create a new thread / Reply'>\n <option value=new>New thread</option>\n </select>\n <span class=move></span>\n <a href=javascript:; class=close title=Close>×</a>\n</div>\n<form>\n <div class=persona>\n <input id=dump-button type=button title='Dump list' value=+>\n <input data-name=name title=Name placeholder=Name class=field size=1>\n <input data-name=email title=E-mail placeholder=E-mail class=field size=1>\n <input data-name=sub title=Subject placeholder=Subject class=field size=1>\n </div>\n <div id=dump-list-container>\n <div id=dump-list></div>\n <a id=add-post href=javascript:; title=\"Add a post\">+</a>\n </div>\n <div class=textarea>\n <textarea data-name=com title=Comment placeholder=Comment class=field></textarea>\n <span id=char-count></span>\n </div>\n <div id=file-n-submit>\n <input id=qr-file-button type=button value='Choose files'>\n <span id=qr-filename-container>\n <span id=qr-no-file>No selected file</span>\n <span id=qr-filename></span>\n </span>\n <a id=qr-filerm href=javascript:; title='Remove file' tabindex=-1>×</a>\n <input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=-1>\n <input type=submit>\n </div>\n <input type=file multiple>\n</form>".replace(/>\s+</g, '><'));
|
||||||
QR.nodes = nodes = {
|
QR.nodes = nodes = {
|
||||||
el: dialog,
|
el: dialog,
|
||||||
move: $('.move', dialog),
|
move: $('.move', dialog),
|
||||||
autohide: $('#autohide', dialog),
|
autohide: $('#autohide', dialog),
|
||||||
|
thread: $('select', dialog),
|
||||||
close: $('.close', dialog),
|
close: $('.close', dialog),
|
||||||
form: $('form', dialog),
|
form: $('form', dialog),
|
||||||
dumpButton: $('#dump-button', dialog),
|
dumpButton: $('#dump-button', dialog),
|
||||||
@ -6495,23 +6492,19 @@
|
|||||||
QR.spoiler = !!$('input[name=spoiler]');
|
QR.spoiler = !!$('input[name=spoiler]');
|
||||||
nodes.spoiler.hidden = !QR.spoiler;
|
nodes.spoiler.hidden = !QR.spoiler;
|
||||||
if (g.BOARD.ID === 'f') {
|
if (g.BOARD.ID === 'f') {
|
||||||
if (g.VIEW === 'index') {
|
nodes.flashTag = $.el('select', {
|
||||||
nodes.flashTag = $('select[name=filetag]').cloneNode(true);
|
name: 'filetag',
|
||||||
$.after(nodes.autohide, nodes.flashTag);
|
innerHTML: "<option value=0>Hentai</option>\n<option value=6>Porn</option>\n<option value=1>Japanese</option>\n<option value=2>Anime</option>\n<option value=3>Game</option>\n<option value=5>Loop</option>\n<option value=4 selected>Other</option>"
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nodes.thread = $.el('select', {
|
|
||||||
title: 'Create a new thread / Reply'
|
|
||||||
});
|
});
|
||||||
threads = '<option value=new>New thread</option>';
|
$.add(nodes.form, nodes.flashTag);
|
||||||
_ref = g.BOARD.threads;
|
|
||||||
for (key in _ref) {
|
|
||||||
thread = _ref[key];
|
|
||||||
threads += "<option value=" + thread.ID + ">Thread No." + thread.ID + "</option>";
|
|
||||||
}
|
|
||||||
nodes.thread.innerHTML = threads;
|
|
||||||
$.after(nodes.autohide, nodes.thread);
|
|
||||||
}
|
}
|
||||||
|
for (thread in g.BOARD.threads) {
|
||||||
|
$.add(nodes.thread, $.el('option', {
|
||||||
|
value: thread,
|
||||||
|
textContent: "Thread No." + thread
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
$.after(nodes.autohide, nodes.thread);
|
||||||
QR.resetThreadSelector();
|
QR.resetThreadSelector();
|
||||||
$.on(nodes.autohide, 'change', QR.toggleHide);
|
$.on(nodes.autohide, 'change', QR.toggleHide);
|
||||||
$.on(nodes.close, 'click', QR.close);
|
$.on(nodes.close, 'click', QR.close);
|
||||||
@ -6533,9 +6526,9 @@
|
|||||||
});
|
});
|
||||||
$.on(nodes.fileInput, 'change', QR.fileInput);
|
$.on(nodes.fileInput, 'change', QR.fileInput);
|
||||||
new QR.post().select();
|
new QR.post().select();
|
||||||
_ref1 = ['name', 'email', 'sub', 'com'];
|
_ref = ['name', 'email', 'sub', 'com'];
|
||||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
name = _ref1[_i];
|
name = _ref[_i];
|
||||||
$.on(nodes[name], 'input', function() {
|
$.on(nodes[name], 'input', function() {
|
||||||
return QR.selected.save(this);
|
return QR.selected.save(this);
|
||||||
});
|
});
|
||||||
@ -6563,23 +6556,15 @@
|
|||||||
post = QR.posts[0];
|
post = QR.posts[0];
|
||||||
post.forceSave();
|
post.forceSave();
|
||||||
if (g.BOARD.ID === 'f') {
|
if (g.BOARD.ID === 'f') {
|
||||||
if (g.VIEW === 'index') {
|
filetag = QR.nodes.flashTag.value;
|
||||||
filetag = QR.nodes.flashTag.value;
|
|
||||||
threadID = 'new';
|
|
||||||
} else {
|
|
||||||
threadID = g.THREAD;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
threadID = QR.nodes.thread.value;
|
|
||||||
}
|
}
|
||||||
|
threadID = QR.nodes.thread.value;
|
||||||
if (threadID === 'new') {
|
if (threadID === 'new') {
|
||||||
threadID = null;
|
threadID = null;
|
||||||
if (((_ref = g.BOARD.ID) === 'vg' || _ref === 'q') && !post.sub) {
|
if (((_ref = g.BOARD.ID) === 'vg' || _ref === 'q') && !post.sub) {
|
||||||
err = 'New threads require a subject.';
|
err = 'New threads require a subject.';
|
||||||
} else if (!(post.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) {
|
} else if (!(post.file || (textOnly = !!$('input[name=textonly]', $.id('postForm'))))) {
|
||||||
err = 'No file selected.';
|
err = 'No file selected.';
|
||||||
} else if (g.BOARD.ID === 'f' && filetag === '9999') {
|
|
||||||
err = 'Invalid tag specified.';
|
|
||||||
}
|
}
|
||||||
} else if (g.BOARD.threads[threadID].isSticky) {
|
} else if (g.BOARD.threads[threadID].isSticky) {
|
||||||
err = 'You can\'t reply to this thread anymore.';
|
err = 'You can\'t reply to this thread anymore.';
|
||||||
|
|||||||
@ -195,10 +195,7 @@ QR =
|
|||||||
|
|
||||||
setTimeout QR.cooldown.count, 1000
|
setTimeout QR.cooldown.count, 1000
|
||||||
|
|
||||||
isReply = if g.BOARD.ID is 'f'
|
isReply = QR.nodes.thread.value isnt 'new'
|
||||||
g.VIEW is 'thread'
|
|
||||||
else
|
|
||||||
QR.nodes.thread.value isnt 'new'
|
|
||||||
if isReply
|
if isReply
|
||||||
post = QR.posts[0]
|
post = QR.posts[0]
|
||||||
isSage = /sage/i.test post.email
|
isSage = /sage/i.test post.email
|
||||||
@ -264,8 +261,7 @@ QR =
|
|||||||
|
|
||||||
QR.open()
|
QR.open()
|
||||||
ta = QR.nodes.com
|
ta = QR.nodes.com
|
||||||
if QR.nodes.thread and !ta.value
|
QR.nodes.thread.value = OP.ID unless ta.value
|
||||||
QR.nodes.thread.value = OP.ID
|
|
||||||
|
|
||||||
caretPos = ta.selectionStart
|
caretPos = ta.selectionStart
|
||||||
# Replace selection for text.
|
# Replace selection for text.
|
||||||
@ -331,10 +327,7 @@ QR =
|
|||||||
new QR.post().setFile file
|
new QR.post().setFile file
|
||||||
$.addClass QR.nodes.el, 'dump'
|
$.addClass QR.nodes.el, 'dump'
|
||||||
resetThreadSelector: ->
|
resetThreadSelector: ->
|
||||||
if g.BOARD.ID is 'f'
|
if g.VIEW is 'thread'
|
||||||
if g.VIEW is 'index'
|
|
||||||
QR.nodes.flashTag.value = '9999'
|
|
||||||
else if g.VIEW is 'thread'
|
|
||||||
QR.nodes.thread.value = g.THREAD
|
QR.nodes.thread.value = g.THREAD
|
||||||
else
|
else
|
||||||
QR.nodes.thread.value = 'new'
|
QR.nodes.thread.value = 'new'
|
||||||
@ -639,6 +632,9 @@ QR =
|
|||||||
dialog = UI.dialog 'qr', 'top:0;right:0;', """
|
dialog = UI.dialog 'qr', 'top:0;right:0;', """
|
||||||
<div>
|
<div>
|
||||||
<input type=checkbox id=autohide title=Auto-hide>
|
<input type=checkbox id=autohide title=Auto-hide>
|
||||||
|
<select title='Create a new thread / Reply'>
|
||||||
|
<option value=new>New thread</option>
|
||||||
|
</select>
|
||||||
<span class=move></span>
|
<span class=move></span>
|
||||||
<a href=javascript:; class=close title=Close>×</a>
|
<a href=javascript:; class=close title=Close>×</a>
|
||||||
</div>
|
</div>
|
||||||
@ -675,6 +671,7 @@ QR =
|
|||||||
el: dialog
|
el: dialog
|
||||||
move: $ '.move', dialog
|
move: $ '.move', dialog
|
||||||
autohide: $ '#autohide', dialog
|
autohide: $ '#autohide', dialog
|
||||||
|
thread: $ 'select', dialog
|
||||||
close: $ '.close', dialog
|
close: $ '.close', dialog
|
||||||
form: $ 'form', dialog
|
form: $ 'form', dialog
|
||||||
dumpButton: $ '#dump-button', dialog
|
dumpButton: $ '#dump-button', dialog
|
||||||
@ -714,17 +711,25 @@ QR =
|
|||||||
nodes.spoiler.hidden = !QR.spoiler
|
nodes.spoiler.hidden = !QR.spoiler
|
||||||
|
|
||||||
if g.BOARD.ID is 'f'
|
if g.BOARD.ID is 'f'
|
||||||
if g.VIEW is 'index'
|
nodes.flashTag = $.el 'select',
|
||||||
nodes.flashTag = $('select[name=filetag]').cloneNode true
|
name: 'filetag'
|
||||||
$.after nodes.autohide, nodes.flashTag
|
innerHTML: """
|
||||||
else # Make a list of visible threads.
|
<option value=0>Hentai</option>
|
||||||
nodes.thread = $.el 'select',
|
<option value=6>Porn</option>
|
||||||
title: 'Create a new thread / Reply'
|
<option value=1>Japanese</option>
|
||||||
threads = '<option value=new>New thread</option>'
|
<option value=2>Anime</option>
|
||||||
for key, thread of g.BOARD.threads
|
<option value=3>Game</option>
|
||||||
threads += "<option value=#{thread.ID}>Thread No.#{thread.ID}</option>"
|
<option value=5>Loop</option>
|
||||||
nodes.thread.innerHTML = threads
|
<option value=4 selected>Other</option>
|
||||||
$.after nodes.autohide, nodes.thread
|
"""
|
||||||
|
$.add nodes.form, nodes.flashTag
|
||||||
|
|
||||||
|
# Make a list of threads.
|
||||||
|
for thread of g.BOARD.threads
|
||||||
|
$.add nodes.thread, $.el 'option',
|
||||||
|
value: thread
|
||||||
|
textContent: "Thread No.#{thread}"
|
||||||
|
$.after nodes.autohide, nodes.thread
|
||||||
QR.resetThreadSelector()
|
QR.resetThreadSelector()
|
||||||
|
|
||||||
$.on nodes.autohide, 'change', QR.toggleHide
|
$.on nodes.autohide, 'change', QR.toggleHide
|
||||||
@ -766,13 +771,8 @@ QR =
|
|||||||
post = QR.posts[0]
|
post = QR.posts[0]
|
||||||
post.forceSave()
|
post.forceSave()
|
||||||
if g.BOARD.ID is 'f'
|
if g.BOARD.ID is 'f'
|
||||||
if g.VIEW is 'index'
|
filetag = QR.nodes.flashTag.value
|
||||||
filetag = QR.nodes.flashTag.value
|
threadID = QR.nodes.thread.value
|
||||||
threadID = 'new'
|
|
||||||
else
|
|
||||||
threadID = g.THREAD
|
|
||||||
else
|
|
||||||
threadID = QR.nodes.thread.value
|
|
||||||
|
|
||||||
# prevent errors
|
# prevent errors
|
||||||
if threadID is 'new'
|
if threadID is 'new'
|
||||||
@ -781,8 +781,6 @@ QR =
|
|||||||
err = 'New threads require a subject.'
|
err = 'New threads require a subject.'
|
||||||
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
else unless post.file or textOnly = !!$ 'input[name=textonly]', $.id 'postForm'
|
||||||
err = 'No file selected.'
|
err = 'No file selected.'
|
||||||
else if g.BOARD.ID is 'f' and filetag is '9999'
|
|
||||||
err = 'Invalid tag specified.'
|
|
||||||
else if g.BOARD.threads[threadID].isSticky
|
else if g.BOARD.threads[threadID].isSticky
|
||||||
err = 'You can\'t reply to this thread anymore.'
|
err = 'You can\'t reply to this thread anymore.'
|
||||||
else unless post.com or post.file
|
else unless post.com or post.file
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user