From d41c9d9ee6847ae1696af37846eed6adb135e9d1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 12 Mar 2013 18:58:50 +0100 Subject: [PATCH] Allow empty board list. --- 4chan_x.user.js | 7 +++++-- src/features.coffee | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2ead3e083..1fcd315d5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1077,6 +1077,11 @@ }, generateBoardList: function(text) { var as, list, nodes; + list = $('#custom-board-list', Header.bar); + list.innerHTML = null; + if (!text) { + return; + } as = $$('#full-board-list a', Header.bar).slice(0, -2); nodes = text.match(/[\w@]+(-(all|title|full|text:"[^"]+"))?|[^\w@]+/g).map(function(t) { var a, board, m, _i, _len; @@ -1112,8 +1117,6 @@ } return $.tn(t); }); - list = $('#custom-board-list', Header.bar); - list.innerHTML = null; return $.add(list, nodes); }, toggleBoardList: function() { diff --git a/src/features.coffee b/src/features.coffee index 441d43122..f31445b00 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -59,6 +59,9 @@ Header = Header.setCatalogLinks Conf['Header catalog links'] generateBoardList: (text) -> + list = $ '#custom-board-list', Header.bar + list.innerHTML = null + return unless text as = $$('#full-board-list a', Header.bar)[0...-2] # ignore the Settings and Home links nodes = text.match(/[\w@]+(-(all|title|full|text:"[^"]+"))?|[^\w@]+/g).map (t) -> if /^[^\w@]/.test t @@ -87,8 +90,6 @@ Header = $.log t, t.match /-text:"(.+)"$/ return a $.tn t - list = $ '#custom-board-list', Header.bar - list.innerHTML = null $.add list, nodes toggleBoardList: ->