diff --git a/LICENSE b/LICENSE index 0014fe8d6..bbe0c80f5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.9.43 - 2015-01-10 +* appchan x - Version 2.9.43 - 2015-01-11 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 1215df192..02423ad40 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -27,7 +27,7 @@ // ==/UserScript== /* -* appchan x - Version 2.9.43 - 2015-01-10 +* appchan x - Version 2.9.43 - 2015-01-11 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -5465,11 +5465,11 @@ Index.currentPage = pageNum; maxPageNum = Index.getMaxPageNum(); pagesRoot = $('.pages', Index.pagelist); - prev = pagesRoot.previousSibling.firstChild; - next = pagesRoot.nextSibling.firstChild; + prev = pagesRoot.previousElementSibling.firstElementChild; href = Math.max(pageNum - 1, 1); prev.href = href === 1 ? './' : href; prev.firstChild.disabled = href === pageNum; + next = pagesRoot.nextElementSibling.firstElementChild; href = Math.min(pageNum + 1, maxPageNum); next.href = href === 1 ? './' : href; next.firstChild.disabled = href === pageNum; @@ -5553,14 +5553,7 @@ pageNum = null; } onload = function(e) { - var err; - try { - return Index.load(e, pageNum); - } catch (_error) { - err = _error; - console.error(err.message); - return console.error(err.stack); - } + return Index.load(e, pageNum); }; Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", { onabort: onload, @@ -5858,11 +5851,9 @@ _ref = Index.sortedThreads; for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { thread = _ref[i]; - if (match(thread)) { - (match(thread) ? topThreads : bottomThreads).push(thread); - } + (match(thread) ? topThreads : bottomThreads).push(thread); } - return Index.sortedThreads = topThreads.push.apply(topThreads, bottomThreads); + return Index.sortedThreads = topThreads.concat(bottomThreads); }, buildIndex: function(infinite) { var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; @@ -6101,7 +6092,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6110,7 +6101,7 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; break; case 'developer': @@ -6119,7 +6110,7 @@ innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: diff --git a/builds/crx/script.js b/builds/crx/script.js index 5ddaa3923..bccef7c1e 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.9.43 - 2015-01-10 +* appchan x - Version 2.9.43 - 2015-01-11 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -5494,11 +5494,11 @@ Index.currentPage = pageNum; maxPageNum = Index.getMaxPageNum(); pagesRoot = $('.pages', Index.pagelist); - prev = pagesRoot.previousSibling.firstChild; - next = pagesRoot.nextSibling.firstChild; + prev = pagesRoot.previousElementSibling.firstElementChild; href = Math.max(pageNum - 1, 1); prev.href = href === 1 ? './' : href; prev.firstChild.disabled = href === pageNum; + next = pagesRoot.nextElementSibling.firstElementChild; href = Math.min(pageNum + 1, maxPageNum); next.href = href === 1 ? './' : href; next.firstChild.disabled = href === pageNum; @@ -5582,14 +5582,7 @@ pageNum = null; } onload = function(e) { - var err; - try { - return Index.load(e, pageNum); - } catch (_error) { - err = _error; - console.error(err.message); - return console.error(err.stack); - } + return Index.load(e, pageNum); }; Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", { onabort: onload, @@ -5887,11 +5880,9 @@ _ref = Index.sortedThreads; for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { thread = _ref[i]; - if (match(thread)) { - (match(thread) ? topThreads : bottomThreads).push(thread); - } + (match(thread) ? topThreads : bottomThreads).push(thread); } - return Index.sortedThreads = topThreads.push.apply(topThreads, bottomThreads); + return Index.sortedThreads = topThreads.concat(bottomThreads); }, buildIndex: function(infinite) { var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; @@ -6130,7 +6121,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6139,7 +6130,7 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; break; case 'developer': @@ -6148,7 +6139,7 @@ innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: diff --git a/src/General/Build.coffee b/src/General/Build.coffee index 775fd3067..14c61f1a7 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -97,15 +97,15 @@ Build = when 'admin', 'admin_highlight' capcodeClass = ' capcodeAdmin' capcodeStart = <%= html(' ## Admin') %> - capcodeIcon = <%= html(' Admin Icon') %> + capcodeIcon = <%= html(' Admin Icon') %> when 'mod' capcodeClass = ' capcodeMod' capcodeStart = <%= html(' ## Mod') %> - capcodeIcon = <%= html(' Mod Icon') %> + capcodeIcon = <%= html(' Mod Icon') %> when 'developer' capcodeClass = ' capcodeDeveloper' capcodeStart = <%= html(' ## Developer') %> - capcodeIcon = <%= html(' Developer Icon') %> + capcodeIcon = <%= html(' Developer Icon') %> else capcodeClass = '' capcodeStart = <%= html('') %> diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 751564592..dbdd2a671 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -476,22 +476,28 @@ Index = Index.currentPage = pageNum maxPageNum = Index.getMaxPageNum() pagesRoot = $ '.pages', Index.pagelist + # Previous/Next buttons - prev = pagesRoot.previousSibling.firstChild - next = pagesRoot.nextSibling.firstChild + prev = pagesRoot.previousElementSibling.firstElementChild href = Math.max pageNum - 1, 1 prev.href = if href is 1 then './' else href prev.firstChild.disabled = href is pageNum + + next = pagesRoot.nextElementSibling.firstElementChild href = Math.min pageNum + 1, maxPageNum next.href = if href is 1 then './' else href next.firstChild.disabled = href is pageNum + # current page if strong = $ 'strong', pagesRoot return if +strong.textContent is pageNum $.replace strong, strong.firstChild else strong = $.el 'strong' - return unless a = pagesRoot.children[pageNum - 1] # If coming in from a Navigate.navigate, this could break. + + # If coming in from a Navigate.navigate, this could break. + return unless a = pagesRoot.children[pageNum - 1] + $.before a, strong $.add strong, a @@ -546,12 +552,7 @@ Index = ), 3 * $.SECOND - (Date.now() - now) pageNum = null if typeof pageNum isnt 'number' # event - onload = (e) -> - try - Index.load e, pageNum - catch err - console.error err.message - console.error err.stack + onload = (e) -> Index.load e, pageNum Index.req = $.ajax "//a.4cdn.org/#{g.BOARD.ID}/catalog.json", onabort: onload onloadend: onload @@ -776,9 +777,9 @@ Index = offset = 0 topThreads = [] bottomThreads = [] - for thread, i in Index.sortedThreads when match thread + for thread, i in Index.sortedThreads (if match thread then topThreads else bottomThreads).push thread - Index.sortedThreads = topThreads.push bottomThreads... + Index.sortedThreads = topThreads.concat bottomThreads buildIndex: (infinite) -> {sortedThreads} = Index