add mod/creat time sort functions

This commit is contained in:
joshuaboud 2021-11-29 12:51:54 -04:00
parent 93cd3c4964
commit 0a3f9d1f44
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E
1 changed files with 19 additions and 1 deletions

View File

@ -24,9 +24,11 @@ export class SortFunctions {
owner: "asc",
group: "asc",
size: "asc",
modified: "asc",
created: "asc",
}
this.icons = {};
for (let option of ["name", "owner", "group", "size"]) {
for (let option of ["name", "owner", "group", "size", "modified", "created"]) {
this.icons[option] = document.getElementById(`sort-${option}-icon`);
}
this.current_choice = "name";
@ -90,4 +92,20 @@ export class SortFunctions {
size_desc(first, second) {
return second.stat["size"] - first.stat["size"];
}
modified_asc(first, second) {
return first.stat["mtime"] - second.stat["mtime"];
}
modified_desc(first, second) {
return second.stat["mtime"] - first.stat["mtime"];
}
created_asc(first, second) {
return first.stat["ctime"] - second.stat["ctime"];
}
created_desc(first, second) {
return second.stat["ctime"] - first.stat["ctime"];
}
}