66 lines
2.4 KiB
Plaintext
66 lines
2.4 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title><%= title %></title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
|
<%
|
|
// Add an og-image using the first image's thumbnail
|
|
if (items?.[0]?.previewUrl) {
|
|
%>
|
|
<meta property="og:title" content="<%= title %>">
|
|
<meta property="og:image" content="<%- publicBaseUrl %><%- items[0].previewUrl %>">
|
|
<meta name="twitter:title" content="<%= title %>">
|
|
<meta name="twitter:image" content="<%- publicBaseUrl %><%- items[0].previewUrl %>">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<% } %>
|
|
<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) {
|
|
%>
|
|
<div id="download-all">
|
|
<a href="<%- path %>/download" title="Download all"><img src="/share/static/images/download-all.svg"
|
|
height="24"
|
|
width="24" alt="Download all"></a>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
<div id="lightgallery">
|
|
<%
|
|
// Load the first 50 thumbnails, then load more as the user scrolls. See web.js
|
|
items.slice(0, 50).forEach(item => {
|
|
%><%- item.html %>
|
|
<% }) %>
|
|
</div>
|
|
<div id="loading-spinner"><span class="loader"></span></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 src="/share/static/lg/lg-hash.min.js"></script>
|
|
<script type="text/javascript">
|
|
lgallery.init(<%- JSON.stringify({
|
|
lgConfig,
|
|
items,
|
|
openItem
|
|
}) %>) // 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>
|