MediaWiki:Common.js/collapse.js

/*Copied from The Elder Scrolls Wiki. Collapsible tables by User:HaLo2FrEeEk. Append 'class="collapsible"' to a table. :)*/ $('table.collapsible').each(function(e) { var $t = $(this); var $th = $t.find('th'); var hs = ($t.hasClass('collapsed')) ? 'show' : 'hide'; $th.append("[" + hs + "] "); if($t.hasClass('collapsed')) { $t.find('td').parent.hide; } }); $('.collapseLink > a').click(function(e) { e.preventDefault; collapseTable($(this)); }); collapseTable = function (e) { $t = e.closest('table');  $elems = $t.find('td').parent;  if($t.hasClass('collapsed')) {    $elems.show('fast');    $t.removeClass('collapsed');    e.html('hide');    } else {    $elems.hide('fast');    $t.addClass('collapsed');    e.html('show');    }  }