From b94703f6b955c45d1fff3717e602366496a17ebd Mon Sep 17 00:00:00 2001 From: codeskyblue Date: Fri, 5 Aug 2016 17:13:29 +0800 Subject: [PATCH] fix sort --- res/js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/js/index.js b/res/js/index.js index 426681b..89e080e 100644 --- a/res/js/index.js +++ b/res/js/index.js @@ -257,8 +257,8 @@ function loadFileList(pathname) { cache: false, success: function(res) { res.files = _.sortBy(res.files, function(f) { - // Canot use -f.mtime, have to use Number.MAX_SAFE_INTEGER-f.mtime - return [f.type, Number.MAX_SAFE_INTEGER - f.mtime]; + var weight = f.type == 'dir' ? 1000 : 1; + return -weight * f.mtime; }) vm.files = res.files;