Spaces:
Runtime error
Runtime error
File size: 1,957 Bytes
97069e1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
<!DOCTYPE html>
<html>
<!--
+lightbox.html, a page for automatically showing all images in a
directory on an Apache server. Just copy it into the directory.
Works by scraping the default directory HTML at "./" - David Bau.
-->
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"
integrity="sha256-CMMTrj5gGwOAXBeFi7kNokqowkzbeL8ydAJy39ewjkQ="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.js"
integrity="sha256-qwbDmNVLiCqkqRBpF46q5bjYH11j5cd+K+Y6D3/ja28="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lity/2.3.1/lity.js"
integrity="sha256-28JiZvE/RethQIYCwkMdtSMHgI//KoTLeB2tSm10trs="
crossorigin="anonymous"></script>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/lity/2.3.1/lity.css"
integrity="sha256-76wKiAXVBs5Kyj7j0T43nlBCbvR6pqdeeZmXI4ATnY0="
crossorigin="anonymous" />
<style>
.thumb { display: inline-block; margin: 1px; text-align: center; }
.thumb img { max-width: 150px; }
</style>
</head>
<body>
<div id="app" v-if="images">
<h3>Images in <a :href="directory">{{ directory }}</a></h3>
<div v-for="r in images" class="thumb">
<div>{{ r }}</div>
<a :href="r" data-lity><img :src="r"></a>
</div>
</div><!--app-->
</body>
<script>
var theapp = new Vue({
el: '#app',
data: {
directory: window.location.pathname.replace(/[^\/]*$/, ''),
images: null
},
created: function() {
var self = this;
$.get('./?' + Math.random(), function(d) {
var imgurls = $.map($(d).find('a'),
x => x.href).filter(
x => x.match(/\.(jpg|jpeg|png|gif)$/i)).map(
x => x.replace(/.*\//, ''));
self.images = imgurls;
}, 'html');
}
})
</script>
</html>
|