mirror of
https://github.com/ParkerTenBroeck/automata.git
synced 2026-06-06 21:24:06 -04:00
Merge branch 'main' into gh-pages
This commit is contained in:
commit
144ee94544
1 changed files with 16 additions and 11 deletions
|
|
@ -21,16 +21,21 @@ btn.addEventListener("click", async () => {
|
|||
|
||||
|
||||
export function sharedText(): string|null {
|
||||
const url = new URL(globalThis.window.location.href);
|
||||
let text: string | null = url.searchParams.get("share");
|
||||
if (text !== null) {
|
||||
text = atob(text);
|
||||
url.searchParams.delete("share");
|
||||
globalThis.window.history.replaceState(
|
||||
{},
|
||||
document.title,
|
||||
url.pathname + url.search + url.hash
|
||||
);
|
||||
try{
|
||||
const url = new URL(globalThis.window.location.href);
|
||||
let text: string | null = url.searchParams.get("share");
|
||||
if (text !== null) {
|
||||
text = atob(text);
|
||||
url.searchParams.delete("share");
|
||||
globalThis.window.history.replaceState(
|
||||
{},
|
||||
document.title,
|
||||
url.pathname + url.search + url.hash
|
||||
);
|
||||
}
|
||||
return text;
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
return text;
|
||||
return null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue