use switch

This commit is contained in:
James Campos 2011-06-20 11:31:21 -07:00
parent e975e9d2d8
commit c1cd50c2dc
2 changed files with 14 additions and 2 deletions

View File

@ -576,7 +576,16 @@
return $.cache[pathname].abort();
case '-':
a.textContent = a.textContent.replace('-', '+');
num = g.BOARD === 'b' ? 3 : g.BOARD === 't' ? 1 : 5;
num = (function() {
switch (g.BOARD) {
case 'b':
return 3;
case 't':
return 1;
default:
return 5;
}
})();
table = $.x("following::br[@clear][1]/preceding::table[" + num + "]", a);
while ((prev = table.previousSibling) && (prev.nodeName === 'TABLE')) {
$.rm(prev);

View File

@ -400,7 +400,10 @@ expandThread =
when '-'
a.textContent = a.textContent.replace '-', '+'
#goddamit moot
num = if g.BOARD is 'b' then 3 else if g.BOARD is 't' then 1 else 5
num = switch g.BOARD
when 'b' then 3
when 't' then 1
else 5
table = $.x "following::br[@clear][1]/preceding::table[#{num}]", a
while (prev = table.previousSibling) and (prev.nodeName is 'TABLE')
$.rm prev