diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index c6784a65f..748348b7d 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1744,14 +1744,14 @@ setBoardList: function() { var a, boardList, btn, fourchannav, fullBoardList; 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: "" }); + if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) { + a.className = 'current'; + $.on(a, 'click', Index.cb.link); + } fullBoardList = $('#full-board-list', boardList); btn = $('.hide-board-list-button', fullBoardList); $.on(btn, 'click', Header.toggleBoardList); @@ -1772,7 +1772,7 @@ } as = $$('#full-board-list a[title]', Header.bar); nodes = text.match(/[\w@]+((-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+")|\,"[^"]+[^"]"))*|[^\w@]+/g).map(function(t) { - var a, board, m, _i, _len; + var a, board, current, m, _i, _len; if (/^[^\w@]/.test(t)) { return $.tn(t); } @@ -1798,7 +1798,11 @@ a = as[_i]; if (a.textContent === board) { a = a.cloneNode(true); - a.textContent = /-title/.test(t) || /-replace/.test(t) && $.hasClass(a, 'current') ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent; + current = $.hasClass(a, 'current'); + if (current) { + $.on(a, 'click', Index.cb.link); + } + a.textContent = /-title/.test(t) || /-replace/.test(t) && current ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent; if (m = t.match(/-(index|catalog)/)) { a.dataset.only = m[1]; a.href = "//boards.4chan.org/" + board + "/"; diff --git a/builds/crx/script.js b/builds/crx/script.js index f8330b898..4f5048c1f 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1754,14 +1754,14 @@ setBoardList: function() { var a, boardList, btn, fourchannav, fullBoardList; 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: "" }); + if (a = $("a[href*='/" + g.BOARD + "/']", boardList)) { + a.className = 'current'; + $.on(a, 'click', Index.cb.link); + } fullBoardList = $('#full-board-list', boardList); btn = $('.hide-board-list-button', fullBoardList); $.on(btn, 'click', Header.toggleBoardList); @@ -1782,7 +1782,7 @@ } as = $$('#full-board-list a[title]', Header.bar); nodes = text.match(/[\w@]+((-(all|title|replace|full|index|catalog|url:"[^"]+[^"]"|text:"[^"]+")|\,"[^"]+[^"]"))*|[^\w@]+/g).map(function(t) { - var a, board, m, _i, _len; + var a, board, current, m, _i, _len; if (/^[^\w@]/.test(t)) { return $.tn(t); } @@ -1808,7 +1808,11 @@ a = as[_i]; if (a.textContent === board) { a = a.cloneNode(true); - a.textContent = /-title/.test(t) || /-replace/.test(t) && $.hasClass(a, 'current') ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent; + current = $.hasClass(a, 'current'); + if (current) { + $.on(a, 'click', Index.cb.link); + } + a.textContent = /-title/.test(t) || /-replace/.test(t) && current ? a.title : /-full/.test(t) ? "/" + board + "/ - " + a.title : (m = t.match(/-text:"(.+)"/)) ? m[1] : a.textContent; if (m = t.match(/-(index|catalog)/)) { a.dataset.only = m[1]; a.href = "//boards.4chan.org/" + board + "/"; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 4e42cce8c..a6eec0c65 100755 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -135,12 +135,12 @@ Header = setBoardList: -> 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: "" + if a = $ "a[href*='/#{g.BOARD}/']", boardList + a.className = 'current' + $.on a, 'click', Index.cb.link fullBoardList = $ '#full-board-list', boardList btn = $ '.hide-board-list-button', fullBoardList $.on btn, 'click', Header.toggleBoardList @@ -184,7 +184,11 @@ Header = if a.textContent is board a = a.cloneNode true - a.textContent = if /-title/.test(t) or /-replace/.test(t) and $.hasClass a, 'current' + current = $.hasClass a, 'current' + if current + $.on a, 'click', Index.cb.link + + a.textContent = if /-title/.test(t) or /-replace/.test(t) and current a.title else if /-full/.test t "/#{board}/ - #{a.title}"