forked from caub/pg-tsquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (66 loc) · 1.25 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
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<title>pg-tsquery</title>
<style>
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: sans-serif;
font-size: 24px;
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
background: #eee;
}
h1 {
text-align: center;
}
h1 a {
text-decoration: none;
color: inherit;
}
main {
flex: 1;
display: flex;
}
main > * {
flex: 1;
padding: 6px;
}
textarea {
resize: none;
font-family: sans-serif;
font-size: 24px;
background: transparent;
}
</style>
</head>
<body>
<header>
<h1><a href="https://github.com/caub/pg-tsquery">pg-tsquery</a></h1>
</header>
<main>
<textarea id="input" placeholder="Write your input">Write any* you want like (this, that or -zulu). It's cool no?</textarea>
<output id="output">...</output>
</main>
<script>
(async () => {
let text = await fetch('./index.js').then(r=>r.text());
text = text.replace('module.exports = ', 'export default ');
const {default: Tsquery} = await import(URL.createObjectURL(new Blob([text], {type: 'application/javascript'})));
const tsquery = Tsquery({singleQuoteReplacement: '&'});
function update() {
output.innerText = tsquery(input.value);
}
update();
input.oninput = update;
})();
</script>
</body>
</html>