aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/js/app.js')
-rw-r--r--frontend/js/app.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/frontend/js/app.js b/frontend/js/app.js
index 0875f14..b8bd1d9 100644
--- a/frontend/js/app.js
+++ b/frontend/js/app.js
@@ -85,6 +85,12 @@ function getPreviewUrl(entry, basePath) {
85 return path + 'unknown.png'; 85 return path + 'unknown.png';
86} 86}
87 87
88// simple extension detection, does not work with double extension like .tar.gz
89function getExtension(entry) {
90 if (entry.isFile) return entry.filePath.slice(entry.filePath.lastIndexOf('.') + 1);
91 return '';
92}
93
88function refresh() { 94function refresh() {
89 loadDirectory(app.path); 95 loadDirectory(app.path);
90} 96}
@@ -103,6 +109,7 @@ function loadDirectory(filePath) {
103 result.body.entries.sort(function (a, b) { return a.isDirectory && b.isFile ? -1 : 1; }); 109 result.body.entries.sort(function (a, b) { return a.isDirectory && b.isFile ? -1 : 1; });
104 app.entries = result.body.entries.map(function (entry) { 110 app.entries = result.body.entries.map(function (entry) {
105 entry.previewUrl = getPreviewUrl(entry, filePath); 111 entry.previewUrl = getPreviewUrl(entry, filePath);
112 entry.extension = getExtension(entry);
106 return entry; 113 return entry;
107 }); 114 });
108 app.path = filePath; 115 app.path = filePath;