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
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:
parent
37b78f6c61
commit
985324970e
1 changed files with 25 additions and 2 deletions
27
js/main.js
27
js/main.js
|
@ -97,7 +97,10 @@ $(document).ready(function () {
|
||||||
var collator = new Intl.Collator([], {numeric: true});
|
var collator = new Intl.Collator([], {numeric: true});
|
||||||
filesData.sort(function (fileA, fileB) {
|
filesData.sort(function (fileA, fileB) {
|
||||||
return collator.compare(fileA.name.toLowerCase(), fileB.name.toLowerCase());
|
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") {
|
} else if (sortBy === "size") {
|
||||||
|
@ -112,6 +115,16 @@ $(document).ready(function () {
|
||||||
|
|
||||||
fileListElement.empty();
|
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);
|
var parentDir = getParentDir(path);
|
||||||
|
|
||||||
if (parentDir) {
|
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(
|
fileListElement.append(renderFileElement(
|
||||||
path,
|
path,
|
||||||
fileData.name,
|
fileData.name,
|
||||||
|
|
Loading…
Reference in a new issue