add smooth mp4

This commit is contained in:
anarch3 2022-11-15 18:06:29 -05:00
parent 043628493d
commit f84072eda8
3 changed files with 14 additions and 1 deletions

View file

@ -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 => {

View file

@ -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();
});

View file

@ -7,6 +7,11 @@
<link rel="stylesheet" href="/css/base.css">
<link rel="stylesheet" href="/css/index.css">
<link rel="stylesheet" href="/css/app.css">
<%
function extension(string) {
return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2);
}
%>
</head>
<body>
<section class="todoapp">
@ -39,7 +44,11 @@
<li>
<form action="<%= file.url %>" method="post">
<div class="view">
<% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %>
<video autoplay loop muted playsinline class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)"></video>
<% } else { %>
<img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)">
<% } %>
<label text-align:"center"><%= file.path %></label>
<button class="destroy" form="delete-<%= file.path %>"></button>
</div>