1
0
Fork 0
mirror of https://github.com/alangrainger/immich-public-proxy.git synced 2024-12-28 03:41:58 +00:00
immich-public-proxy/app/views/gallery.ejs
Alan Grainger 58090193a9 Fix #43
2024-12-27 09:52:47 +13:00

66 lines
2.5 KiB
Text

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title><%- title %></title>
<link rel="icon" href="/share/static/favicon.ico" type="image/x-icon">
<link type="text/css" rel="stylesheet" href="/share/static/style.css"/>
<link type="text/css" rel="stylesheet" href="/share/static/lg/lightgallery-bundle.min.css"/>
</head>
<body>
<div id="header">
<% if (showTitle) { %>
<h1><%- title || 'Gallery' %></h1>
<% } %>
<%
if (showDownload) {
// If there is a password required for the download, format it as a query string
const passwordQuery = Object.entries(password).length ? '?' + (new URLSearchParams(password)).toString() : ''
%>
<div id="download-all">
<a href="<%- path %>/download<%- passwordQuery %>" title="Download all"><img src="/share/static/images/download-all.svg"
height="24"
width="24" alt="Download all"></a>
</div>
<% } %>
</div>
<div id="lightgallery">
<% items.forEach(item => {
if (item.video) { %>
<a data-video='<%- item.video %>'
<% if (item.downloadUrl) { %>
data-download-url="<%- item.downloadUrl %>"
<% } %>
>
<img alt="" src="<%- item.thumbnailUrl %>"/>
<div class="play-icon"></div>
</a>
<% } else { %>
<a href="<%- item.previewUrl %>"
<% if (item.downloadUrl) { %>
data-download-url="<%- item.downloadUrl %>"
<% } %>
>
<img alt="" src="<%- item.thumbnailUrl %>"/>
</a>
<% }
}) %>
</div>
<script src="/share/static/web.js"></script>
<script src="/share/static/lg/lightgallery.min.js"></script>
<script src="/share/static/lg/lg-fullscreen.min.js"></script>
<script src="/share/static/lg/lg-thumbnail.min.js"></script>
<script src="/share/static/lg/lg-video.min.js"></script>
<script src="/share/static/lg/lg-zoom.min.js"></script>
<script type="text/javascript">
initLightGallery(<%- JSON.stringify(lgConfig) %>) // initLightGallery imported from web.js
<% if (openItem) { %>
const openItem = <%- openItem %>
const thumbs = document.querySelectorAll('#lightgallery a')
if (thumbs.length >= openItem) {
thumbs[openItem - 1].click()
}
<% } %>
</script>
</body>
</html>