Add Sort folders first in sort mode Name & Size
Some checks failed
Publish Docker rootless image / Push Docker image to Docker Hub (push) Failing after 1m9s
Publish Docker image / Push Docker image to Docker Hub (push) Failing after 39s

This commit is contained in:
Aroy-Art 2024-03-27 14:32:57 +01:00
parent 37b78f6c61
commit 985324970e
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -97,7 +97,10 @@ $(document).ready(function () {
var collator = new Intl.Collator([], {numeric: true});
filesData.sort(function (fileA, fileB) {
return collator.compare(fileA.name.toLowerCase(), fileB.name.toLowerCase());
//return fileA.name.toLowerCase().localeCompare(fileB.name.toLowerCase());
});
filesData.sort(function (fileA, fileB) {
return collator.compare(fileA.type.toLowerCase(), fileB.type.toLowerCase());
});
} else if (sortBy === "size") {
@ -112,6 +115,16 @@ $(document).ready(function () {
fileListElement.empty();
var directories = [];
var files = [];
filesData.forEach(function (fileData) {
if (fileData.type === "folder") {
directories.push(fileData);
} else {
files.push(fileData);
}
});
var parentDir = getParentDir(path);
if (parentDir) {
@ -122,7 +135,17 @@ $(document).ready(function () {
));
}
filesData.forEach(function (fileData) {
directories.forEach(function (fileData) {
fileListElement.append(renderFileElement(
path,
fileData.name,
fileData.type,
fileData.size,
fileData.mtime
));
});
files.forEach(function (fileData) {
fileListElement.append(renderFileElement(
path,
fileData.name,