Move home page into svelte and remove some old junk
This commit is contained in:
@@ -10,6 +10,7 @@ import { fade } from 'svelte/transition';
|
||||
export let title = "";
|
||||
export let width = "800px";
|
||||
export let height = "auto";
|
||||
export let padding = false;
|
||||
let visible = false;
|
||||
|
||||
const load_bg = background => {
|
||||
@@ -56,7 +57,7 @@ const keydown = e => {
|
||||
</button>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="body" class:padding>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
@@ -120,4 +121,7 @@ const keydown = e => {
|
||||
flex-shrink: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
.padding {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@@ -35,4 +35,28 @@ export function domain_url() {
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
export const add_upload_history = id => {
|
||||
// Make sure the user is not logged in, for privacy. This keeps the
|
||||
// files uploaded while logged in and anonymously uploaded files
|
||||
// separated
|
||||
if (document.cookie.includes("pd_auth_key")) { return; }
|
||||
|
||||
let uploads = localStorage.getItem("uploaded_files");
|
||||
if (uploads === null) { uploads = ""; }
|
||||
|
||||
// Check if there are not too many values stored
|
||||
if (uploads.length > 3600) {
|
||||
// 3600 characters is enough to store 400 file IDs. If we exceed that
|
||||
// number we'll drop the last two items
|
||||
uploads = uploads.substring(
|
||||
uploads.indexOf(",") + 1
|
||||
).substring(
|
||||
uploads.indexOf(",") + 1
|
||||
);
|
||||
}
|
||||
|
||||
// Save the new ID
|
||||
localStorage.setItem("uploaded_files", id + "," + uploads);
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user