File size: 16,796 Bytes
36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 aef225a 36bb4c8 |
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thư Pháp Leonardo da Vinci - Royal Edition</title>
<!-- Import Renaissance & Royal Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=Pinyon+Script&family=Cinzel:wght@400;700&display=swap" rel="stylesheet">
<!-- Import Libraries for Export -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<style>
:root {
--paper-color: #f3e5ab; /* Màu giấy da dê sáng hơn, sang trọng hơn */
--paper-texture: #e6d69c;
--ink-color: #3b2518; /* Mực nâu đậm (Sepia) */
--gold-accent: #d4af37; /* Vàng kim loại chuẩn Royal */
--gold-dark: #aa8c2c;
--bg-color: #1a0f0a; /* Nền gỗ tối màu */
--red-seal: #8a1c1c; /* Màu sáp đỏ */
}
body {
background-color: var(--bg-color);
/* Họa tiết nền tối giản sang trọng */
background-image: radial-gradient(circle at center, #2a1f1a 0%, #0d0502 100%);
font-family: 'Cinzel', serif;
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 20px;
gap: 30px;
margin: 0;
color: #d4d4d4;
min-height: 100vh;
}
/* --- HEADER --- */
header {
text-align: center;
border-bottom: 1px solid var(--gold-dark);
padding-bottom: 20px;
width: 100%;
max-width: 800px;
position: relative;
}
header::after {
content: "♕";
display: block;
font-size: 2rem;
color: var(--gold-accent);
margin-top: 10px;
text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}
h1 {
color: var(--gold-accent);
font-size: 3rem;
margin: 0;
text-shadow: 2px 2px 4px #000;
letter-spacing: 6px;
text-transform: uppercase;
font-weight: 400;
}
.subtitle {
color: #8f8f8f;
font-size: 0.9rem;
margin-top: 5px;
font-style: italic;
letter-spacing: 2px;
}
/* --- CONTROLS SECTION --- */
.controls {
display: flex;
gap: 20px;
margin-bottom: 10px;
z-index: 10;
}
button {
padding: 12px 25px;
border: 1px solid var(--gold-dark);
background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%);
color: var(--gold-accent);
font-family: 'Cinzel', serif;
cursor: pointer;
transition: all 0.3s ease;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 0.8rem;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0,0,0,0.5);
border-radius: 2px;
}
button:hover {
background: linear-gradient(180deg, var(--gold-accent) 0%, var(--gold-dark) 100%);
color: #1a0f0a;
box-shadow: 0 0 15px var(--gold-accent);
border-color: #fff;
}
/* --- INPUT SECTION --- */
.input-container {
width: 800px;
background: rgba(30, 25, 20, 0.9);
padding: 20px;
border: 1px solid #444;
border-top: 3px solid var(--gold-dark);
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
display: flex;
flex-direction: column;
gap: 10px;
box-sizing: border-box;
}
.input-container label {
color: var(--gold-accent);
font-size: 0.8rem;
letter-spacing: 1px;
}
textarea {
width: 100%;
height: 100px;
padding: 15px;
border: 1px solid #333;
background-color: #121212;
color: #e0e0e0;
font-family: 'Segoe UI', sans-serif;
font-size: 1rem;
resize: vertical;
box-sizing: border-box;
line-height: 1.6;
border-left: 2px solid var(--gold-dark);
}
textarea:focus {
outline: none;
background-color: #1a1a1a;
border-color: var(--gold-accent);
}
/* --- LETTER STYLES --- */
.letter-wrapper {
position: relative;
padding: 20px;
background: #222; /* Bóng đổ giả lập mặt bàn */
box-shadow: 0 20px 50px rgba(0,0,0,0.9);
border-radius: 2px;
}
.letter-container {
width: 800px;
min-height: 1100px;
background-color: var(--paper-color);
position: relative;
padding: 90px 100px;
box-sizing: border-box;
overflow: hidden;
/* Texture giấy da dê cao cấp */
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.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.12' fill='%238b5e3c'/%3E%3C/svg%3E"),
linear-gradient(to bottom right, rgba(255,255,255,0.4), rgba(0,0,0,0.1));
box-shadow: inset 0 0 80px rgba(60, 40, 20, 0.3); /* Vignette mép giấy */
}
/* Royal Border (Viền Hoàng Gia) */
.border-frame {
position: absolute;
top: 25px; left: 25px; right: 25px; bottom: 25px;
border: 2px solid #5c4033;
pointer-events: none;
z-index: 2;
}
.border-inner {
position: absolute;
top: 32px; left: 32px; right: 32px; bottom: 32px;
border: 1px solid var(--gold-dark);
pointer-events: none;
z-index: 2;
}
/* Corner Ornaments */
.corner {
position: absolute;
width: 50px; height: 50px;
background-size: contain;
background-repeat: no-repeat;
opacity: 0.8;
z-index: 3;
}
/* Sử dụng CSS Gradient để vẽ hoa văn góc đơn giản */
.corner::before {
content: "";
position: absolute;
width: 100%; height: 100%;
border: 3px double var(--gold-dark);
}
.top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; transform: rotate(90deg); }
.bottom-left { bottom: 20px; left: 20px; border-right: none; border-bottom: none; transform: rotate(-90deg); }
.bottom-right { bottom: 20px; right: 20px; border-left: none; border-bottom: none; transform: rotate(180deg); }
.letter-content {
font-family: 'Herr Von Muellerhoff', cursive;
font-weight: 400;
font-size: 2.6rem;
line-height: 1.4;
color: var(--ink-color);
position: relative;
z-index: 5;
white-space: pre-wrap;
text-align: justify;
/* Hiệu ứng mực loang nhẹ & không đều màu */
text-shadow: 0 0 1px rgba(59, 37, 24, 0.3);
filter: contrast(1.1);
}
/* Drop Cap Royal */
.letter-content::first-letter {
font-family: 'Pinyon Script', cursive;
font-size: 6.5rem;
float: left;
margin-right: 15px;
margin-top: -10px;
line-height: 0.8;
color: var(--red-seal); /* Dropcap màu đỏ son */
text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}
/* Wax Seal (Con dấu sáp) */
.wax-seal {
position: absolute;
bottom: 60px;
right: 60px;
width: 120px;
height: 120px;
background: radial-gradient(circle at 30% 30%, #b03030, #8a1c1c, #520e0e);
border-radius: 50%;
box-shadow: 3px 3px 10px rgba(0,0,0,0.4), inset -2px -2px 10px rgba(0,0,0,0.3);
display: flex;
align-items: center;
justify-content: center;
color: rgba(0,0,0,0.3);
border: 4px dashed rgba(0,0,0,0.1);
z-index: 4;
transform: rotate(-15deg);
}
.wax-seal::after {
content: "ROYAL";
font-family: 'Cinzel', serif;
font-weight: 700;
font-size: 1.2rem;
color: rgba(255,255,255,0.2);
text-shadow: -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(255,255,255,0.1);
}
.wax-inner-ring {
position: absolute;
width: 80%; height: 80%;
border: 2px solid rgba(0,0,0,0.2);
border-radius: 50%;
}
/* Loading overlay */
#loading {
display: none;
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.9);
z-index: 999;
color: var(--gold-accent);
justify-content: center;
align-items: center;
flex-direction: column;
font-family: 'Cinzel', serif;
letter-spacing: 2px;
}
.spinner {
width: 50px; height: 50px;
border: 3px solid rgba(212, 175, 55, 0.3);
border-top: 3px solid var(--gold-accent);
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
</style>
</head>
<body>
<header>
<h1>Leonardo's Codex</h1>
<div class="subtitle">Royal Edition • XVI Century Style</div>
</header>
<!-- EXPORT CONTROLS -->
<div class="controls">
<button onclick="exportJPG()">📸 Lưu Ảnh (JPG)</button>
<button onclick="exportPDF()">📜 Xuất Văn Bản (PDF)</button>
</div>
<!-- INPUT SECTION -->
<div class="input-container">
<label for="letterInput">✎ Nội dung bút tích (Sẽ hiển thị tự động bên dưới):</label>
<textarea id="letterInput" spellcheck="false">Hod Chij Mihp, wayl 12 thagj 12 namo 2025
Thayd Bihl cihj menb,
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.
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.
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.
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.
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.
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.
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.
Hocr trol cuaz thayd,
L.AI Zemo 1.0
Wylg Huzo L.AI</textarea>
</div>
<!-- LETTER DISPLAY -->
<div class="letter-wrapper">
<div id="capture-target" class="letter-container">
<!-- Borders -->
<div class="border-frame"></div>
<div class="border-inner"></div>
<!-- Corner Ornaments -->
<div class="corner top-left"></div>
<div class="corner top-right"></div>
<div class="corner bottom-left"></div>
<div class="corner bottom-right"></div>
<!-- Content -->
<div class="letter-content"></div>
<!-- Wax Seal -->
<div class="wax-seal">
<div class="wax-inner-ring"></div>
</div>
</div>
</div>
<!-- Loading Screen -->
<div id="loading">
<div class="spinner"></div>
<div>Đang niêm phong văn bản...</div>
</div>
<script>
const input = document.getElementById('letterInput');
const output = document.querySelector('.letter-content');
const loading = document.getElementById('loading');
// Hàm render text
function renderLetter() {
output.innerText = input.value;
}
// Render ban đầu
renderLetter();
// Cập nhật khi gõ
input.addEventListener('input', renderLetter);
// --- EXPORT FUNCTIONS ---
async function exportJPG() {
showLoading(true);
const element = document.getElementById('capture-target');
try {
// Tạo canvas từ HTML
const canvas = await html2canvas(element, {
scale: 2, // Tăng độ nét
backgroundColor: null, // Giữ màu nền trong suốt nếu có
useCORS: true,
logging: false
});
// Tải xuống
const link = document.createElement('a');
link.download = 'Hoang_Gia_DaVinci.jpg';
link.href = canvas.toDataURL('image/jpeg', 0.9);
link.click();
} catch (err) {
console.error("Lỗi xuất ảnh:", err);
alert("Không thể xuất ảnh. Vui lòng thử lại.");
}
showLoading(false);
}
async function exportPDF() {
showLoading(true);
const element = document.getElementById('capture-target');
try {
// Tạo canvas trước
const canvas = await html2canvas(element, {
scale: 2,
useCORS: true,
logging: false
});
const imgData = canvas.toDataURL('image/jpeg', 0.9);
const { jsPDF } = window.jspdf;
// Khổ A4 (210mm x 297mm)
const pdf = new jsPDF('p', 'mm', 'a4');
const imgWidth = 210;
const imgHeight = canvas.height * imgWidth / canvas.width;
// Căn chỉnh nếu dài quá khổ A4 thì in trang dài hoặc fit
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
pdf.save('Hoang_Gia_DaVinci.pdf');
} catch (err) {
console.error("Lỗi xuất PDF:", err);
alert("Không thể xuất PDF. Vui lòng thử lại.");
}
showLoading(false);
}
function showLoading(show) {
loading.style.display = show ? 'flex' : 'none';
}
</script>
</body>
</html> |