Skip to content

Commit

Permalink
Version 1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-wannacott committed Mar 15, 2024
1 parent 8d5d500 commit 402d8ae
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 27 deletions.
Binary file modified browser-extensions/chrome/table-sort-js.zip
Binary file not shown.
19 changes: 10 additions & 9 deletions browser-extensions/chrome/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
break;
}
const tableColumn = tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
column.span[columnIndex] === 1
? column.spanSum[columnIndex] - 1
Expand Down Expand Up @@ -125,11 +125,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
table.headers.push(
table.theads.item(index).querySelectorAll("* > th , * > td")
);
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
Expand Down Expand Up @@ -200,7 +198,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
};
const numberWithUnitType = /([.0-9]+)\s?(B|KB|KiB|MB|MiB|GB|GiB|TB|TiB)/i;
for (let [i, tr] of table.visibleRows.entries()) {
let fileSizeTd = tr.querySelectorAll("td").item(columnIndex).textContent;
let fileSizeTd = tr
.querySelectorAll("* > th , * > td")
.item(columnIndex).textContent;
let match = fileSizeTd.match(numberWithUnitType);
if (match) {
let number = parseFloat(match[1]);
Expand Down Expand Up @@ -465,7 +465,8 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
"NaN"
);
}
tr.querySelectorAll("td").item(columnIndex).innerHTML = fileSizeInBytesHTML;
tr.querySelectorAll("* > th , * > td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
return table.hasClass.cellsSort ? tr.innerHTML : tr.outerHTML;
}

Expand Down Expand Up @@ -532,7 +533,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const column = {
getColumn: function getColumn(tr, colSpanSum, colSpanData) {
return tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
colSpanData[columnIndex] === 1
? colSpanSum[columnIndex] - 1
Expand Down
Binary file modified browser-extensions/firefox/table-sort-js.zip
Binary file not shown.
19 changes: 10 additions & 9 deletions browser-extensions/firefox/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
break;
}
const tableColumn = tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
column.span[columnIndex] === 1
? column.spanSum[columnIndex] - 1
Expand Down Expand Up @@ -125,11 +125,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
table.headers.push(
table.theads.item(index).querySelectorAll("* > th , * > td")
);
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
Expand Down Expand Up @@ -200,7 +198,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
};
const numberWithUnitType = /([.0-9]+)\s?(B|KB|KiB|MB|MiB|GB|GiB|TB|TiB)/i;
for (let [i, tr] of table.visibleRows.entries()) {
let fileSizeTd = tr.querySelectorAll("td").item(columnIndex).textContent;
let fileSizeTd = tr
.querySelectorAll("* > th , * > td")
.item(columnIndex).textContent;
let match = fileSizeTd.match(numberWithUnitType);
if (match) {
let number = parseFloat(match[1]);
Expand Down Expand Up @@ -465,7 +465,8 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
"NaN"
);
}
tr.querySelectorAll("td").item(columnIndex).innerHTML = fileSizeInBytesHTML;
tr.querySelectorAll("* > th , * > td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
return table.hasClass.cellsSort ? tr.innerHTML : tr.outerHTML;
}

Expand Down Expand Up @@ -532,7 +533,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const column = {
getColumn: function getColumn(tr, colSpanSum, colSpanData) {
return tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
colSpanData[columnIndex] === 1
? colSpanSum[columnIndex] - 1
Expand Down
19 changes: 10 additions & 9 deletions npm/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
break;
}
const tableColumn = tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
column.span[columnIndex] === 1
? column.spanSum[columnIndex] - 1
Expand Down Expand Up @@ -125,11 +125,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
if (table.theads.item(index).querySelectorAll("th").length == 0) {
table.headers.push(table.theads.item(index).querySelectorAll("td"));
} else {
table.headers.push(table.theads.item(index).querySelectorAll("th"));
}
table.headers.push(
table.theads.item(index).querySelectorAll("* > th , * > td")
);
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
Expand Down Expand Up @@ -200,7 +198,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
};
const numberWithUnitType = /([.0-9]+)\s?(B|KB|KiB|MB|MiB|GB|GiB|TB|TiB)/i;
for (let [i, tr] of table.visibleRows.entries()) {
let fileSizeTd = tr.querySelectorAll("td").item(columnIndex).textContent;
let fileSizeTd = tr
.querySelectorAll("* > th , * > td")
.item(columnIndex).textContent;
let match = fileSizeTd.match(numberWithUnitType);
if (match) {
let number = parseFloat(match[1]);
Expand Down Expand Up @@ -465,7 +465,8 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
"NaN"
);
}
tr.querySelectorAll("td").item(columnIndex).innerHTML = fileSizeInBytesHTML;
tr.querySelectorAll("* > th , * > td").item(columnIndex).innerHTML =
fileSizeInBytesHTML;
return table.hasClass.cellsSort ? tr.innerHTML : tr.outerHTML;
}

Expand Down Expand Up @@ -532,7 +533,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const column = {
getColumn: function getColumn(tr, colSpanSum, colSpanData) {
return tr
.querySelectorAll("td")
.querySelectorAll("* > th , * > td")
.item(
colSpanData[columnIndex] === 1
? colSpanSum[columnIndex] - 1
Expand Down

0 comments on commit 402d8ae

Please sign in to comment.