-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
59 lines (53 loc) · 1.74 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css" />
<!-- <script type="module" src="/src/main.js"></script> -->
<script src="/dist/zjax.min.js"></script>
<!-- <script src="//unpkg.com/zjax@2.0.3"></script> -->
<script src="/src/ui.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
zjax.errors = {
404($) {
alert("not found");
},
500($) {
alert("ERRRRRROR!");
},
// catchAll($) {
// $.redirect("/other");
// },
};
});
</script>
<!-- <script>
document.addEventListener("DOMContentLoaded", () => {
zjax.debug = true;
zjax.actions = {
ui: {
alert() {
alert("You clicked the b key.");
},
gotoFacebook($) {
$.redirect("https://facebook.com");
},
},
};
});
</script> -->
</head>
<body>
<form action="./submit" z-swap="@submit *">
<input type="text" name="name" z-action="@input $('h1').innerText = $().value || ''" />
<input id="phone" type="text" name="phone" />
<button type="submit">Go</button>
</form>
<button z-swap="@click /test-500 img" style="margin: 4rem">Do It</button>
<h1 z-action="@click ui.alert">This is Zjax</h1>
<h1 z-swap="@click /other.html h1">Index</h1>
<a href="https://httpbin.org/html" z-swap="@mount.delay.2s p">Fetch Moby Dick</a>
<p id="bkey" z-action="@keydown.window.meta.b alert">This will be replaced by Zjax.</p>
<p z-action="@[keydown.window.any] console.log('you pressed:', $.event.key)">test keys</p>
</body>
</html>