bizou/plugins/viewer/template.php

113 lines
1.9 KiB
PHP
Raw Normal View History

2011-06-13 15:55:10 +02:00
<html>
<head>
2013-08-17 21:01:29 +02:00
<title> <?= IMAGES_DIR.$simpleImagePath ?> </title>
2011-06-13 15:55:10 +02:00
<style type="text/css">
html, body {
2015-04-03 19:50:52 +02:00
height: 100%;
2011-06-13 15:55:10 +02:00
}
body {
2015-04-03 19:50:52 +02:00
margin: 0;
text-align: center;
background: black;
color: white;
2011-06-13 15:55:10 +02:00
}
#theimage {
2015-04-03 19:50:52 +02:00
max-width: 100%;
max-height: 100%;
image-orientation: from-image;
2011-06-13 15:55:10 +02:00
}
a {
color: white;
text-decoration: none;
}
#next, #previous, #up {
position: fixed;
font-size: 4em;
font-weight: bold;
}
#up {
top: 0;
left: 0;
}
#next {
top: 50%;
right: -0;
}
#previous {
top: 50%;
left: 0;
}
img {
border: 0;
}
</style>
<?php if ($nextImageUrl !== '' and $firefox) { ?>
2013-08-17 21:01:29 +02:00
<link rel="prefetch" href="<?= $nextImageUrl ?>" />
<link rel="prefetch" href="<?= $nextPageUrl ?>" />
2011-06-13 15:55:10 +02:00
<?php } ?>
</head>
<body>
2013-08-17 21:01:29 +02:00
<a href="<?= $imageUrl ?>"><img src="<?= $imageUrl ?>" id="theimage" /></a>
2011-06-13 15:55:10 +02:00
<div id="up">
2013-08-17 21:01:29 +02:00
<a href="<?= $directoryUrl ?>" title="Back to directory">^</a>
2011-06-13 15:55:10 +02:00
</div>
<?php if ($nextPageUrl !== '') { ?>
<div id="next">
2013-08-17 21:01:29 +02:00
<a href="<?= $nextPageUrl ?>" title="Next image">&gt;</a>
2011-06-13 15:55:10 +02:00
</div>
<?php } ?>
<?php if ($prevPageUrl !== '') { ?>
<div id="previous">
2013-08-17 21:01:29 +02:00
<a href="<?= $prevPageUrl ?>" title="Previous image">&lt;</a>
2011-06-13 15:55:10 +02:00
</div>
<?php } ?>
<script type="text/javascript">
<?php if ($nextImageUrl !== '' and ! $firefox) { ?>
window.onload = function() { // for browsers not supporting link rel=prefetch
var im = new Image();
2013-08-17 21:01:29 +02:00
im.src = '<?= $nextImageUrl ?>';
2011-06-13 15:55:10 +02:00
var req = new XMLHttpRequest();
2013-08-17 21:01:29 +02:00
req.open('GET', '<?= $nextPageUrl ?>', false);
2011-06-13 15:55:10 +02:00
req.send(null);
};
<?php } ?>
// keyboard navigation
function keyup(e)
{
switch (e.keyCode) {
case 37: // left
2013-08-17 21:01:29 +02:00
window.location = "<?= $prevPageUrl ?>";
2011-06-13 15:55:10 +02:00
break;
case 39: // right
case 32: // space
2013-08-17 21:01:29 +02:00
window.location = "<?= $nextPageUrl ?>";
2011-06-13 15:55:10 +02:00
break;
case 38: // up (down is 40)
2013-08-17 21:01:29 +02:00
window.location = "<?= $directoryUrl ?>";
2011-06-13 15:55:10 +02:00
break;
case 13: // enter
2013-08-17 21:01:29 +02:00
window.location = "<?= $imageUrl ?>";
2011-06-13 15:55:10 +02:00
break;
}
}
if (document.addEventListener) {
document.addEventListener("keyup", keyup, false);
}
</script>
</body>
</html>