107 lines
3.8 KiB
HTML
107 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Image Server</title>
|
|
$extra_meta
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
html, body { height: 100%; overflow: hidden; background: #1a1a1a; }
|
|
#container {
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
zoom: 1;
|
|
}
|
|
#img {
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
width: auto;
|
|
height: auto;
|
|
display: block;
|
|
cursor: pointer;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
background-image: url($img_url);
|
|
background-size: cover; /* Important for proper scaling */
|
|
background-position: center;
|
|
}
|
|
.chevron {
|
|
position: absolute;
|
|
top: 33%;
|
|
font-size: 96px;
|
|
color: rgba(255, 255, 255, 0.5);
|
|
cursor: pointer;
|
|
padding: 20px;
|
|
user-select: none;
|
|
transition: color 0.2s;
|
|
text-decoration: none;
|
|
}
|
|
.chevron:hover { color: rgba(255, 255, 255, 0.9); }
|
|
.chevron.left { left: 10px; }
|
|
.chevron.right { right: 10px; }
|
|
.play-btn {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
font-size: 48px;
|
|
color: rgba(255, 255, 255, 0.7);
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
transition: color 0.2s, transform 0.2s;
|
|
padding: 10px;
|
|
}
|
|
.play-btn:hover { color: rgba(255, 255, 255, 1); transform: scale(1.1); }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<a href="$image_click_url"><div id="img" title="$filename"></div></a>
|
|
<a href="$prev_url" class="chevron left" id="prev-btn">‹</a>
|
|
<a href="$next_url" class="chevron right" id="next-btn">›</a>
|
|
$play_button
|
|
</div>
|
|
<script>
|
|
function getRefreshParams() {
|
|
var path = window.location.pathname.slice(1);
|
|
var parts = path.split('/');
|
|
if (parts.length < 3) return null;
|
|
var order = parts[0];
|
|
if (order !== 'next' && order !== 'random') return null;
|
|
var delay = parseInt(parts[1]);
|
|
if (isNaN(delay)) return null;
|
|
return {
|
|
delay: delay,
|
|
order: order,
|
|
hash: parts[2]
|
|
};
|
|
}
|
|
|
|
document.addEventListener('keydown', function(e) {
|
|
e.preventDefault();
|
|
if (e.code === 'Space') {
|
|
var playBtn = document.querySelector('.play-btn');
|
|
if (playBtn) playBtn.click();
|
|
} else if (e.code === 'ArrowLeft') {
|
|
document.getElementById('prev-btn').click();
|
|
} else if (e.code === 'ArrowRight') {
|
|
document.getElementById('next-btn').click();
|
|
} else if (e.code === 'Equal') {
|
|
var params = getRefreshParams();
|
|
if (params) window.location.href = '/' + params.order + '/' + (params.delay + 1) + '/' + params.hash;
|
|
} else if (e.code === 'Minus') {
|
|
var params = getRefreshParams();
|
|
if (params && params.delay > 1) window.location.href = '/' + params.order + '/' + (params.delay - 1) + '/' + params.hash;
|
|
} else if (e.key.toLowerCase() === 'o') {
|
|
var params = getRefreshParams();
|
|
if (params) {
|
|
var newOrder = params.order === 'next' ? 'random' : 'next';
|
|
window.location.href = '/' + newOrder + '/' + params.delay + '/' + params.hash;
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|