forked from browserengineering/book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabN-browser.html
36 lines (32 loc) · 1.22 KB
/
labN-browser.html
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
33
34
35
36
<!doctype html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="widget.css" />
<form id="controls">
<fieldset id="step-controls">
<h1>The Chapter $chapter$ Browser</h1>
<button class="reset left" disabled><span>Restart</span></button>
<button class="stepf right"><span>Go</span></button>
</fieldset>
<fieldset id="input-controls">
<kbd>https://browser.engineering/<input id="input" class="continue" type="url" value="$name$.html" /></kbd>
</fieldset>
</form>
<figure id="widget">
<canvas id="canvas" width="352" height="160"></canvas>
</figure>
<script type="module" src="rt.js"></script>
<script type="module" src="lab$chapter$.js"></script>
<script type="module">
import { rt_constants, Widget } from "./rt.js";
import { Browser, constants } from "./lab$chapter$.js";
rt_constants.TKELEMENT = document.querySelector("#canvas");
let widget = new Widget(document.querySelector("#controls"));
widget.run(async function() {
constants.WIDTH = window.innerWidth;
let url = "https://browser.engineering/" + document.getElementById("input").value;
let b = await (new Browser()).init();
await b.load(url)
});
widget.next();
</script>