diff --git a/js/favorites.js b/js/favorites.js index 39bae783..acef9c7e 100644 --- a/js/favorites.js +++ b/js/favorites.js @@ -56,7 +56,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog $(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/post-hover.js b/js/post-hover.js index eefb3875..94841cc5 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -73,6 +73,7 @@ onready(function(){ .css('font-style', 'normal') .css('z-index', '100') .css('left', '0') + .css('margin-left', '') .addClass('reply').addClass('post') .appendTo(link.closest('div.post')) diff --git a/js/treeview.js b/js/treeview.js index 78ad620b..1709debb 100644 --- a/js/treeview.js +++ b/js/treeview.js @@ -11,14 +11,28 @@ * */ +if (active_page == 'thread' || active_page == 'ukko' || active_page == 'index') +$(function() { + if (window.Options && Options.get_tab('general')) { + var selector = '#treeview-global>input'; + Options.extend_tab("general", ""); + $(selector).on('change', function() { + if (localStorage.treeview === 'true') { + localStorage.treeview = 'false'; + } else { + localStorage.treeview = 'true'; + } + }); + if (localStorage.treeview === 'true') { + $(selector).attr('checked', 'checked'); + } + } +}); + if (active_page == 'thread') $(function() { - $('hr:first').before('
'); - $('div#treeview a') - .text(_('Tree view')) - .click(function(e) { - e.preventDefault(); - + var treeview = function(enable) { + if (enable === true) { $('.post.reply').each(function(){ var references = []; $(this).find('.body a').each(function(){ @@ -26,7 +40,6 @@ $(function() { references.push(parseInt($(this).html().replace('>>', ''))); } }); - var maxref = references.reduce(function(a,b) { return a > b ? a : b; }, 0); var parent_post = $("#reply_"+maxref); @@ -39,7 +52,24 @@ $(function() { post.detach().css("margin-left", margin).insertAfter(parent_post.next()); br.detach().insertAfter(post); - }); - }); + } else { + $('.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', '').appendTo('.thread'); + br.detach().insertAfter(post); + }); + } + } + + $('hr:first').before('
'); + $('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); }); + + if (localStorage.treeview === 'true') { + treeview(true); + $('input#treeview').attr('checked', true); + } }); diff --git a/stylesheets/style.css b/stylesheets/style.css index 4b94d58a..19a5a180 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -925,6 +925,7 @@ pre { right: 0px; text-align: left; font-size: 12px; + overflow-y: auto; } .options_tab h2 {