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