|
|
@ -21,6 +21,7 @@ for (const [displayName, automaton] of Object.entries(AUTOMATONS)) {
|
|
|
|
const handleEvent = () => {
|
|
|
|
const handleEvent = () => {
|
|
|
|
automatonSelector.setAttribute('hidden', 'hidden');
|
|
|
|
automatonSelector.setAttribute('hidden', 'hidden');
|
|
|
|
app.removeAttribute('hidden');
|
|
|
|
app.removeAttribute('hidden');
|
|
|
|
|
|
|
|
history.replaceState({ automaton }, '', `#${encodeURIComponent(displayName)}`);
|
|
|
|
openAutomaton(trUserContent(displayName), automaton);
|
|
|
|
openAutomaton(trUserContent(displayName), automaton);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
card.addEventListener('click', handleEvent);
|
|
|
|
card.addEventListener('click', handleEvent);
|
|
|
@ -46,7 +47,15 @@ create.addEventListener('click', () => {
|
|
|
|
openAutomaton('', [], true);
|
|
|
|
openAutomaton('', [], true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const hash = decodeURIComponent(location.hash.slice(1));
|
|
|
|
|
|
|
|
if (AUTOMATONS.hasOwnProperty(hash)) {
|
|
|
|
|
|
|
|
openAutomaton(trUserContent(hash), AUTOMATONS[/** @type {keyof typeof AUTOMATONS} */ (hash)]);
|
|
|
|
|
|
|
|
automatonSelector.setAttribute('hidden', 'hidden');
|
|
|
|
|
|
|
|
app.removeAttribute('hidden');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
backButton.addEventListener('click', () => {
|
|
|
|
backButton.addEventListener('click', () => {
|
|
|
|
app.setAttribute('hidden', 'hidden');
|
|
|
|
app.setAttribute('hidden', 'hidden');
|
|
|
|
automatonSelector.removeAttribute('hidden');
|
|
|
|
automatonSelector.removeAttribute('hidden');
|
|
|
|
|
|
|
|
history.replaceState({}, '', '#');
|
|
|
|
});
|
|
|
|
});
|
|
|
|