yoon2566 commited on
Commit
169cd1a
ยท
verified ยท
1 Parent(s): 98185b4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +89 -18
index.html CHANGED
@@ -1,19 +1,90 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>4000์ž ๋‹จ์œ„ ๋ถ„ํ• ๊ธฐ</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; padding: 20px; }
9
+ textarea { width: 100%; height: 180px; resize: vertical; }
10
+ .chunk { border: 1px solid #ccc; padding: 8px; margin: 8px 0; border-radius: 6px; background: #f9f9f9; }
11
+ pre { margin: 6px 0 0 0; white-space: pre-wrap; word-break: break-word; }
12
+ .toolbar { margin-bottom: 8px; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>4000์ž ๋‹จ์œ„ ๋ถ„ํ• ๊ธฐ</h1>
17
+ <p>ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์•„๋ž˜ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ 4000๊ธ€์ž์”ฉ ๋ถ„ํ• ํ•ฉ๋‹ˆ๋‹ค.</p>
18
+ <div class="toolbar">
19
+ <textarea id="input" placeholder="์—ฌ๊ธฐ์— ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”"></textarea>
20
+ <br/>
21
+ <button id="splitBtn">4000์ž ๋‹จ์œ„๋กœ ๋ถ„ํ• </button>
22
+ <button id="clearBtn" type="button">์ดˆ๊ธฐํ™”</button>
23
+ </div>
24
+ <div id="output" aria-live="polite"></div>
25
+
26
+ <script>
27
+ (function(){
28
+ const input = document.getElementById('input');
29
+ const splitBtn = document.getElementById('splitBtn');
30
+ const clearBtn = document.getElementById('clearBtn');
31
+ const output = document.getElementById('output');
32
+ const CHUNK = 4000;
33
+
34
+ function chunkText(text) {
35
+ // Unicode code points ๋‹จ์œ„๋กœ ์•ˆ์ „ํ•˜๊ฒŒ ๋ถ„ํ• 
36
+ const cps = Array.from(text);
37
+ const chunks = [];
38
+ for (let i = 0; i < cps.length; i += CHUNK) {
39
+ chunks.push(cps.slice(i, i + CHUNK).join(''));
40
+ }
41
+ return chunks;
42
+ }
43
+
44
+ function renderChunks(chunks) {
45
+ output.innerHTML = '';
46
+ if (!chunks.length) return;
47
+ const ol = document.createElement('ol');
48
+ chunks.forEach((chunk, idx) => {
49
+ const li = document.createElement('li');
50
+ li.className = 'chunk';
51
+ const header = document.createElement('div');
52
+ header.style.fontWeight = 'bold';
53
+ header.textContent = `Chunk ${idx + 1} (${chunk.length} chars)`;
54
+ const pre = document.createElement('pre');
55
+ pre.textContent = chunk;
56
+ const copyBtn = document.createElement('button');
57
+ copyBtn.textContent = 'ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌ';
58
+ copyBtn.style.marginLeft = '8px';
59
+ copyBtn.addEventListener('click', async () => {
60
+ try {
61
+ await navigator.clipboard.writeText(chunk);
62
+ copyBtn.textContent = '๋ณต์‚ฌ๋จ';
63
+ setTimeout(() => { copyBtn.textContent = 'ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌ'; }, 1500);
64
+ } catch (e) {
65
+ copyBtn.textContent = '์‹คํŒจ';
66
+ setTimeout(() => { copyBtn.textContent = 'ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌ'; }, 1500);
67
+ }
68
+ });
69
+ li.appendChild(header);
70
+ li.appendChild(pre);
71
+ li.appendChild(copyBtn);
72
+ ol.appendChild(li);
73
+ });
74
+ output.appendChild(ol);
75
+ }
76
+
77
+ splitBtn.addEventListener('click', () => {
78
+ const text = input.value;
79
+ const chunks = chunkText(text);
80
+ renderChunks(chunks);
81
+ });
82
+
83
+ clearBtn.addEventListener('click', () => {
84
+ input.value = '';
85
+ output.innerHTML = '';
86
+ });
87
+ })();
88
+ </script>
89
+ </body>
90
  </html>