1
0

Reassign first and last row global var after sorting.

This commit is contained in:
Alexander Andreev 2022-10-31 03:23:08 +04:00
parent 182726f3e3
commit 50d2c6a8bd
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -9,8 +9,8 @@ const overlay_content = overlay.children[1].firstChild;
const overlay_label = overlay.children[1].lastChild;
const g_tbody = document.getElementsByTagName('tbody')[0];
const g_first_row = g_tbody.firstChild;
const g_last_row = g_tbody.lastChild;
let g_first_row = g_tbody.firstChild;
let g_last_row = g_tbody.lastChild;
const g_back_row = document.getElementsByTagName("tr")[1];
let g_scale = 1;
@ -184,6 +184,8 @@ thead_name.addEventListener('click', e => {
const b_name = b.children[0].textContent.toLowerCase();
return a_name < b_name ? -1 : a_name > b_name ? 1 : 0;
}, null, null, thead_name, [thead_date, thead_size]);
g_first_row = g_tbody.firstChild;
g_last_row = g_tbody.lastChild;
});
thead_date.classList.toggle("clickable");
@ -194,6 +196,8 @@ thead_date.addEventListener('click', e => {
const b_date = new Date(b.children[1].textContent.slice(0, -4));
return a_date - b_date;
}, null, null, thead_date, [thead_name, thead_size]);
g_first_row = g_tbody.firstChild;
g_last_row = g_tbody.lastChild;
});
@ -217,6 +221,8 @@ thead_size.addEventListener('click', e => {
e => e.children[2].textContent == "DIR",
e => e.children[2].textContent != "DIR",
thead_size, [thead_name, thead_date]);
g_first_row = g_tbody.firstChild;
g_last_row = g_tbody.lastChild;
});
function sortTable(compareFn, filterFn, filterNegFn, target, other) {