-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
jsbox.code.js
54 lines (51 loc) · 1.62 KB
/
jsbox.code.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
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
window.jsboxCode = {
lib: 'https://fastly.jsdelivr.net/npm/cnchar-all/cnchar.all.min.js',
lang: 'html',
code: /* html */`<style>
#cnchar-area{
line-height: 30px;
}
</style>
<div id='draw-area'></div>
<div id='cnchar-area'></div>
<script>
var drawArea = document.getElementById('draw-area');
drawArea.innerHTML = '';
var option = {
clear: false,
el: drawArea,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 60
}
};
option.type = cnchar.draw.TYPE.NORMAL;
cnchar.draw('你好', option);
option.type = cnchar.draw.TYPE.STROKE;
cnchar.draw('汉字', option);
option.type = cnchar.draw.TYPE.ANIMATION;
cnchar.draw('很酷', option);
var res = [
cnchar.version,
cnchar.stroke('你好', 'order', 'shape'),
cnchar.stroke('长城', 'order', 'name'),
cnchar.orderToWord(['横', '撇', '捺']),
cnchar.convert.simpleToTrad('中国长城'),
cnchar.convert.tradToSimple('漢字'),
'美好的地方'.spell('tone'),
'长大了'.spell(),
'长大了'.spell('poly'),
cnchar.strokeToWord(25, 'simple'),
cnchar.idiom(['五', '', '十', '']),
cnchar.xhy('大水冲了龙王庙'),
cnchar.radical('你好呀'),
cnchar.sortSpell(['张三', '张大','李四','王五']),
cnchar.sortStroke(['你', '好', '呀']),
cnchar.isCnChar('A'),
JSON.stringify(cnchar.spellInfo('Hàn')),
]
document.getElementById('cnchar-area').innerText = res.join('\\n');
console.log(res);
</script>`
};