Ir a la navegación
Ir a la búsqueda
Busca en cnbGuatemala con Google
98 bytes eliminados
, hace 7 años
Línea 1: |
Línea 1: |
| /*hide empty table columns*/ | | /*hide empty table columns*/ |
| ( function ( $, mw ) { | | ( function ( $, mw ) { |
− | $('.smwtable tr th').each(function(i) { | + | $('.smwtable th').each(function(i) { |
− | //select all tds in this column
| + | var remove = 0; |
− | var tds = $(this).parents('table')
| + | |
− | .find('tr td:nth-child(' + (i + 1) + ')');
| + | var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')') |
− | //check if all the cells in this column are empty
| + | tds.each(function(j) { if (this.innerHTML == '') remove++; }); |
− | if(tds.length == tds.filter(':empty').length) {
| + | |
− | //hide header
| + | if (remove == ($('#mytable tr').length - 1)) { |
− | $(this).hide();
| + | $(this).hide(); |
− | //hide cells
| + | tds.hide(); |
− | tds.hide();
| + | } |
− | }
| + | }) |
− | }); | |
| | | |
| } ( jQuery, mediaWiki ) ); | | } ( jQuery, mediaWiki ) ); |