diff options
author | Yorhel <git@yorhel.nl> | 2015-08-08 04:41:37 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-08-08 04:41:37 +0200 |
commit | 8447ba51583f6ac061688fd17ca78e3b77c6d76e (patch) | |
tree | 95d2723eb51ea246ff914e6645869e691e058aa8 /data | |
parent | 1e7b29358b3dbc5a7869d91bc61c6a62431b3e8e (diff) |
Char page: Dynamically show/hide trait groups depending on visible traits
Diffstat (limited to 'data')
-rw-r--r-- | data/script.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/data/script.js b/data/script.js index 81698ef7..fe42292f 100644 --- a/data/script.js +++ b/data/script.js @@ -3218,14 +3218,16 @@ if(byId('charops')) { (function() { var t = byClass('table', 'stripe'); var spoil; var sexual; - var fixcomma = function(c) { - var l = byName(c, 'span'); + // Fixes the commas between trait names and the hidden status of the entire row + var fixrow = function(c) { + var l = byName(byName(c, 'td')[1], 'span'); var first = 1; for(var i=0; i<l.length; i+=2) if(!hasClass(l[i], 'hidden')) { setClass(l[i+1], 'hidden', first); first = 0; } + setClass(c, 'hidden', first); }; var restripe = function() { for(var i=0; i<t.length; i++) { @@ -3235,12 +3237,12 @@ if(byId('charops')) { (function() { setClass(t[i], 'stripe', false); var r = 1; var rows = byName(b[0], 'tr'); - for(var j=0; j<rows.length; j++) - if(!hasClass(rows[j], 'nostripe') && !hasClass(rows[j], 'hidden')) { - if(hasClass(rows[j], 'charspoil')) - fixcomma(byName(rows[j], 'td')[1]); + for(var j=0; j<rows.length; j++) { + if(hasClass(rows[j], 'traitrow')) + fixrow(rows[j]); + if(!hasClass(rows[j], 'nostripe') && !hasClass(rows[j], 'hidden')) setClass(rows[j], 'odd', r++&1); - } + } } }; var setall = function() { |