diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index a95e209b2..8c39f1eef 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1711,6 +1711,7 @@ _this.footer = $.id('boardNavDesktopFoot'); if (a = $("a[href*='/" + g.BOARD + "/']", $.id('boardNavDesktopFoot'))) { a.className = 'current'; + $.on(a, 'click', Index.cb.link); } cs = $.el('a', { id: 'settingsWindowLink', @@ -1745,6 +1746,7 @@ fourchannav = $.id('boardNavDesktop'); if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) { a.className = 'current'; + $.on(a, 'click', Index.cb.link); } boardList = $.el('span', { id: 'board-list', @@ -2259,6 +2261,13 @@ } e.preventDefault(); return Index.userPageNav(+a.pathname.split('/')[2]); + }, + link: function(e) { + if (g.VIEW !== 'index' || /catalog/.test(this.href)) { + return; + } + e.preventDefault(); + return Index.update(); } }, scrollToIndex: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index e2cf6275a..5efcefa95 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1721,6 +1721,7 @@ _this.footer = $.id('boardNavDesktopFoot'); if (a = $("a[href*='/" + g.BOARD + "/']", $.id('boardNavDesktopFoot'))) { a.className = 'current'; + $.on(a, 'click', Index.cb.link); } cs = $.el('a', { id: 'settingsWindowLink', @@ -1755,6 +1756,7 @@ fourchannav = $.id('boardNavDesktop'); if (a = $("a[href*='/" + g.BOARD + "/']", fourchannav)) { a.className = 'current'; + $.on(a, 'click', Index.cb.link); } boardList = $.el('span', { id: 'board-list', @@ -2269,6 +2271,13 @@ } e.preventDefault(); return Index.userPageNav(+a.pathname.split('/')[2]); + }, + link: function(e) { + if (g.VIEW !== 'index' || /catalog/.test(this.href)) { + return; + } + e.preventDefault(); + return Index.update(); } }, scrollToIndex: function() { diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 18c3eb810..60355b4e4 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -104,6 +104,7 @@ Header = @footer = $.id 'boardNavDesktopFoot' if a = $ "a[href*='/#{g.BOARD}/']", $.id 'boardNavDesktopFoot' a.className = 'current' + $.on a, 'click', Index.cb.link cs = $.el 'a', id: 'settingsWindowLink' @@ -136,6 +137,7 @@ Header = fourchannav = $.id 'boardNavDesktop' if a = $ "a[href*='/#{g.BOARD}/']", fourchannav a.className = 'current' + $.on a, 'click', Index.cb.link boardList = $.el 'span', id: 'board-list' innerHTML: "" diff --git a/src/General/Index.coffee b/src/General/Index.coffee index e67f91569..a3f54c8e5 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -127,6 +127,10 @@ Index = return if a.textContent is 'Catalog' e.preventDefault() Index.userPageNav +a.pathname.split('/')[2] + link: (e) -> + return if g.VIEW isnt 'index' or /catalog/.test @href + e.preventDefault() + Index.update() scrollToIndex: -> Header.scrollToIfNeeded Index.root