diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 7cde1f003..1ab269200 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -2155,7 +2155,7 @@ Index = { init: function() { var anchorEntry, input, label, modeEntry, name, refNavEntry, repliesEntry, sortEntry, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; - if (g.BOARD.ID === 'f') { + if (g.BOARD.ID === 'f' || g.VIEW === 'catalog') { return; } this.button = $.el('a', { @@ -2290,6 +2290,9 @@ $.on(this.searchInput, 'input', this.onSearchInput); $.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch); $.on($('#returnlink', this.navLinks), 'click', Navigate.navigate); + $.on($('#cataloglink', this.navLinks), 'click', function() { + return window.location = "//boards.4chan.org/" + g.BOARD + "/catalog"; + }); if (g.VIEW === 'index') { this.update(); } @@ -12102,13 +12105,13 @@ if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) { return; } + if (e) { + e.preventDefault(); + } path = this.pathname; if (this.hash) { path += this.hash; } - if (e) { - e.preventDefault(); - } if (this.id !== 'popState') { history.pushState(null, '', path); } diff --git a/builds/crx/script.js b/builds/crx/script.js index 2af6326a2..217a91929 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -2165,7 +2165,7 @@ Index = { init: function() { var anchorEntry, input, label, modeEntry, name, refNavEntry, repliesEntry, sortEntry, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; - if (g.BOARD.ID === 'f') { + if (g.BOARD.ID === 'f' || g.VIEW === 'catalog') { return; } this.button = $.el('a', { @@ -2300,6 +2300,9 @@ $.on(this.searchInput, 'input', this.onSearchInput); $.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch); $.on($('#returnlink', this.navLinks), 'click', Navigate.navigate); + $.on($('#cataloglink', this.navLinks), 'click', function() { + return window.location = "//boards.4chan.org/" + g.BOARD + "/catalog"; + }); if (g.VIEW === 'index') { this.update(); } @@ -12091,13 +12094,13 @@ if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) { return; } + if (e) { + e.preventDefault(); + } path = this.pathname; if (this.hash) { path += this.hash; } - if (e) { - e.preventDefault(); - } if (this.id !== 'popState') { history.pushState(null, '', path); } diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 91fe30033..db23e5620 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -1,6 +1,6 @@ Index = init: -> - return if g.BOARD.ID is 'f' + return if g.BOARD.ID is 'f' or g.VIEW is 'catalog' @button = $.el 'a', className: 'index-refresh-shortcut fa fa-refresh' @@ -83,7 +83,10 @@ Index = $.on @pagelist, 'click', @cb.pageNav $.on @searchInput, 'input', @onSearchInput $.on $('#index-search-clear', @navLinks), 'click', @clearSearch - $.on $('#returnlink', @navLinks), 'click', Navigate.navigate + $.on $('#returnlink', @navLinks), 'click', Navigate.navigate + $.on $('#cataloglink', @navLinks), 'click', -> + window.location = "//boards.4chan.org/#{g.BOARD}/catalog" + @update() if g.VIEW is 'index' $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index b284b4973..01b535c19 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -4,8 +4,7 @@ Navigate = return if g.VIEW is 'catalog' or g.BOARD.ID is 'f' # blink/webkit throw a popstate on page load. Not what we want. - $.ready -> - $.on window, 'popstate', Navigate.popstate + $.ready -> $.on window, 'popstate', Navigate.popstate Thread.callbacks.push name: 'Navigate' @@ -27,10 +26,8 @@ Navigate = $.on postlink, 'click', Navigate.navigate return unless Conf['Quote Hash Navigation'] - for hashlink in $$ '.hashlink', @nodes.comment $.on hashlink, 'click', Navigate.navigate - return clean: -> @@ -79,9 +76,7 @@ Navigate = errors.push message: "Failed to reconnect feature #{name}." error: err - Main.handleErrors errors if errors - return ready: (name, feature, condition) -> @@ -92,7 +87,6 @@ Navigate = message: "Quote Threading Failed." error: err ] - Main.handleErrors error if error QR.generatePostableThreadsList() @@ -188,11 +182,11 @@ Navigate = [boardID, view, threadID] = path return if view is 'catalog' or 'f' in [boardID, g.BOARD.ID] + e.preventDefault() if e path = @pathname path += @hash if @hash - e.preventDefault() if e history.pushState null, '', path unless @id is 'popState' Navigate.path = @pathname