diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 0900c99cf..592bd8b3c 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -3315,7 +3315,9 @@ return; } this.isHidden = true; - this.OP.nodes.root.parentElement.hidden = true; + if (!Conf['JSON Navigation']) { + this.OP.nodes.root.parentElement.hidden = true; + } if (button = $('.hide-post-button', this.OP.nodes.root)) { return $.replace(button, PostHiding.makeButton(false)); } @@ -5663,7 +5665,7 @@ }), 3 * $.SECOND - (Date.now() - now)); }); if (typeof pageNum !== 'number') { - pageNum = null; + pageNum = ''; } onload = function(e) { return Index.load(e, pageNum); @@ -5969,7 +5971,7 @@ return Index.sortedThreads = topThreads.concat(bottomThreads); }, buildIndex: function(infinite) { - var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; + var i, max, nodes, pageNum, sortedThreads, threadsPerPage; sortedThreads = Index.sortedThreads; nodes = []; switch (Conf['Index Mode']) { @@ -5977,14 +5979,9 @@ case 'infinite': pageNum = Index.getCurrentPage(); threadsPerPage = Index.getThreadsNumPerPage(); - threads = []; i = threadsPerPage * (pageNum - 1); max = i + threadsPerPage; - while (i < max && (thread = sortedThreads[i++])) { - threads.push(thread); - nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); - Index.buildReplies(thread); - } + nodes = Index.processThreads(sortedThreads, i, max); Index.buildPagelist(); Index.setPage(pageNum); break; @@ -5992,17 +5989,22 @@ nodes = Index.buildCatalogViews(); break; default: - i = 0; - while (thread = sortedThreads[i++]) { - nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); - Index.buildReplies(thread); - } + nodes = Index.processThreads(sortedThreads, 0, sortedThreads.length); } if (!infinite) { $.rmAll(Index.root); } return $.add(Index.root, nodes); }, + processThreads: function(threads, i, max) { + var nodes, thread; + nodes = []; + while (i < max && (thread = threads[i++])) { + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); + Index.buildReplies(thread); + } + return nodes; + }, isSearching: false, clearSearch: function() { Index.searchInput.value = null; diff --git a/builds/crx/script.js b/builds/crx/script.js index 09c0de3a3..b43e1e2ab 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -3340,7 +3340,9 @@ return; } this.isHidden = true; - this.OP.nodes.root.parentElement.hidden = true; + if (!Conf['JSON Navigation']) { + this.OP.nodes.root.parentElement.hidden = true; + } if (button = $('.hide-post-button', this.OP.nodes.root)) { return $.replace(button, PostHiding.makeButton(false)); } @@ -5688,7 +5690,7 @@ }), 3 * $.SECOND - (Date.now() - now)); }); if (typeof pageNum !== 'number') { - pageNum = null; + pageNum = ''; } onload = function(e) { return Index.load(e, pageNum); @@ -5994,7 +5996,7 @@ return Index.sortedThreads = topThreads.concat(bottomThreads); }, buildIndex: function(infinite) { - var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; + var i, max, nodes, pageNum, sortedThreads, threadsPerPage; sortedThreads = Index.sortedThreads; nodes = []; switch (Conf['Index Mode']) { @@ -6002,14 +6004,9 @@ case 'infinite': pageNum = Index.getCurrentPage(); threadsPerPage = Index.getThreadsNumPerPage(); - threads = []; i = threadsPerPage * (pageNum - 1); max = i + threadsPerPage; - while (i < max && (thread = sortedThreads[i++])) { - threads.push(thread); - nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); - Index.buildReplies(thread); - } + nodes = Index.processThreads(sortedThreads, i, max); Index.buildPagelist(); Index.setPage(pageNum); break; @@ -6017,17 +6014,22 @@ nodes = Index.buildCatalogViews(); break; default: - i = 0; - while (thread = sortedThreads[i++]) { - nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); - Index.buildReplies(thread); - } + nodes = Index.processThreads(sortedThreads, 0, sortedThreads.length); } if (!infinite) { $.rmAll(Index.root); } return $.add(Index.root, nodes); }, + processThreads: function(threads, i, max) { + var nodes, thread; + nodes = []; + while (i < max && (thread = threads[i++])) { + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); + Index.buildReplies(thread); + } + return nodes; + }, isSearching: false, clearSearch: function() { Index.searchInput.value = null; diff --git a/src/Filtering/PostHiding.coffee b/src/Filtering/PostHiding.coffee index 3bdd9026b..c9bd228f8 100644 --- a/src/Filtering/PostHiding.coffee +++ b/src/Filtering/PostHiding.coffee @@ -56,7 +56,7 @@ PostHiding = Index.updateHideLabel() if Conf['Index Mode'] is 'all pages' or !Conf['JSON Navigation'] # ssllooooww root = post.nodes.root.parentNode - $.rm root.nextElementSibling + $.rm root.nextElementSibling # HR element $.rm root return Index.sort() diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 9816903f0..68cd0e1b9 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -555,7 +555,7 @@ Index = Index.notice = new Notice 'info', 'Refreshing index...', 2 ), 3 * $.SECOND - (Date.now() - now) - pageNum = null if typeof pageNum isnt 'number' # event + pageNum = '' if typeof pageNum isnt 'number' # event onload = (e) -> Index.load e, pageNum Index.req = $.ajax "//a.4cdn.org/#{g.BOARD.ID}/catalog.json", onabort: onload @@ -793,13 +793,9 @@ Index = pageNum = Index.getCurrentPage() threadsPerPage = Index.getThreadsNumPerPage() - threads = [] i = threadsPerPage * (pageNum - 1) max = i + threadsPerPage - while i < max and thread = sortedThreads[i++] - threads.push thread - nodes.push thread.OP.nodes.root.parentNode, $.el 'hr' - Index.buildReplies thread + nodes = Index.processThreads sortedThreads, i, max Index.buildPagelist() Index.setPage pageNum @@ -808,14 +804,18 @@ Index = nodes = Index.buildCatalogViews() else - i = 0 - while thread = sortedThreads[i++] - nodes.push thread.OP.nodes.root.parentNode, $.el 'hr' - Index.buildReplies thread + nodes = Index.processThreads sortedThreads, 0, sortedThreads.length $.rmAll Index.root unless infinite $.add Index.root, nodes + processThreads: (threads, i, max) -> + nodes = [] + while i < max and thread = threads[i++] + nodes.push thread.OP.nodes.root.parentNode, $.el 'hr' + Index.buildReplies thread + nodes + isSearching: false clearSearch: -> diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 3c644be8d..03c51e698 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -209,6 +209,7 @@ class Post ] $.add @nodes.stub, Menu.makeButton @ if Conf['Menu'] $.prepend @nodes.root, @nodes.stub + show: (showRecursively=Conf['Recursive Hiding']) -> return if !@isHidden @isHidden = false @@ -229,6 +230,7 @@ class Post unless @nodes.stub @nodes.root.hidden = false return + @nodes.post.hidden = false @nodes.post.previousElementSibling.hidden = false $.rm @nodes.stub diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index 5e275bcc7..ecf44700d 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -82,7 +82,7 @@ class Thread hide: -> return if @isHidden @isHidden = true - @OP.nodes.root.parentElement.hidden = true + @OP.nodes.root.parentElement.hidden = true unless Conf['JSON Navigation'] if button = $ '.hide-post-button', @OP.nodes.root $.replace button, PostHiding.makeButton false