Is it possible for a Greasemonkey script to delete one row which has a null class (<tr class="" ...>
)?
The problem is that inside a <tbody>
tag there are two rows with a null class.
The row to be deleted is the first one.
<table id="sort_table" class="tablesorter">
<thead>
<tr>
<th class="blacktext timesroman_italic">This</th>
<th class="blacktext timesroman_italic">is a</th>
<th class="blacktext timesroman_italic">header</th>
<th class="blacktext timesroman_italic">row</th>
</tr>
</thead>
<tbody>
<!-- I WOULD LIKE TO DELETE FROM HERE -->
<tr class="" valign="middle">
<td class="bluetext timesroman align_middle">First</td>
<td class="bluetext timesroman align_middle">blank</td>
<td class="bluetext timesroman align_middle">class</td>
<td class="bluetext timesroman align_middle">row</td>
</tr>
<!-- TO HERE -->
<!-- BUT NOT FROM HERE -->
<tr class="" valign="middle">
<td class="bluetext timesroman align_middle">second</td>
<td class="bluetext timesroman align_middle">blank</td>
<td class="bluetext timesroman align_middle">class</td>
<td class="bluetext timesroman align_middle">row</td>
</tr>
<tr class="someclass" valign="middle">
<td class="bluetext timesroman align_middle">I gots</td>
<td class="bluetext timesroman align_middle">me</td>
<td class="bluetext timesroman align_middle">some</td>
<td class="bluetext timesroman align_middle">class</td>
</tr>
<tr valign="middle">
<td class="bluetext timesroman align_middle">no</td>
<td class="bluetext timesroman align_middle">class</td>
<td class="bluetext timesroman align_middle">attribute</td>
<td class="bluetext timesroman align_middle">row</td>
</tr>
<!-- TO HERE -->
</tbody>
</table>
I would like to delete the first "blank class" row. Like this:
Here's the pseudo-code I came up with but how do I do that in a script? :
- Go to a table with the id == "sort_table"
- Ignore the "thead" and go to "tbody", could be while trCount > 1 // "thead" has one "tr" so it should ignore one "tr" to skip to "thead";
- On "tbody", while trCountf < 2, delete trCountf rows. // trCountf < 2 because we should ignore the second row in "tbody"