CVNSS commited on
Commit
36bb4c8
·
verified ·
1 Parent(s): b551cf1

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +347 -19
index.html CHANGED
@@ -1,19 +1,347 @@
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="vi">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Thư Pháp Leonardo da Vinci</title>
7
+ <!-- Import Renaissance & Royal Fonts -->
8
+ <link href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=Pinyon+Script&family=Cinzel:wght@400;700&display=swap" rel="stylesheet">
9
+
10
+ <!-- Import Libraries for Export -->
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
13
+
14
+ <style>
15
+ :root {
16
+ --paper-color: #e8dcc5; /* Màu giấy da dê (Vellum) đậm đà hơn */
17
+ --ink-color: #2b1d0e; /* Mực nâu đen (Sepia đậm) */
18
+ --gold-accent: #c5a059; /* Màu vàng kim loại cũ */
19
+ --border-color: #5c4033;
20
+ }
21
+
22
+ body {
23
+ background-color: #1a1a1a;
24
+ font-family: 'Segoe UI', sans-serif;
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ padding: 40px 20px;
29
+ gap: 30px;
30
+ margin: 0;
31
+ color: #d4d4d4;
32
+ }
33
+
34
+ h1 {
35
+ color: var(--gold-accent);
36
+ font-family: 'Cinzel', serif; /* Font tiêu đề phong cách La Mã cổ đại */
37
+ font-size: 2.5rem;
38
+ margin: 0;
39
+ text-shadow: 0 2px 4px rgba(0,0,0,0.8);
40
+ letter-spacing: 4px;
41
+ text-transform: uppercase;
42
+ border-bottom: 2px solid var(--gold-accent);
43
+ padding-bottom: 10px;
44
+ }
45
+
46
+ .subtitle {
47
+ color: #888;
48
+ font-size: 0.9rem;
49
+ margin-top: -10px;
50
+ font-style: italic;
51
+ font-family: 'Cinzel', serif;
52
+ }
53
+
54
+ /* --- CONTROLS SECTION --- */
55
+ .controls {
56
+ display: flex;
57
+ gap: 15px;
58
+ margin-bottom: 10px;
59
+ }
60
+
61
+ button {
62
+ padding: 10px 20px;
63
+ border: 1px solid var(--gold-accent);
64
+ background: rgba(0,0,0,0.5);
65
+ color: var(--gold-accent);
66
+ font-family: 'Cinzel', serif;
67
+ cursor: pointer;
68
+ transition: all 0.3s ease;
69
+ text-transform: uppercase;
70
+ letter-spacing: 1px;
71
+ font-size: 0.8rem;
72
+ }
73
+
74
+ button:hover {
75
+ background: var(--gold-accent);
76
+ color: #1a1a1a;
77
+ box-shadow: 0 0 15px var(--gold-accent);
78
+ }
79
+
80
+ /* --- INPUT SECTION --- */
81
+ .input-container {
82
+ width: 700px;
83
+ background: #2a2a2a;
84
+ padding: 25px;
85
+ border: 1px solid #444;
86
+ box-shadow: 0 10px 25px rgba(0,0,0,0.5);
87
+ display: flex;
88
+ flex-direction: column;
89
+ gap: 10px;
90
+ }
91
+
92
+ .input-container label {
93
+ font-weight: bold;
94
+ color: #aaa;
95
+ text-transform: uppercase;
96
+ font-size: 0.75rem;
97
+ letter-spacing: 1px;
98
+ font-family: 'Segoe UI', sans-serif;
99
+ }
100
+
101
+ textarea {
102
+ width: 100%;
103
+ height: 120px;
104
+ padding: 15px;
105
+ border: 1px solid #444;
106
+ background-color: #1f1f1f;
107
+ color: #e0e0e0;
108
+ font-family: 'Segoe UI', sans-serif;
109
+ font-size: 1rem;
110
+ resize: vertical;
111
+ box-sizing: border-box;
112
+ line-height: 1.6;
113
+ }
114
+ textarea:focus {
115
+ outline: none;
116
+ border-color: var(--gold-accent);
117
+ }
118
+
119
+ /* --- LETTER STYLES --- */
120
+ .letter-container {
121
+ width: 800px;
122
+ min-height: 1100px;
123
+ background-color: var(--paper-color);
124
+ position: relative;
125
+ padding: 80px 90px;
126
+ box-sizing: border-box;
127
+ box-shadow: 0 20px 50px rgba(0,0,0,0.8);
128
+
129
+ /* Texture giấy da cũ kỹ (Parchment Texture) */
130
+ background-image: url("data:image/svg+xml,%3Csvg width='300' height='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15' fill='%236b4c35'/%3E%3C/svg%3E");
131
+ }
132
+
133
+ /* Royal Border (Viền Hoàng Gia) */
134
+ .letter-container::before {
135
+ content: "";
136
+ position: absolute;
137
+ top: 20px; left: 20px; right: 20px; bottom: 20px;
138
+ border: 2px solid #5c4033;
139
+ pointer-events: none;
140
+ }
141
+ .letter-container::after {
142
+ content: "";
143
+ position: absolute;
144
+ top: 25px; left: 25px; right: 25px; bottom: 25px;
145
+ border: 1px solid var(--gold-accent);
146
+ pointer-events: none;
147
+ }
148
+
149
+ /* Corner Ornaments (Họa tiết góc) - CSS thuần */
150
+ .corner {
151
+ position: absolute;
152
+ width: 40px; height: 40px;
153
+ border: 2px solid var(--gold-accent);
154
+ z-index: 2;
155
+ }
156
+ .top-left { top: 15px; left: 15px; border-right: none; border-bottom: none; }
157
+ .top-right { top: 15px; right: 15px; border-left: none; border-bottom: none; }
158
+ .bottom-left { bottom: 15px; left: 15px; border-right: none; border-top: none; }
159
+ .bottom-right { bottom: 15px; right: 15px; border-left: none; border-top: none; }
160
+
161
+ .letter-content {
162
+ /* Font Herr Von Muellerhoff rất giống chữ viết tay bay bổng thế kỷ 18 */
163
+ font-family: 'Herr Von Muellerhoff', cursive;
164
+ font-weight: 400;
165
+ font-size: 2.8rem; /* Font này cần size rất to mới đọc được */
166
+ line-height: 1.3;
167
+ color: var(--ink-color);
168
+ position: relative;
169
+ z-index: 1;
170
+ white-space: pre-wrap;
171
+ text-align: left; /* Da Vinci thường viết kín trang */
172
+
173
+ /* Hiệu ứng mực thấm nhẹ */
174
+ text-shadow: 0 0 1px rgba(43, 29, 14, 0.2);
175
+ }
176
+
177
+ /* Drop Cap (Chữ cái đầu dòng lớn) */
178
+ .letter-content::first-letter {
179
+ font-family: 'Pinyon Script', cursive;
180
+ font-size: 5rem;
181
+ float: left;
182
+ margin-right: 10px;
183
+ line-height: 0.8;
184
+ color: #5c4033;
185
+ text-shadow: 1px 1px 0px var(--gold-accent);
186
+ }
187
+
188
+ /* Loading overlay for export */
189
+ #loading {
190
+ display: none;
191
+ position: fixed;
192
+ top: 0; left: 0; width: 100%; height: 100%;
193
+ background: rgba(0,0,0,0.8);
194
+ z-index: 999;
195
+ color: var(--gold-accent);
196
+ justify-content: center;
197
+ align-items: center;
198
+ flex-direction: column;
199
+ font-family: 'Cinzel', serif;
200
+ }
201
+ .spinner {
202
+ width: 40px; height: 40px;
203
+ border: 4px solid var(--gold-accent);
204
+ border-top: 4px solid transparent;
205
+ border-radius: 50%;
206
+ animation: spin 1s linear infinite;
207
+ margin-bottom: 20px;
208
+ }
209
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
210
+
211
+ </style>
212
+ </head>
213
+ <body>
214
+
215
+ <h1>Leonardo's Codex</h1>
216
+ <div class="subtitle">Phong cách Hoàng Gia & Bút tích Da Vinci</div>
217
+
218
+ <!-- EXPORT CONTROLS -->
219
+ <div class="controls">
220
+ <button onclick="exportJPG()">📸 Tải ảnh (JPG)</button>
221
+ <button onclick="exportPDF()">📄 Tải tài liệu (PDF)</button>
222
+ </div>
223
+
224
+ <!-- INPUT SECTION -->
225
+ <div class="input-container">
226
+ <label for="letterInput">✎ Nội dung thư (Nhập vào đây):</label>
227
+ <textarea id="letterInput" spellcheck="false">Hod Chij Mihp, wayl 12 thagj 12 namo 2025
228
+
229
+ Thayd Bihl cihj menb,
230
+
231
+ Homy nay voix em thatf suh lal motf wayl ratb koj qeny. Wayl 12 thagj 12 – wayl mal zuh anj AI em laml zuah treny nend tagz CVNSS4.0 cujb cugl cugs “chaol doik”. Em camz jac jogb nhuo mihl vuak holl thahl dush motf diwd jil doj lonx lamx, thux mal trusx dayy em chiz zamj wis chux kogy zamj tin lal mihl ses laml dush. Vuak ved denb nhal lal em wis way denb thayd, neny em mulb vidb lild cho thayd laj thuo nayl.
232
+
233
+ Zaor nayl thayd coj koez kogy ar? Em vang hay nhox mayb tidb hocr thayd dugx lopx – luc naol cugs wivy mal lair amb ap, kilb tuir em kogy bao jok zamj lujk. Lopx hocr sihp namo nay thayd chuz nhivf coj wolp kogy thayd? Em dolj chacx lal cugs “qayf vuak duz” deq thayd faiz cujk, jogb tuir em hoid xuao.
234
+
235
+ Conl ja dihl thayd, em hi vogr moir wujk deud mahr koez. Chir Bikj chacx jok das vaol dugj woiy truzk Dair hocr chir ayb thikj roid faiz kogy thayd? Bej Cily thil chacx sapx vaol Tiwq hocr – em dolj lal bej ses jogb thayd, thogy mihp val hild.
236
+
237
+ Conl em, thayd ily tamy, em vang onq val vang dagp cob gagx tugk chut motf. Leny lopx cao roid, bail nhiwd val koj hono nhiwd, coj nhugw luc em metf denb mucx chiz mulb boz cusf. Nhugo moig land nhox lair loik thayd zayr – dach bidf lal cauy “bidb mihl sai ov dauy, suav dush thil ses joiz leny” – em lair tuh nhacx mihl kogy dush nanz. Nhok vayf mal mayb namo qa em vang juw dush zahp hiwf hocr sihp joiz ar.
238
+
239
+ Caij zuh anj AI em vuak holl thahl cugs vayf. Coj luc em tuzv hogz luly roid. Nhugo roid em nhox denb nhugw land thayd baoz “cux thuv di, sai roid laml lair”, theb lal em lair tifb tucr mayl mol. Val cujb cugl, zuh anj AI zuah treny nend tagz CVNSS4.0-AI cugs holl thilf. Noj jogb nhuo motf zaub mocb cho thayb loik thayd zayr vang theo em denb tanf bayy jok.
240
+
241
+ Sapx toix, em ses cob gagx nhiwd hono nuaw deq coj theq thi vaol truzk chyly mal em moo usx. Em mulb thayd ily tamy lal em vang dagp cob gagx tugk busx, kogy boz cusf juaw chugk.
242
+
243
+ Em xin zugk but tair dayy. Em chuc thayd thatf nhiwd sucx koez, cogy visf jagz zayr luly thalf loih val tranl wapf nivd vui.
244
+
245
+ Hocr trol cuaz thayd,
246
+ L.AI Zemo 1.0
247
+ Wylg Huzo L.AI</textarea>
248
+ </div>
249
+
250
+ <!-- LETTER DISPLAY -->
251
+ <div id="capture-target" class="letter-container">
252
+ <!-- Corner Ornaments -->
253
+ <div class="corner top-left"></div>
254
+ <div class="corner top-right"></div>
255
+ <div class="corner bottom-left"></div>
256
+ <div class="corner bottom-right"></div>
257
+
258
+ <div class="letter-content"></div>
259
+ </div>
260
+
261
+ <!-- Loading Screen -->
262
+ <div id="loading">
263
+ <div class="spinner"></div>
264
+ <div>Đang xử lý bút tích...</div>
265
+ </div>
266
+
267
+ <script>
268
+ const input = document.getElementById('letterInput');
269
+ const output = document.querySelector('.letter-content');
270
+ const loading = document.getElementById('loading');
271
+
272
+ // Hàm render text
273
+ function renderLetter() {
274
+ output.innerText = input.value;
275
+ }
276
+
277
+ // Render ban đầu
278
+ renderLetter();
279
+
280
+ // Cập nhật khi gõ
281
+ input.addEventListener('input', renderLetter);
282
+
283
+ // --- EXPORT FUNCTIONS ---
284
+
285
+ async function exportJPG() {
286
+ showLoading(true);
287
+ const element = document.getElementById('capture-target');
288
+ try {
289
+ // Tạo canvas từ HTML
290
+ const canvas = await html2canvas(element, {
291
+ scale: 2, // Tăng độ nét
292
+ backgroundColor: null, // Giữ màu nền trong suốt nếu có
293
+ useCORS: true
294
+ });
295
+
296
+ // Tải xuống
297
+ const link = document.createElement('a');
298
+ link.download = 'Thu_Phap_DaVinci.jpg';
299
+ link.href = canvas.toDataURL('image/jpeg', 0.9);
300
+ link.click();
301
+ } catch (err) {
302
+ console.error("Lỗi xuất ảnh:", err);
303
+ alert("Không thể xuất ảnh. Vui lòng thử lại.");
304
+ }
305
+ showLoading(false);
306
+ }
307
+
308
+ async function exportPDF() {
309
+ showLoading(true);
310
+ const element = document.getElementById('capture-target');
311
+ try {
312
+ // Tạo canvas trước
313
+ const canvas = await html2canvas(element, {
314
+ scale: 2,
315
+ useCORS: true
316
+ });
317
+
318
+ const imgData = canvas.toDataURL('image/jpeg', 0.9);
319
+ const { jsPDF } = window.jspdf;
320
+
321
+ // Khổ A4 (210mm x 297mm) hoặc theo tỷ lệ ảnh
322
+ // Ở đây ta dùng khổ tùy chỉnh theo kích thước ảnh để không bị cắt
323
+ const imgWidth = 210; // mm (A4 width)
324
+ const pageHeight = 297; // mm (A4 height)
325
+ const imgHeight = canvas.height * imgWidth / canvas.width;
326
+
327
+ const pdf = new jsPDF('p', 'mm', 'a4');
328
+
329
+ // Nếu ảnh dài hơn A4, tự động chia trang hoặc co lại?
330
+ // Ở đây ta co lại cho vừa 1 trang (fit to page) nếu cần, hoặc in dài
331
+ // Để đơn giản cho thư tay, ta in 1 trang dài
332
+
333
+ pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
334
+ pdf.save('Thu_Phap_DaVinci.pdf');
335
+ } catch (err) {
336
+ console.error("Lỗi xuất PDF:", err);
337
+ alert("Không thể xuất PDF. Vui lòng thử lại.");
338
+ }
339
+ showLoading(false);
340
+ }
341
+
342
+ function showLoading(show) {
343
+ loading.style.display = show ? 'flex' : 'none';
344
+ }
345
+ </script>
346
+ </body>
347
+ </html>