forked from detailyang/nginx-location-match-visible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (23 loc) · 778 Bytes
/
index.js
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
'use strict'
const tree = require('./tree');
// begin
const canvas = document.getElementById('tree');
const ctx = canvas.getContext('2d');
const goDom = document.getElementById('go');
const uriDom = document.getElementById('uri');
const confDom = document.getElementById('conf');
goDom.onclick = () => {
const uri = uriDom.value;
const conf = confDom.value;
if (!uri.length) {
alert(`please input uri you want to match like "/abcd"`);
return;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
const node = tree.render(ctx, uri, conf);
if (node == null) {
return alert(`do not match the uri ${uri}`);
}
alert(`your uri ${uri} => ${tree.unserialize(node)}`);
}
const node = tree.render(ctx, '/abc', confDom.value);