-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.html
108 lines (95 loc) · 2.21 KB
/
test.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
@font-face {
font-family: dalmoori-old;
src: url('./previous/dalmoori.woff2');
}
@font-face {
font-family: dalmoori-new;
src: url('./generator/build/font/dalmoori.woff2');
}
html,
body {
padding: 0;
margin: 0;
}
* {
box-sizing: border-box;
}
#input {
font-size: 1rem;
resize: none;
width: calc(100vw - 2 * 4rem);
margin: 4rem;
margin-bottom: 2rem;
padding-bottom: 0.2rem;
}
#old {
font-family: dalmoori-old;
margin: 2rem 2rem 4rem 4rem;
}
#new {
font-family: dalmoori-new;
margin: 2rem 4rem 4rem 2rem;
}
#old,
#new {
font-size: 2rem;
border: 1px solid black;
}
#pane {
display: grid;
grid-template-columns: 1fr 1fr;
}
.replaced {
color: #ff4488;
}
</style>
</head>
<body>
<textarea id="input">
r#why r#we r#wanting of r#waters
r#Æ
즈r#믄 해 동안 r#튼튼하던
슬r#픈 생각 r#든 때
r#뜬 구름 잡는 소리r#는 그만
r#은혜 갚은 까치
r#롤린r#롤린r#롤린r#룔
家甲客更骨吉
女年
來冷立
末木未
法別本北
三生十
品
合活
</textarea>
<div id="pane">
<div id="old"></div>
<div id="new"></div>
</div>
</body>
<script>
const $input = document.getElementById('input');
const $old = document.getElementById('old');
const $new = document.getElementById('new');
function update() {
$input.style.height = 'auto';
$input.style.height = `${$input.scrollHeight + 4}px`;
const html = $input.value
.replace(/r#(.)/g, (_, [a]) => `<span class="replaced">${a}</span>`)
.replace(/\n/g, '<br />');
$old.innerHTML = html;
$new.innerHTML = html;
}
$input.value = $input.value.trim();
$input.addEventListener('input', update);
update();
</script>
</html>