diff --git a/js/favorites.js b/js/favorites.js index e325e110..daf7b732 100644 --- a/js/favorites.js +++ b/js/favorites.js @@ -54,7 +54,6 @@ if (active_page == 'thread' || active_page == 'index') { $(document).ready(function(){ var favorites = JSON.parse(localStorage.favorites); var is_board_favorite = ~$.inArray(board_name, favorites); - console.log(is_board_favorite); $('header>h1').append('\u2605'); add_favorites(); diff --git a/js/treeview.js b/js/treeview.js index 046a9796..dcd87e1e 100644 --- a/js/treeview.js +++ b/js/treeview.js @@ -31,10 +31,8 @@ $(function() { if (active_page == 'thread') $(function() { - var treeview_on = false; - var treeview = function() { - if (!treeview_on) { - treeview_on = true; + var treeview = function(enable) { + if (enable === true) { $('.post.reply').each(function(){ var references = []; $(this).find('.body a').each(function(){ @@ -56,23 +54,22 @@ $(function() { br.detach().insertAfter(post); }); } else { - treeview_on = false; $('.post.reply').sort(function(a,b) { return parseInt(a.id.replace('reply_', '')) - parseInt(b.id.replace('reply_', '')); }).each(function () { var post = $(this); var br = post.next(); - post.detach().css('margin-left', '0').appendTo('.thread'); + post.detach().css('margin-left', '').appendTo('.thread'); br.detach().insertAfter(post); }); } } + + $('hr:first').before('
'); + $('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); }); + if (localStorage.treeview === 'true') { - treeview(); + treeview(true); + $('input#treeview').attr('checked', true); } - - $('hr:first').before('
'); - $('div#treeview a') - .text(_('Tree view')) - .click(function(e) { treeview(); e.preventDefault(); }); });