else/Javascript/unrowspan.js
Ethan Dalool b4ca46a165 Add undefined to all bookmarklets for firefox compatibility.
On Firefox, clicking a bookmarklet will cause the page to display
the last return value of the bookmarklet, deleting the rest of the
page contents. The solution is to add undefined; at the end.
2020-08-12 13:54:09 -07:00

26 lines
891 B
JavaScript

javascript:
function unrowspan(tbody)
{
var rows = tbody.children;
for (var row_index = 0; row_index < rows.length; row_index += 1)
{
var row = rows[row_index];
var columns = row.children;
for (var column_index = 0; column_index < columns.length; column_index += 1)
{
var column = columns[column_index];
var span = column.rowSpan;
column.rowSpan = 1;
for (var i = 1; i < span; i += 1)
{
var before = rows[row_index+i].children[column_index];
console.log("Put " + column.innerText + " before " + column_index + " - " + before.innerText);
rows[row_index+i].insertBefore(column.cloneNode(true), before);
}
}
}
}
var tbodies = Array.from(document.getElementsByTagName("tbody"));
tbodies.forEach(unrowspan);
undefined;