diff --git a/public/png/parseHash.js b/public/common/parseHash.js similarity index 100% rename from public/png/parseHash.js rename to public/common/parseHash.js diff --git a/public/gif/gif.js b/public/gif/gif.js new file mode 100644 index 0000000..8fa834b --- /dev/null +++ b/public/gif/gif.js @@ -0,0 +1,19 @@ +// @ts-check + +import parseHash from "../common/parseHash.js"; + +const main = () => { + // TODO: We may want a better UI here. + // TODO: Handle hash changes. + const parsedHash = parseHash(location.hash); + if (!parsedHash) { + location.href = ".."; + return; + } + + const { bytes } = parsedHash; + + console.log(bytes); +}; + +main(); diff --git a/public/png/png.js b/public/png/png.js index fc6b62f..f784338 100644 --- a/public/png/png.js +++ b/public/png/png.js @@ -1,7 +1,7 @@ // @ts-check +import parseHash from "../common/parseHash.js"; import parsePng from "./parsePng.js"; -import parseHash from "./parseHash.js"; import getNodeUi from "./getNodeUi.js"; import explorer from "./explorer.js"; diff --git a/test/png/parseHash.test.ts b/test/common/parseHash.test.ts similarity index 93% rename from test/png/parseHash.test.ts rename to test/common/parseHash.test.ts index de67f47..652a31b 100644 --- a/test/png/parseHash.test.ts +++ b/test/common/parseHash.test.ts @@ -1,6 +1,6 @@ import { assertEquals } from "assert"; import { stubbingWarn } from "../helpers.ts"; -import parseHash from "../../public/png/parseHash.js"; +import parseHash from "../../public/common/parseHash.js"; Deno.test( "returns null if hash cannot be parsed",