Looks like I failed to understand exactly what was happening here

This commit is contained in:
Zixaphir 2014-01-07 12:10:08 -07:00
parent 767b89a82c
commit 4ce942c540
3 changed files with 28 additions and 16 deletions

View File

@ -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: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'>&nbsp;-&nbsp;</a></span> " + fourchannav.innerHTML + "</span>"
});
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 + "/";

View File

@ -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: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'>&nbsp;-&nbsp;</a></span> " + fourchannav.innerHTML + "</span>"
});
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 + "/";

View File

@ -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: "<span id=custom-board-list></span><span id=full-board-list hidden><span class='hide-board-list-container brackets-wrap'><a href=javascript:; class='hide-board-list-button'>&nbsp;-&nbsp;</a></span> #{fourchannav.innerHTML}</span>"
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}"