-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (47 loc) · 1.62 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>대화 분석 웹 페이지</title>
<style>
/* 여기에 CSS 스타일 삽입 */
</style>
</head>
<body>
<div id="app">
<textarea id="inputText" rows="10" cols="30"></textarea>
<button onclick="parseText()">분석하기</button>
<select id="userSelect">
<option value="all">전체</option>
</select>
<div id="output"></div>
</div>
<script>
// 여기에 JavaScript 코드 삽입
function parseText() {
const lines = document.getElementById('inputText').value.split(/\r?\n/);
const users = new Set();
lines.forEach((line, index) => {
const parts = line.split('] ');
// 구성원 추출
if (parts.length === 3 && !users.has(parts[0])) {
users.add(parts[0]);
const option = document.createElement('option');
option.value = parts[0];
option.text = parts[0];
document.getElementById('userSelect').add(option);
}
});
document.getElementById('userSelect').addEventListener('change', function() {
const selectedUser = this.value;
const filteredLines = lines.filter(line => {
return line.startsWith(selectedUser) || selectedUser === 'all';
});
document.getElementById('output').innerHTML = filteredLines.join('<br>');
});
document.getElementById('userSelect').dispatchEvent(new Event('change'));
}
</script>
</body>
</html>