summaryrefslogtreecommitdiff
path: root/js/post-filter.js
diff options
context:
space:
mode:
author8chan <admin@8chan.co>2015-02-20 17:16:29 -0800
committerczaks <marcin@6irc.net>2016-05-05 12:28:52 +0200
commite3dbca561601e39ca9235575ae55f5f7075d3fd9 (patch)
tree3e4fecf0584e9669b5fe5d71ec682286353d7757 /js/post-filter.js
parent84bc3b0f7b7b60ee905167ee6390d4f7d241ca8e (diff)
Add one click [-]/[+] to post-filter.js
Diffstat (limited to 'js/post-filter.js')
-rw-r--r--js/post-filter.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/js/post-filter.js b/js/post-filter.js
index b3f633f7..c2c5a764 100644
--- a/js/post-filter.js
+++ b/js/post-filter.js
@@ -365,6 +365,8 @@ if (active_page === 'thread' || active_page === 'index') {
function addMenuButton(ele, threadId, pageData) {
if ($(ele).find('.filter-btn').length)
$('.filter-btn').remove();
+ /*if ($(ele).find('.hide-thread-link').length)
+ $('.hide-thread-link').remove();*/
$(ele).find('.intro')
.append(
@@ -387,6 +389,23 @@ if (active_page === 'thread' || active_page === 'index') {
}
})
);
+
+ if ($(ele).hasClass('op') && !$(ele).find('.hide-thread-link').length) {
+ $('<a class="hide-thread-link" style="float:left;margin-right:5px" href="javascript:void(0)">[' + ($(ele).data('hidden') == '1' ? '+' : '&ndash;') + ']</a>')
+ .insertBefore($(ele).find(':not(h2,h2 *):first'))
+ .click(function() {
+ var postId = $(ele).find('.post_no').not('[id]').text();
+ var hidden = ($(ele).data('hidden') == '1');
+
+ if (hidden) {
+ blacklist.remove.post(pageData.boardId, threadId, postId, false);
+ $(this).html('[&ndash;]');
+ } else {
+ blacklist.add.post(pageData.boardId, threadId, postId, false);
+ $(this).text('[+]');
+ }
+ });
+ }
}
/*
@@ -758,7 +777,11 @@ if (active_page === 'thread' || active_page === 'index') {
// on new posts
$(document).on('new_post', function (e, post) {
- var threadId = $(post).parent().attr('id').replace('thread_', '');
+ if ($(post).hasClass('reply')) {
+ var threadId = $(post).parent().attr('id').replace('thread_', '');
+ } else {
+ var threadId = $(post).attr('id').replace('thread_', '');
+ }
filter(post, threadId, pageData);
addMenuButton(post, threadId, pageData);