From e61c1805cdb5af5db6c18d42fe253d3f86174e30 Mon Sep 17 00:00:00 2001 From: Mohammad Naghavi Date: Thu, 11 Feb 2016 15:59:19 +0100 Subject: [PATCH] sort by time per default --- js/main.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/main.js b/js/main.js index 57d7aec..11be9ed 100644 --- a/js/main.js +++ b/js/main.js @@ -76,6 +76,14 @@ $(document).ready(function () { url: filesBaseUrl + path, success: function (filesData) { + filesData.map(function (fileData) { + return fileData.mtime = new Date(fileData.mtime); + }); + + filesData.sort(function (fileA, fileB) { + return fileB.mtime.getTime() - fileA.mtime.getTime(); + }); + fileListElement.empty(); var parentDir = getParentDir(path);