Add comments and cleanup

ご主人様
not manx 4 years ago
parent 9acf6df1af
commit 856db4599a
Signed by: C-xC-c
GPG Key ID: F52ED472284EF2F4

2
.gitignore vendored

@ -1,2 +1,2 @@
node_modules
public/out
public

@ -1,9 +1,6 @@
<script>
import Router from 'svelte-spa-router'
import Index from './index.svelte';
const themes = [
'default'
]
const routes = {
'/': Index

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

@ -11,6 +11,7 @@
$: image = open !== null && open >= 0 ? set_images() : '';
$: is_open(open);
// This needs renamed
function is_open(i) {
if (should_open && i !== null && i >= 0) {
class_list += ' open'
@ -85,7 +86,7 @@
width: 100vw;
height: 100vh;
opacity: 1;
transition: opacity 1s;
transition: opacity 1s; /* This is being applied when we add `slide_classes' */
display: flex;
justify-content: center;
align-items: center;
@ -96,7 +97,6 @@
background-color: rgba(0,0,0,0.7);
z-index: 0;
}
</style>
<svelte:window on:keydown={handle_keys} />

Loading…
Cancel
Save