Fix Reply Hiding.
This commit is contained in:
parent
a3c00a5792
commit
b72083552c
@ -923,69 +923,61 @@
|
|||||||
|
|
||||||
ReplyHiding = {
|
ReplyHiding = {
|
||||||
init: function() {
|
init: function() {
|
||||||
this.td = $.el('td', {
|
|
||||||
noWrap: true,
|
|
||||||
className: 'replyhider',
|
|
||||||
innerHTML: '<a href="javascript:;">[ - ]</a>'
|
|
||||||
});
|
|
||||||
return Main.callbacks.push(this.node);
|
return Main.callbacks.push(this.node);
|
||||||
},
|
},
|
||||||
node: function(post) {
|
node: function(post) {
|
||||||
var td;
|
var button;
|
||||||
if (post["class"]) {
|
if (post.isInlined || /\bop\b/.test(post["class"])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
td = ReplyHiding.td.cloneNode(true);
|
button = post.el.previousElementSibling;
|
||||||
$.on(td.firstChild, 'click', ReplyHiding.toggle);
|
button.innerHTML = '<a href="javascript:;">[ - ]</a>';
|
||||||
$.replace(post.el.previousSibling, td);
|
$.addClass(button, 'hide_reply_button');
|
||||||
|
$.on(button.firstChild, 'click', ReplyHiding.toggle);
|
||||||
if (post.id in g.hiddenReplies) {
|
if (post.id in g.hiddenReplies) {
|
||||||
return ReplyHiding.hide(post.root);
|
return ReplyHiding.hide(post.root.firstElementChild);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var id, parent, quote, table, _i, _j, _len, _len1, _ref, _ref1;
|
var button, id, quote, quotes, _i, _j, _len, _len1;
|
||||||
parent = this.parentNode;
|
button = this.parentNode;
|
||||||
if (parent.className === 'replyhider') {
|
id = button.id.slice(2);
|
||||||
ReplyHiding.hide(parent.parentNode.parentNode.parentNode);
|
quotes = $$(".quotelink[href$='#p" + id + "'], .backlink[href='#p" + id + "']");
|
||||||
id = parent.nextSibling.id;
|
if (/\bhidden_reply\b/.test(button.className)) {
|
||||||
_ref = $$(".quotelink[href='#" + id + "'], .backlink[href='#" + id + "']");
|
ReplyHiding.show(button);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = quotes.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = quotes[_i];
|
||||||
$.addClass(quote, 'filtered');
|
|
||||||
}
|
|
||||||
g.hiddenReplies[id] = Date.now();
|
|
||||||
} else {
|
|
||||||
table = parent.nextSibling;
|
|
||||||
table.hidden = false;
|
|
||||||
$.rm(parent);
|
|
||||||
id = table.firstChild.firstChild.lastChild.id;
|
|
||||||
_ref1 = $$(".quotelink[href$='#" + id + "'], .backlink[href='#" + id + "']");
|
|
||||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
|
||||||
quote = _ref1[_j];
|
|
||||||
$.removeClass(quote, 'filtered');
|
$.removeClass(quote, 'filtered');
|
||||||
}
|
}
|
||||||
delete g.hiddenReplies[id];
|
delete g.hiddenReplies[id];
|
||||||
|
} else {
|
||||||
|
ReplyHiding.hide(button);
|
||||||
|
for (_j = 0, _len1 = quotes.length; _j < _len1; _j++) {
|
||||||
|
quote = quotes[_j];
|
||||||
|
$.addClass(quote, 'filtered');
|
||||||
|
}
|
||||||
|
g.hiddenReplies[id] = Date.now();
|
||||||
}
|
}
|
||||||
return $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
|
return $.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
|
||||||
},
|
},
|
||||||
hide: function(table) {
|
hide: function(button) {
|
||||||
var div, name, trip, uid, _ref, _ref1;
|
if (/\bhidden_reply\b/.test(button.className)) {
|
||||||
if (table.hidden) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
table.hidden = true;
|
$.addClass(button, 'hidden_reply');
|
||||||
if (!Conf['Show Stubs']) {
|
if (!Conf['Show Stubs']) {
|
||||||
|
button.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name = $('.commentpostername', table).textContent;
|
return button.firstChild.textContent = "[ + ] " + ($('.nameBlock', button.nextElementSibling).textContent);
|
||||||
uid = ((_ref = $('.posteruid', table)) != null ? _ref.textContent : void 0) || '';
|
},
|
||||||
trip = ((_ref1 = $('.postertrip', table)) != null ? _ref1.textContent : void 0) || '';
|
show: function(button) {
|
||||||
div = $.el('div', {
|
$.removeClass(button, 'hidden_reply');
|
||||||
className: 'stub',
|
if (!Conf['Show Stubs']) {
|
||||||
innerHTML: "<a href=javascript:;><span>[ + ]</span> " + name + " " + uid + " " + trip + "</a>"
|
button.hidden = false;
|
||||||
});
|
return;
|
||||||
$.on(div.firstChild, 'click', ReplyHiding.toggle);
|
}
|
||||||
return $.before(table, div);
|
return button.firstChild.textContent = '[ - ]';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4210,8 +4202,12 @@ a[href="javascript:;"] {\
|
|||||||
.hide_thread_button {\
|
.hide_thread_button {\
|
||||||
float: left;\
|
float: left;\
|
||||||
}\
|
}\
|
||||||
|
.hide_reply_button.hidden_reply {\
|
||||||
|
float: none;\
|
||||||
|
}\
|
||||||
\
|
\
|
||||||
.hidden_thread ~ *,\
|
.hidden_thread ~ *,\
|
||||||
|
.hidden_reply + .reply,\
|
||||||
#content > [name=tab]:not(:checked) + div,\
|
#content > [name=tab]:not(:checked) + div,\
|
||||||
#updater:not(:hover) > :not(.move),\
|
#updater:not(:hover) > :not(.move),\
|
||||||
#qp > input, #qp .inline, .forwarded {\
|
#qp > input, #qp .inline, .forwarded {\
|
||||||
|
|||||||
@ -730,55 +730,52 @@ ExpandThread =
|
|||||||
|
|
||||||
ReplyHiding =
|
ReplyHiding =
|
||||||
init: ->
|
init: ->
|
||||||
@td = $.el 'td',
|
|
||||||
noWrap: true
|
|
||||||
className: 'replyhider'
|
|
||||||
innerHTML: '<a href="javascript:;">[ - ]</a>'
|
|
||||||
Main.callbacks.push @node
|
Main.callbacks.push @node
|
||||||
|
|
||||||
node: (post) ->
|
node: (post) ->
|
||||||
return if post.class
|
return if post.isInlined or /\bop\b/.test post.class
|
||||||
td = ReplyHiding.td.cloneNode true
|
button = post.el.previousElementSibling
|
||||||
$.on td.firstChild, 'click', ReplyHiding.toggle
|
button.innerHTML = '<a href="javascript:;">[ - ]</a>'
|
||||||
$.replace post.el.previousSibling, td
|
$.addClass button, 'hide_reply_button'
|
||||||
|
$.on button.firstChild, 'click', ReplyHiding.toggle
|
||||||
|
|
||||||
if post.id of g.hiddenReplies
|
if post.id of g.hiddenReplies
|
||||||
ReplyHiding.hide post.root
|
ReplyHiding.hide post.root.firstElementChild
|
||||||
|
|
||||||
toggle: ->
|
toggle: ->
|
||||||
parent = @parentNode
|
button = @parentNode
|
||||||
if parent.className is 'replyhider'
|
id = button.id[2..]
|
||||||
ReplyHiding.hide parent.parentNode.parentNode.parentNode
|
quotes = $$ ".quotelink[href$='#p#{id}'], .backlink[href='#p#{id}']"
|
||||||
id = parent.nextSibling.id
|
if /\bhidden_reply\b/.test button.className
|
||||||
for quote in $$ ".quotelink[href='##{id}'], .backlink[href='##{id}']"
|
ReplyHiding.show button
|
||||||
$.addClass quote, 'filtered'
|
for quote in quotes
|
||||||
g.hiddenReplies[id] = Date.now()
|
|
||||||
else
|
|
||||||
table = parent.nextSibling
|
|
||||||
table.hidden = false
|
|
||||||
$.rm parent
|
|
||||||
id = table.firstChild.firstChild.lastChild.id
|
|
||||||
for quote in $$ ".quotelink[href$='##{id}'], .backlink[href='##{id}']"
|
|
||||||
$.removeClass quote, 'filtered'
|
$.removeClass quote, 'filtered'
|
||||||
delete g.hiddenReplies[id]
|
delete g.hiddenReplies[id]
|
||||||
|
else
|
||||||
|
ReplyHiding.hide button
|
||||||
|
for quote in quotes
|
||||||
|
$.addClass quote, 'filtered'
|
||||||
|
g.hiddenReplies[id] = Date.now()
|
||||||
$.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies
|
$.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies
|
||||||
|
|
||||||
hide: (table) ->
|
hide: (button) ->
|
||||||
return if table.hidden # already hidden by filter
|
return if /\bhidden_reply\b/.test button.className # already hidden once by filter
|
||||||
|
$.addClass button, 'hidden_reply'
|
||||||
|
|
||||||
table.hidden = true
|
unless Conf['Show Stubs']
|
||||||
|
button.hidden = true
|
||||||
|
return
|
||||||
|
|
||||||
return unless Conf['Show Stubs']
|
button.firstChild.textContent = "[ + ] #{$('.nameBlock', button.nextElementSibling).textContent}"
|
||||||
|
|
||||||
name = $('.commentpostername', table).textContent
|
show: (button) ->
|
||||||
uid = $('.posteruid', table)?.textContent or ''
|
$.removeClass button, 'hidden_reply'
|
||||||
trip = $('.postertrip', table)?.textContent or ''
|
|
||||||
|
|
||||||
div = $.el 'div',
|
unless Conf['Show Stubs']
|
||||||
className: 'stub'
|
button.hidden = false
|
||||||
innerHTML: "<a href=javascript:;><span>[ + ]</span> #{name} #{uid} #{trip}</a>"
|
return
|
||||||
$.on div.firstChild, 'click', ReplyHiding.toggle
|
|
||||||
$.before table, div
|
button.firstChild.textContent = '[ - ]'
|
||||||
|
|
||||||
Keybinds =
|
Keybinds =
|
||||||
init: ->
|
init: ->
|
||||||
@ -3233,8 +3230,12 @@ a[href="javascript:;"] {
|
|||||||
.hide_thread_button {
|
.hide_thread_button {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
.hide_reply_button.hidden_reply {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
.hidden_thread ~ *,
|
.hidden_thread ~ *,
|
||||||
|
.hidden_reply + .reply,
|
||||||
#content > [name=tab]:not(:checked) + div,
|
#content > [name=tab]:not(:checked) + div,
|
||||||
#updater:not(:hover) > :not(.move),
|
#updater:not(:hover) > :not(.move),
|
||||||
#qp > input, #qp .inline, .forwarded {
|
#qp > input, #qp .inline, .forwarded {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user