User:Fred Bradstadt/show all collapsed tables.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// A function to un-collapse all collapsed tables on a page
addOnloadHook(function() {
  var ti = 0;
  var Ta = document.getElementsByTagName( "table" );
 
  for ( var i = 0; i < Ta.length; i++ ) {
    if ( $( Ta[i]).hasClass( "collapsible" ) && document.getElementById( "collapseButton" + ti ).firstChild.data == expandCaption ) {
      collapseTable( ti );
      ti++;
    }
  }
});