aboutsummaryrefslogtreecommitdiff
path: root/end.html
diff options
context:
space:
mode:
Diffstat (limited to 'end.html')
-rwxr-xr-xend.html33
1 files changed, 0 insertions, 33 deletions
diff --git a/end.html b/end.html
deleted file mode 100755
index f964978..0000000
--- a/end.html
+++ /dev/null
@@ -1,33 +0,0 @@
- </tbody>
- </table>
- </div>
- </div>
-
-</body>
-
-<script type="text/javascript">
- const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent;
-
- const comparer = (idx, asc) => (a, b) => ((v1, v2) =>
- v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
- )(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));
-
- function doSort(th) {
- console.log("Doing sort to: ", th.textContent, th)
- const table = th.closest('table');
- Array.from(table.querySelector('tbody').querySelectorAll('tr:nth-child(n)'))
- .sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))
- .forEach(tr => table.querySelector('tbody').appendChild(tr) );
- }
- // do the work...
- document.querySelectorAll('th').forEach(th => th.addEventListener('click', (() => {
- document.getElementsByClassName("current-sort")[0].classList.remove("current-sort");
- th.classList.add("current-sort");
- doSort(th);
- })));
-
- doSort(document.getElementsByClassName("current-sort")[0]);
-
-</script>
-
-</html>