diff --git a/src/App.svelte b/src/App.svelte index 633355b..0d8971b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,8 +1,15 @@
@@ -18,6 +25,16 @@ Source Code + {currentInterface = currentInterface == 'settings' ? 'game' : 'settings'}}> + {currentInterface == 'settings' ? 'Go back' : 'Settings'} +

- + + {#if currentInterface == 'game'} + + {/if} + + {#if currentInterface == 'settings'} + + {/if}
diff --git a/src/Settings.svelte b/src/Settings.svelte new file mode 100644 index 0000000..c5c8ae8 --- /dev/null +++ b/src/Settings.svelte @@ -0,0 +1,41 @@ + + +
+

Game settings

+ + +
+ + \ No newline at end of file diff --git a/src/Switch.svelte b/src/Switch.svelte new file mode 100644 index 0000000..64a0b61 --- /dev/null +++ b/src/Switch.svelte @@ -0,0 +1,66 @@ + + + + + \ No newline at end of file diff --git a/src/lib/scriptinterface.ts b/src/lib/scriptinterface.ts index d559a88..7230b89 100644 --- a/src/lib/scriptinterface.ts +++ b/src/lib/scriptinterface.ts @@ -1,10 +1,23 @@ import { random } from "./random"; import { encode, decode } from "./cipher"; +let allowHooks: {(): void}[] = []; + +export function addScriptAllowedHook(hook: {(): void}) { + allowHooks.push(hook) +} + let scriptsAllowed = false; export function allowScripts() { + if (scriptsAllowed) return; + + console.warn('Scripts are now allowed'); + scriptsAllowed = true; + for (const hook of allowHooks) { + hook(); + } } export function areScriptsAllowed() {