Compare commits

...

2 Commits

Author SHA1 Message Date
not manx 856db4599a
Add comments and cleanup
4 years ago
not manx 9acf6df1af
Delete obsolete files
4 years ago

2
.gitignore vendored

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en" class="bg-primary text-words">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="out/bundle.css">
<title>Stealing posts from Nyafuu</title>
</head>
<body class="max-w-4xl mx-auto px-4 my-8 color-text">
<script src="out/bundle.js"></script>
</body>
</html>

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

@ -10,7 +10,8 @@
$: 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} />

@ -1,36 +0,0 @@
<script>
import {onMount} from 'svelte';
export let themes;
let theme;
let themeSelect;
let html = document.querySelector('html');
let baseTheme = 'default';
function toggleTheme() {
html.classList.toggle(theme);
}
function handle_theme() {
toggleTheme();
theme = themeSelect.value
toggleTheme();
localStorage.setItem('theme', theme);
}
onMount(() => {
theme = localStorage.getItem('theme') || baseTheme;
html.classList.toggle(theme);
themeSelect = document.querySelector('#theme-select');
themeSelect.value = theme;
});
</script>
<select id="theme-select" class="float-right bg-nav border-1 border-secondary text-nav-link w-1/5" on:change={handle_theme} >
{#each themes as theme}
<option value={theme} >{theme}</option>
{/each}
</select>
Loading…
Cancel
Save