|
|
@ -1,6 +1,7 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
import Lightbox from './lightbox.svelte';
|
|
|
|
import Lightbox from './lightbox.svelte';
|
|
|
|
|
|
|
|
|
|
|
|
let file_list;
|
|
|
|
let file_list;
|
|
|
|
let open;
|
|
|
|
let open;
|
|
|
|
let thumb_list = [];
|
|
|
|
let thumb_list = [];
|
|
|
@ -16,24 +17,27 @@
|
|
|
|
.then(resp => resp.text())
|
|
|
|
.then(resp => resp.text())
|
|
|
|
.then(data => data.split('\n'));
|
|
|
|
.then(data => data.split('\n'));
|
|
|
|
|
|
|
|
|
|
|
|
// Loop backwards efficiently
|
|
|
|
// Loop backwards efficiently.
|
|
|
|
for (let i = file_list.length - 2; i >= 0; i--) {
|
|
|
|
for (let i = file_list.length - 2; i >= 0; i--) {
|
|
|
|
const file = file_list[i];
|
|
|
|
const file = file_list[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Thumbs are only ever .jpg
|
|
|
|
thumb_list.push(file.substr(0, file.lastIndexOf('.')) + '.jpg');
|
|
|
|
thumb_list.push(file.substr(0, file.lastIndexOf('.')) + '.jpg');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function open_lightbox(i) {
|
|
|
|
function open_lightbox(i) {
|
|
|
|
open = null;
|
|
|
|
// If `open' is already `i' updates aren't sent to lightbox.
|
|
|
|
|
|
|
|
open = null;
|
|
|
|
open = i;
|
|
|
|
open = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
{#if file_list}
|
|
|
|
{#if file_list}
|
|
|
|
<section>
|
|
|
|
<section>
|
|
|
|
{#each thumb_list as thumb, i}
|
|
|
|
{#each thumb_list as thumb, i}
|
|
|
|
<img on:click={() => open_lightbox(i)} src="{url.root}{url.thumb}{thumb}" />
|
|
|
|
<img on:click={() => open_lightbox(i)} src="{url.root}{url.thumb}{thumb}" />
|
|
|
|
{/each}
|
|
|
|
{/each}
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
|
<Lightbox open={open} url={url} images={file_list} />
|
|
|
|
<Lightbox open={open} url={url} images={file_list} />
|
|
|
|