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 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> <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,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} />

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

@ -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