-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathview.html
More file actions
32 lines (30 loc) · 919 Bytes
/
view.html
File metadata and controls
32 lines (30 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Seed</title>
</head>
<body>
<script src="/third_party/bundle.min.js"></script>
<script src="/js/core.js"></script>
<script>
if (!document.location.search.startsWith('?id=')) {
throw new Error('No sketch ID');
}
const sketchId = document.location.search.substring(4);
console.log(sketchId);
async function loadSketch(id) {
const res = await fetch(`https://emrg-pcg.firebaseio.com/sketch/${id}.json`);
const json = await res.json();
const phraseBook = await parsePhraseBook(json.source, loadSketch);
return phraseBook;
}
(async() => {
const phraseBook = await loadSketch(sketchId);
const result = generateString(phraseBook, 'root', {}, 'ABC');
console.log(result);
document.write(result);
})();
</script>
</body>
</html>