fix to work on thread pages

Just realized that you couldn’t hide posts on a thread page.
This commit is contained in:
wholelotofhs 2015-01-22 17:55:28 -05:00
parent d49118aae0
commit 53897c29ba

View File

@ -13,7 +13,7 @@
*/ */
$(document).ready(function(){ $(document).ready(function(){
if (active_page != "index" && active_page != "ukko") if (active_page != "index" && active_page != "ukko" && active_page != "thread")
return; // not index return; // not index
if (!localStorage.hiddenthreads) if (!localStorage.hiddenthreads)
@ -83,6 +83,10 @@ $(document).ready(function(){
var id = post.children('p.intro').children('a.post_no:eq(1)').text(); var id = post.children('p.intro').children('a.post_no:eq(1)').text();
var board = post.parent().data('board'); var board = post.parent().data('board');
if (!hidden_data[board]) {
hidden_data[board] = {}; // id : timestamp
}
$('<a class="post-hide-link" href="javascript:void(0)" title="Hide Post" style="float: right">[]</a>') $('<a class="post-hide-link" href="javascript:void(0)" title="Hide Post" style="float: right">[]</a>')
.insertAfter(post.children('p.intro').children('a.post_no:last')) .insertAfter(post.children('p.intro').children('a.post_no:last'))
.click(function() { .click(function() {
@ -105,7 +109,7 @@ $(document).ready(function(){
if (hidden_data[board][id]) if (hidden_data[board][id])
post.find('.post-hide-link').click(); post.find('.post-hide-link').click();
} }
if (active_page != "thread")
$('div.post.op').each(do_hide_threads); $('div.post.op').each(do_hide_threads);
$('div.post.reply').each(do_hide_posts); $('div.post.reply').each(do_hide_posts);