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 node_modules
public/out public

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

@ -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,14 +17,17 @@
.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) {
// If `open' is already `i' updates aren't sent to lightbox.
open = null; open = null;
open = i; open = i;
} }

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

Loading…
Cancel
Save