add warning if scripts are allowed
This commit is contained in:
parent
6c1ba181c2
commit
2206f442d1
|
@ -1,16 +1,23 @@
|
|||
<script lang="ts">
|
||||
import Game from './Game.svelte'
|
||||
import Game from './Game.svelte';
|
||||
import Shield from './icon/Shield.svelte';
|
||||
|
||||
import { areScriptsAllowed } from './lib/scriptinterface';
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<h1>blek! Wordle</h1>
|
||||
{#if areScriptsAllowed()}
|
||||
<p style="color:coral">
|
||||
<Shield height='13pt' />
|
||||
Scripts are allowed. The game may not be fair-played
|
||||
</p>
|
||||
{/if}
|
||||
<p>
|
||||
FOSS wordle game that runs in your browser!<br/>
|
||||
<a href='https://git.blek.codes/blek/wordle'>
|
||||
Source Code
|
||||
</a>
|
||||
</p>
|
||||
<div class='game-main'>
|
||||
<Game />
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<script lang="ts">
|
||||
export let width: string | number | undefined = undefined;
|
||||
export let height: string | number | undefined = undefined;
|
||||
</script>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style='transform:translateY(1px)' {width} {height} viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
||||
<path fill-rule="evenodd" d="M10.339 2.237a.532.532 0 00-.678 0 11.947 11.947 0 01-7.078 2.75.5.5 0 00-.479.425A12.11 12.11 0 002 7c0 5.163 3.26 9.564 7.834 11.257a.48.48 0 00.332 0C14.74 16.564 18 12.163 18 7.001c0-.54-.035-1.07-.104-1.59a.5.5 0 00-.48-.425 11.947 11.947 0 01-7.077-2.75zM10 6a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 6zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
|
|
@ -6,7 +6,10 @@ let scriptsAllowed = false;
|
|||
export function allowScripts() {
|
||||
scriptsAllowed = true;
|
||||
}
|
||||
allowScripts();
|
||||
|
||||
export function areScriptsAllowed() {
|
||||
return scriptsAllowed == true;
|
||||
}
|
||||
|
||||
export class GameState {
|
||||
word?: string;
|
||||
|
@ -31,7 +34,7 @@ export class WordleLibrary {
|
|||
|
||||
export class ScriptInterface {
|
||||
readonly gameState: GameState = new GameState();
|
||||
readonly scriptsAllowed: {(): boolean} = () => scriptsAllowed;
|
||||
readonly scriptsAllowed: {(): boolean} = areScriptsAllowed;
|
||||
readonly lib: WordleLibrary = new WordleLibrary();
|
||||
}
|
||||
globalThis.ScriptInterface = new ScriptInterface();
|
||||
|
|
Loading…
Reference in New Issue