diff --git a/public/js/index.js b/public/js/index.js index 93433ed..0cffcf0 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -15,6 +15,10 @@ function absolutePath (href) { return link.href; } +function extension(string) { + return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2); +} + let dropArea = document.getElementById("dropArea"); ;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { diff --git a/routes/index.js b/routes/index.js index dc62fc6..4772528 100644 --- a/routes/index.js +++ b/routes/index.js @@ -46,7 +46,7 @@ function fetchMedia(req, res, next) { url: '/' + row.id } }); - res.locals.files = files; + res.locals.files = files.reverse(); //reverse so newest files appear first res.locals.Count = files.length; next(); }); diff --git a/views/index.ejs b/views/index.ejs index 5fc7c92..e0746f5 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -7,6 +7,11 @@ +<% +function extension(string) { + return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2); +} +%>
@@ -39,7 +44,11 @@
  • + <% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %> + + <% } else { %> + <% } %>