Graphical overhaul.
Remove all legacy pixeldrain pages, handlers and assets. Remove old theming engine. Make logo responsive to the accent colour. Lots of other stuff.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import { fs_get_node, fs_encode_path, fs_split_path } from "lib/FilesystemAPI.svelte";
|
||||
import { fs_get_node, fs_encode_path, fs_split_path, fs_path_from_json } from "lib/FilesystemAPI.svelte";
|
||||
import type { FSNode, FSPath, FSPermissions, FSContext } from "lib/FilesystemAPI.svelte";
|
||||
|
||||
export class FSNavigator {
|
||||
@@ -24,16 +24,6 @@ export class FSNavigator {
|
||||
this.history_enabled = history_enabled
|
||||
}
|
||||
|
||||
// The popstate event can be used to listen for navigation events. Register
|
||||
// this event listener on the <svelte:window> in the parent element. When
|
||||
// the user presses the back or forward buttons in the browser we'll catch
|
||||
// the event and navigate to the proper directory
|
||||
popstate = (e: PopStateEvent) => {
|
||||
// Get the part of the URL after the fs root and navigate to it
|
||||
const path = window.location.pathname.replace(/^\/d/, "")
|
||||
this.navigate(decodeURI(path), false)
|
||||
}
|
||||
|
||||
// The FSNavigator acts as a svelte store. This allows for DOM reactivity.
|
||||
// This works by implementing the store contract:
|
||||
// https://svelte.dev/docs/svelte-components#script-4-prefix-stores-with-$-to-access-their-values
|
||||
@@ -70,7 +60,13 @@ export class FSNavigator {
|
||||
|
||||
try {
|
||||
loading_start()
|
||||
const resp = await fs_get_node(path)
|
||||
|
||||
// The server embeds the node which the page was opened on. It's only
|
||||
// valid for the first navigation, which is to that same page
|
||||
const resp = window.initial_node !== undefined
|
||||
? fs_path_from_json(window.initial_node)
|
||||
: await fs_get_node(path)
|
||||
window.initial_node = undefined
|
||||
this.open_node(resp, push_history)
|
||||
} catch (err: any) {
|
||||
if (err.value !== undefined && err.value === "path_not_found") {
|
||||
|
||||
Reference in New Issue
Block a user