From e3cb427feefbbb4fd6a5e76ce77ef80a240941f1 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 00:57:12 -0400 Subject: ukko: fix javascript interoperation --- js/hide-threads.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'js/hide-threads.js') diff --git a/js/hide-threads.js b/js/hide-threads.js index abaa700f..44bd829b 100644 --- a/js/hide-threads.js +++ b/js/hide-threads.js @@ -35,7 +35,7 @@ $(document).ready(function(){ } } - $('div.post.op').each(function() { + var do_hide_threads = function() { var id = $(this).children('p.intro').children('a.post_no:eq(1)').text(); var thread_container = $(this).parent(); @@ -46,7 +46,7 @@ $(document).ready(function(){ } $('[–] ') - .insertBefore(thread_container.find(':first')) + .insertBefore(thread_container.find(':not(h2,h2 *):first')) .click(function() { hidden_data[board][id] = Math.round(Date.now() / 1000); store_data(); @@ -69,9 +69,15 @@ $(document).ready(function(){ hidden_div.remove(); }); - hidden_div.insertAfter(thread_container.find(':first')); + hidden_div.insertAfter(thread_container.find(':not(h2,h2 *):first')); }); if (hidden_data[board][id]) thread_container.find('.hide-thread-link').click(); + } + + $('div.post.op').each(do_hide_threads); + + $(document).bind('new_post', function(e, post) { + do_hide_threads.call($(post).find('div.post.op')[0]); }); }); -- cgit v1.3