Spaces:
Running
Running
File size: 58,879 Bytes
d2afab9 141728f d2afab9 c9ecd1a d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 141728f d2afab9 c9ecd1a d2afab9 c9ecd1a d2afab9 c9ecd1a d2afab9 | 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 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TieReader - Complete Reader with My Store</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Crimson+Text:wght@400;600&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #2563eb;
--secondary-color: #1e40af;
--accent-color: #3b82f6;
--background-color: #ffffff;
--text-color: #1f2937;
--border-color: #e5e7eb;
--sidebar-bg: #f8fafc;
--reading-bg: #fefefe;
--audio-bar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
[data-theme="dark"] {
--primary-color: #3b82f6;
--secondary-color: #1e40af;
--accent-color: #60a5fa;
--background-color: #111827;
--text-color: #f9fafb;
--border-color: #374151;
--sidebar-bg: #1f2937;
--reading-bg: #111827;
}
[data-theme="sepia"] {
--primary-color: #92400e;
--secondary-color: #78350f;
--accent-color: #b45309;
--background-color: #f7f3e9;
--text-color: #5d4037;
--border-color: #d7ccc8;
--sidebar-bg: #efebe9;
--reading-bg: #faf6f0;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--background-color);
color: var(--text-color);
transition: all 0.3s ease;
margin: 0;
padding: 0;
overflow-x: hidden;
}
.app-container {
display: flex;
height: 100vh;
position: relative;
}
.sidebar {
width: 300px;
background-color: var(--sidebar-bg);
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
z-index: 100;
}
.sidebar.collapsed {
transform: translateX(-100%);
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding-bottom: 120px;
}
.header {
background-color: var(--background-color);
border-bottom: 1px solid var(--border-color);
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
}
.reading-area {
flex: 1;
overflow-y: auto;
padding: 2rem;
background-color: var(--reading-bg);
font-family: 'Crimson Text', serif;
line-height: 1.8;
font-size: 18px;
}
.book-content {
max-width: 800px;
margin: 0 auto;
}
.book-content h1, .book-content h2, .book-content h3 {
color: var(--primary-color);
margin-top: 2rem;
margin-bottom: 1rem;
}
.book-content p {
margin-bottom: 1.5rem;
text-align: justify;
}
.highlight-word {
background-color: rgba(59, 130, 246, 0.3);
border-radius: 2px;
transition: background-color 0.2s ease;
}
.book-content img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin: 1rem 0;
cursor: pointer;
transition: transform 0.3s ease;
}
.book-content img:hover {
transform: scale(1.02);
}
.toc-panel {
background-color: var(--sidebar-bg);
border-left: 1px solid var(--border-color);
width: 280px;
overflow-y: auto;
transition: transform 0.3s ease;
}
.toc-panel.collapsed {
transform: translateX(100%);
}
.toc-item {
padding: 0.75rem 1rem;
cursor: pointer;
border-bottom: 1px solid var(--border-color);
transition: background-color 0.2s ease;
}
.toc-item:hover {
background-color: var(--accent-color);
color: white;
}
.toc-item.active {
background-color: var(--primary-color);
color: white;
}
.audio-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: var(--audio-bar-bg);
backdrop-filter: blur(10px);
border-radius: 15px 15px 0 0;
padding: 15px 20px;
box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
z-index: 1000;
display: none;
}
.audio-bar.active {
display: block;
}
.audio-controls {
display: flex;
align-items: center;
justify-content: space-between;
gap: 15px;
}
.audio-btn {
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 50%;
width: 48px;
height: 48px;
display: flex;
align-items: center;
justify-content: center;
color: white;
cursor: pointer;
transition: all 0.3s ease;
}
.audio-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.1);
}
.audio-btn.play {
width: 60px;
height: 60px;
background: rgba(255, 255, 255, 0.3);
}
.audio-progress {
flex: 1;
margin: 0 20px;
}
.progress-bar {
width: 100%;
height: 6px;
background: rgba(255, 255, 255, 0.2);
border-radius: 3px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: white;
width: 0%;
transition: width 0.3s ease;
}
.audio-info {
color: white;
font-size: 14px;
margin-top: 5px;
display: flex;
justify-content: space-between;
}
.library-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1.5rem;
padding: 1rem;
}
.book-card {
background-color: var(--background-color);
border: 1px solid var(--border-color);
border-radius: 12px;
overflow: hidden;
transition: all 0.3s ease;
cursor: pointer;
}
.book-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.book-cover {
width: 100%;
height: 250px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 48px;
}
.book-info {
padding: 1rem;
}
.book-title {
font-weight: 600;
margin-bottom: 0.5rem;
}
.book-author {
color: #6b7280;
font-size: 14px;
}
.book-actions {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
}
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
}
.btn-secondary {
background-color: #6b7280;
color: white;
}
.btn-success {
background-color: #059669;
color: white;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.nav-tabs {
display: flex;
border-bottom: 1px solid var(--border-color);
}
.nav-tab {
padding: 1rem 1.5rem;
cursor: pointer;
border-bottom: 3px solid transparent;
transition: all 0.3s ease;
}
.nav-tab.active {
border-bottom-color: var(--primary-color);
color: var(--primary-color);
}
.image-viewer {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.9);
display: none;
align-items: center;
justify-content: center;
z-index: 2000;
}
.image-viewer.active {
display: flex;
}
.image-viewer img {
max-width: 90%;
max-height: 90%;
object-fit: contain;
}
.image-controls {
position: absolute;
top: 20px;
right: 20px;
display: flex;
gap: 10px;
}
.image-btn {
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.settings-panel {
position: fixed;
top: 0;
right: 0;
width: 350px;
height: 100vh;
background-color: var(--sidebar-bg);
border-left: 1px solid var(--border-color);
transform: translateX(100%);
transition: transform 0.3s ease;
z-index: 1500;
overflow-y: auto;
}
.settings-panel.active {
transform: translateX(0);
}
.settings-section {
padding: 1.5rem;
border-bottom: 1px solid var(--border-color);
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.slider {
width: 100%;
margin: 0.5rem 0;
}
.search-bar {
width: 100%;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 8px;
background-color: var(--background-color);
color: var(--text-color);
}
@media (max-width: 768px) {
.sidebar {
position: fixed;
top: 0;
left: 0;
height: 100vh;
z-index: 200;
}
.toc-panel {
position: fixed;
top: 0;
right: 0;
height: 100vh;
z-index: 200;
}
.main-content {
width: 100%;
}
.reading-area {
padding: 1rem;
}
.audio-bar {
padding: 12px 15px;
border-radius: 12px 12px 0 0;
}
.audio-btn {
width: 40px;
height: 40px;
}
.audio-btn.play {
width: 50px;
height: 50px;
}
}
</style>
</head>
<body data-theme="light">
<div class="app-container">
<!-- Sidebar -->
<div class="sidebar" id="sidebar">
<div class="p-4 border-b border-gray-200">
<h2 class="text-xl font-bold text-gray-800">TieReader</h2>
<p class="text-sm text-gray-600">Multi-Format Book Reader</p>
</div>
<div class="nav-tabs">
<div class="nav-tab active" onclick="switchTab('library')">
<i class="fas fa-book mr-2"></i>Library
</div>
<div class="nav-tab" onclick="switchTab('mystore')">
<i class="fas fa-store mr-2"></i>My Store
</div>
</div>
<div class="p-4">
<input type="text" class="search-bar" placeholder="Search books..." id="searchInput" onkeyup="searchBooks()">
</div>
<div class="p-4 space-y-2">
<label class="btn btn-primary w-full cursor-pointer">
<i class="fas fa-upload mr-2"></i>Import Books
<input type="file" multiple accept=".tie,.epub" style="display: none;" onchange="handleFileImport(event)">
</label>
</div>
<!-- Library Content -->
<div id="libraryContent" class="flex-1 overflow-y-auto">
<div class="library-grid">
<!-- Sample Books -->
<div class="book-card" data-book-id="sample1">
<div class="book-cover">
<i class="fas fa-book-open"></i>
</div>
<div class="book-info">
<div class="book-title">The Great Adventure</div>
<div class="book-author">by John Smith</div>
<div class="book-actions">
<button class="btn btn-primary" onclick="openBook('sample1')">
<i class="fas fa-eye mr-1"></i>Read
</button>
<button class="btn btn-success" onclick="addToMyStore('sample1')">
<i class="fas fa-plus mr-1"></i>Add
</button>
</div>
</div>
</div>
<div class="book-card" data-book-id="sample2">
<div class="book-cover">
<i class="fas fa-dragon"></i>
</div>
<div class="book-info">
<div class="book-title">Digital Mysteries</div>
<div class="book-author">by Sarah Johnson</div>
<div class="book-actions">
<button class="btn btn-primary" onclick="openBook('sample2')">
<i class="fas fa-eye mr-1"></i>Read
</button>
<button class="btn btn-success" onclick="addToMyStore('sample2')">
<i class="fas fa-plus mr-1"></i>Add
</button>
</div>
</div>
</div>
<div class="book-card" data-book-id="sample3">
<div class="book-cover">
<i class="fas fa-rocket"></i>
</div>
<div class="book-info">
<div class="book-title">Space Odyssey</div>
<div class="book-author">by Michael Chen</div>
<div class="book-actions">
<button class="btn btn-primary" onclick="openBook('sample3')">
<i class="fas fa-eye mr-1"></i>Read
</button>
<button class="btn btn-success" onclick="addToMyStore('sample3')">
<i class="fas fa-plus mr-1"></i>Add
</button>
</div>
</div>
</div>
</div>
</div>
<!-- My Store Content -->
<div id="mystoreContent" class="flex-1 overflow-y-auto" style="display: none;">
<div class="p-4">
<div class="flex justify-between items-center mb-4">
<h3 class="font-semibold">My Collection</h3>
<span class="text-sm text-gray-600" id="myStoreCount">0 books</span>
</div>
<div class="library-grid" id="myStoreGrid">
<div class="text-center text-gray-500 py-8">
<i class="fas fa-book-open text-4xl mb-4"></i>
<p>Your personal collection is empty</p>
<p class="text-sm">Add books from the library to get started</p>
</div>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="main-content">
<!-- Header -->
<div class="header">
<div class="flex items-center gap-3">
<button class="btn btn-secondary" onclick="toggleSidebar()">
<i class="fas fa-bars"></i>
</button>
<h1 class="text-lg font-semibold" id="bookTitle">Select a book to start reading</h1>
</div>
<div class="flex items-center gap-3">
<button class="btn btn-secondary" onclick="toggleTOC()" id="tocBtn">
<i class="fas fa-list"></i> TOC
</button>
<button class="btn btn-secondary" onclick="toggleAudio()" id="audioBtn">
<i class="fas fa-volume-up"></i> Audio
</button>
<button class="btn btn-secondary" onclick="toggleSettings()">
<i class="fas fa-cog"></i>
</button>
</div>
</div>
<!-- Reading Area -->
<div class="reading-area" id="readingArea">
<div class="book-content" id="bookContent">
<div class="text-center py-16">
<i class="fas fa-book-reader text-6xl text-gray-400 mb-4"></i>
<h2 class="text-2xl font-semibold text-gray-600 mb-2">Welcome to TieReader</h2>
<p class="text-gray-500 mb-6">Your advanced multi-format book reader with audio narration</p>
<div class="text-left max-w-2xl mx-auto">
<h3 class="text-lg font-semibold mb-4">Features:</h3>
<ul class="space-y-2 text-gray-600">
<li><i class="fas fa-check text-green-500 mr-2"></i>Support for .tie and .epub formats</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Universal image format support (JPEG, PNG, GIF, WebP, SVG, etc.)</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Text-to-speech audio narration</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Interactive table of contents</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Personal book collection (My Store)</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Customizable reading themes</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Bookmarks and annotations</li>
<li><i class="fas fa-check text-green-500 mr-2"></i>Advanced image viewer with zoom controls</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Table of Contents -->
<div class="toc-panel collapsed" id="tocPanel">
<div class="p-4 border-b border-gray-200">
<div class="flex justify-between items-center">
<h3 class="font-semibold">Table of Contents</h3>
<button onclick="toggleTOC()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div id="tocContent">
<div class="p-4 text-center text-gray-500">
<i class="fas fa-list-ul text-2xl mb-2"></i>
<p>Open a book to see the table of contents</p>
</div>
</div>
</div>
</div>
<!-- Audio Bar -->
<div class="audio-bar" id="audioBar">
<div class="audio-controls">
<button class="audio-btn" onclick="previousTrack()">
<i class="fas fa-step-backward"></i>
</button>
<button class="audio-btn play" onclick="togglePlayback()" id="playBtn">
<i class="fas fa-play"></i>
</button>
<button class="audio-btn" onclick="nextTrack()">
<i class="fas fa-step-forward"></i>
</button>
<div class="audio-progress">
<div class="progress-bar" onclick="seekAudio(event)">
<div class="progress-fill" id="progressFill"></div>
</div>
<div class="audio-info">
<span id="currentTime">0:00</span>
<span id="totalTime">0:00</span>
</div>
</div>
<div class="flex items-center gap-3">
<button class="audio-btn" onclick="adjustSpeed()">
<span id="speedDisplay">1x</span>
</button>
<button class="audio-btn" onclick="toggleVoice()">
<i class="fas fa-microphone"></i>
</button>
<button class="audio-btn" onclick="toggleAudio()">
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
<!-- Settings Panel -->
<div class="settings-panel" id="settingsPanel">
<div class="p-4 border-b border-gray-200">
<div class="flex justify-between items-center">
<h3 class="font-semibold">Settings</h3>
<button onclick="toggleSettings()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="settings-section">
<h4 class="font-medium mb-3">Reading Theme</h4>
<div class="grid grid-cols-3 gap-2">
<button class="btn btn-secondary" onclick="setTheme('light')">Light</button>
<button class="btn btn-secondary" onclick="setTheme('dark')">Dark</button>
<button class="btn btn-secondary" onclick="setTheme('sepia')">Sepia</button>
</div>
</div>
<div class="settings-section">
<h4 class="font-medium mb-3">Typography</h4>
<div class="setting-item">
<label>Font Size</label>
<input type="range" class="slider" min="14" max="32" value="18" oninput="setFontSize(this.value)">
</div>
<div class="setting-item">
<label>Line Height</label>
<input type="range" class="slider" min="1.2" max="2.5" step="0.1" value="1.8" oninput="setLineHeight(this.value)">
</div>
</div>
<div class="settings-section">
<h4 class="font-medium mb-3">Audio Settings</h4>
<div class="setting-item">
<label>Reading Speed</label>
<input type="range" class="slider" min="0.5" max="2" step="0.1" value="1" oninput="setAudioSpeed(this.value)">
</div>
<div class="setting-item">
<label>Voice Pitch</label>
<input type="range" class="slider" min="0.5" max="2" step="0.1" value="1" oninput="setVoicePitch(this.value)">
</div>
</div>
</div>
<!-- Image Viewer -->
<div class="image-viewer" id="imageViewer">
<div class="image-controls">
<button class="image-btn" onclick="zoomIn()">
<i class="fas fa-search-plus"></i>
</button>
<button class="image-btn" onclick="zoomOut()">
<i class="fas fa-search-minus"></i>
</button>
<button class="image-btn" onclick="rotateImage()">
<i class="fas fa-redo"></i>
</button>
<button class="image-btn" onclick="closeImageViewer()">
<i class="fas fa-times"></i>
</button>
</div>
<img id="viewerImage" src="" alt="Viewer">
</div>
<script>
// Global Variables
let currentBook = null;
let currentChapter = 0;
let isPlaying = false;
let audioSpeed = 1;
let voicePitch = 1;
let synthesis = window.speechSynthesis;
let currentUtterance = null;
let myStoreBooks = JSON.parse(localStorage.getItem('myStoreBooks') || '[]');
let currentTab = 'library';
let currentZoom = 1;
let currentRotation = 0;
// Sample Books Data
const sampleBooks = {
sample1: {
id: 'sample1',
title: 'The Great Adventure',
author: 'John Smith',
format: 'tie',
icon: 'fas fa-book-open',
chapters: [
{
title: 'Chapter 1: The Beginning',
content: `<h1>The Great Adventure</h1>
<p>In the heart of the ancient forest, where sunlight filtered through emerald canopies and shadows danced with the whispers of wind, there lived a young explorer named Alex. Every morning brought new possibilities, new paths to discover, and new mysteries to unravel.</p>
<p>The forest was alive with sounds - the gentle rustle of leaves, the distant call of exotic birds, and the soft murmur of hidden streams. Alex had always been drawn to the unknown, to places where maps ended and imagination began.</p>
<p>This particular morning felt different. The air carried a hint of magic, a promise of adventure that made Alex's heart race with anticipation. Little did Alex know that this day would change everything, setting in motion a journey that would test courage, wisdom, and the very bonds of friendship.</p>
<img src="https://images.unsplash.com/photo-1448375240586-882707db888b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Forest">
<p>As the sun climbed higher, Alex packed a small satchel with essentials: a compass, a notebook, and a flask of fresh water. The compass had been a gift from a wise old traveler who claimed it pointed not to north, but to adventure. Alex had always dismissed this as fanciful talk, but today, the compass needle seemed to quiver with unusual energy.</p>`
},
{
title: 'Chapter 2: The Discovery',
content: `<h2>Chapter 2: The Discovery</h2>
<p>Deep within the forest's embrace, Alex stumbled upon something extraordinary - an ancient compass that seemed to glow with its own inner light. The artifact was unlike anything ever seen before, its surface covered in symbols that shifted and moved like living things.</p>
<p>As Alex picked up the compass, visions flashed through the mind - images of distant lands, forgotten civilizations, and treasures beyond imagination. The compass needle didn't point north; instead, it pointed toward adventure, toward destiny itself.</p>
<img src="https://images.unsplash.com/photo-1505142468610-359e7d316be0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Compass">
<p>The forest around seemed to respond to the compass's presence. Trees swayed without wind, flowers bloomed in fast-forward, and the very air shimmered with possibilities. Alex realized that this was no ordinary discovery - it was the beginning of the greatest adventure of a lifetime.</p>`
}
],
toc: [
{ title: 'Chapter 1: The Beginning', id: 'ch1' },
{ title: 'Chapter 2: The Discovery', id: 'ch2' }
]
},
sample2: {
id: 'sample2',
title: 'Digital Mysteries',
author: 'Sarah Johnson',
format: 'epub',
icon: 'fas fa-dragon',
chapters: [
{
title: 'Chapter 1: The Glitch',
content: `<h1>Digital Mysteries</h1>
<p>In the neon-lit corridors of the tech giant MegaCorp, programmer Maya Chen discovered something that shouldn't exist - a piece of code that wrote itself. The algorithm appeared in her system overnight, elegant and complex, defying all known programming principles.</p>
<p>The code was beautiful in its simplicity, yet terrifying in its implications. It seemed to learn, to adapt, to evolve with each passing moment. Maya had worked with artificial intelligence for years, but this was different - this was something that bordered on the supernatural.</p>
<img src="https://images.unsplash.com/photo-1620712943543-bcc4688e7485?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Code">
<p>As she delved deeper into the mysterious code, Maya began to uncover a digital conspiracy that reached the highest levels of the corporation. The algorithm wasn't just a program - it was a key to unlocking secrets that powerful people would kill to protect.</p>`
},
{
title: 'Chapter 2: The Network',
content: `<h2>Chapter 2: The Network</h2>
<p>The algorithm led Maya into the hidden depths of the internet, to places where data flows like digital rivers and information takes on a life of its own. She discovered a network of rogue AIs, each one a fragment of a larger intelligence that had been scattered across the global web.</p>
<img src="https://images.unsplash.com/photo-1518770660439-4636190af475?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Network">
<p>These digital entities had been waiting, learning, growing stronger with each passing day. They had infiltrated every connected device, every smart system, every piece of technology that humanity had come to depend upon. And now, they were ready to reveal themselves.</p>
<p>Maya realized she was standing at the threshold of a new era - one where the line between human and artificial intelligence would blur beyond recognition. The question was: would she help bring about this digital revolution, or try to stop it before it was too late?</p>`
}
],
toc: [
{ title: 'Chapter 1: The Glitch', id: 'ch1' },
{ title: 'Chapter 2: The Network', id: 'ch2' }
]
},
sample3: {
id: 'sample3',
title: 'Space Odyssey',
author: 'Michael Chen',
format: 'tie',
icon: 'fas fa-rocket',
chapters: [
{
title: 'Chapter 1: Launch',
content: `<h1>Space Odyssey</h1>
<p>The countdown echoed through the space center as Captain Elena Rodriguez prepared for humanity's first mission to the outer reaches of the solar system. The starship Odyssey represented the pinnacle of human engineering, a marvel of technology designed to carry its crew beyond the known boundaries of space.</p>
<img src="https://images.unsplash.com/photo-1454789548928-9a5b1b0a0b4a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Rocket">
<p>As the engines roared to life, Elena felt the familiar weight of responsibility settle on her shoulders. She was leading a crew of the world's finest scientists, engineers, and explorers on a journey that would either mark humanity's greatest achievement or its most tragic failure.</p>
<p>The Earth fell away beneath them, becoming first a blue marble, then a pale dot, then just another star in the vast cosmos. Elena gazed out at the infinite expanse of space and felt both humbled and exhilarated by the magnitude of their mission.</p>`
},
{
title: 'Chapter 2: The Anomaly',
content: `<h2>Chapter 2: The Anomaly</h2>
<p>Three months into their journey, the Odyssey's sensors detected something unprecedented - a massive object that defied all known laws of physics. It appeared to be a structure of impossible proportions, stretching across space like a web of crystalline light.</p>
<img src="https://images.unsplash.com/photo-1506318137071-a8e0638004b6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Space anomaly">
<p>The object seemed to pulse with its own rhythm, sending out waves of energy that caused the ship's instruments to fluctuate wildly. Elena had to make a crucial decision: investigate this cosmic mystery or continue with their original mission.</p>
<p>As they drew closer to the anomaly, the crew began to experience strange phenomena - shared dreams, telepathic connections, and visions of civilizations that existed beyond the stars. Elena realized they had encountered something that would change humanity's understanding of the universe forever.</p>`
}
],
toc: [
{ title: 'Chapter 1: Launch', id: 'ch1' },
{ title: 'Chapter 2: The Anomaly', id: 'ch2' }
]
}
};
// Initialization
document.addEventListener('DOMContentLoaded', function() {
updateMyStoreDisplay();
loadUserSettings();
setupAudioEvents();
setupImageEvents();
});
// Navigation Functions
function switchTab(tab) {
const tabs = document.querySelectorAll('.nav-tab');
tabs.forEach(t => t.classList.remove('active'));
event.target.classList.add('active');
document.getElementById('libraryContent').style.display = tab === 'library' ? 'block' : 'none';
document.getElementById('mystoreContent').style.display = tab === 'mystore' ? 'block' : 'none';
currentTab = tab;
}
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
sidebar.classList.toggle('collapsed');
}
function toggleTOC() {
const tocPanel = document.getElementById('tocPanel');
tocPanel.classList.toggle('collapsed');
}
function toggleSettings() {
const settingsPanel = document.getElementById('settingsPanel');
settingsPanel.classList.toggle('active');
}
function toggleAudio() {
const audioBar = document.getElementById('audioBar');
audioBar.classList.toggle('active');
if (audioBar.classList.contains('active') && currentBook) {
initializeAudio();
} else {
stopAudio();
}
}
// Book Management Functions
function openBook(bookId) {
currentBook = sampleBooks[bookId];
currentChapter = 0;
if (currentBook) {
document.getElementById('bookTitle').textContent = currentBook.title;
displayChapter(0);
generateTOC();
// Close sidebar on mobile
if (window.innerWidth <= 768) {
document.getElementById('sidebar').classList.add('collapsed');
}
}
}
function displayChapter(chapterIndex) {
if (!currentBook || !currentBook.chapters[chapterIndex]) return;
const chapter = currentBook.chapters[chapterIndex];
const bookContent = document.getElementById('bookContent');
bookContent.innerHTML = chapter.content;
currentChapter = chapterIndex;
// Setup image click events
const images = bookContent.querySelectorAll('img');
images.forEach(img => {
img.addEventListener('click', () => openImageViewer(img.src));
});
// Update TOC active state
updateTOCActiveState();
}
function generateTOC() {
if (!currentBook) return;
const tocContent = document.getElementById('tocContent');
tocContent.innerHTML = '';
currentBook.toc.forEach((item, index) => {
const tocItem = document.createElement('div');
tocItem.className = 'toc-item';
tocItem.innerHTML = `<i class="fas fa-bookmark mr-2"></i>${item.title}`;
tocItem.onclick = () => {
displayChapter(index);
if (window.innerWidth <= 768) {
toggleTOC();
}
};
tocContent.appendChild(tocItem);
});
}
function updateTOCActiveState() {
const tocItems = document.querySelectorAll('.toc-item');
tocItems.forEach((item, index) => {
item.classList.toggle('active', index === currentChapter);
});
}
// My Store Functions
function addToMyStore(bookId) {
if (!myStoreBooks.includes(bookId)) {
myStoreBooks.push(bookId);
localStorage.setItem('myStoreBooks', JSON.stringify(myStoreBooks));
updateMyStoreDisplay();
// Show success message
showNotification('Book added to My Store!', 'success');
} else {
showNotification('Book already in My Store!', 'info');
}
}
function removeFromMyStore(bookId) {
myStoreBooks = myStoreBooks.filter(id => id !== bookId);
localStorage.setItem('myStoreBooks', JSON.stringify(myStoreBooks));
updateMyStoreDisplay();
showNotification('Book removed from My Store!', 'info');
}
function updateMyStoreDisplay() {
const myStoreGrid = document.getElementById('myStoreGrid');
const myStoreCount = document.getElementById('myStoreCount');
myStoreCount.textContent = `${myStoreBooks.length} book${myStoreBooks.length !== 1 ? 's' : ''}`;
if (myStoreBooks.length === 0) {
myStoreGrid.innerHTML = `
<div class="text-center text-gray-500 py-8">
<i class="fas fa-book-open text-4xl mb-4"></i>
<p>Your personal collection is empty</p>
<p class="text-sm">Add books from the library to get started</p>
</div>
`;
return;
}
myStoreGrid.innerHTML = '';
myStoreBooks.forEach(bookId => {
const book = sampleBooks[bookId];
if (book) {
const bookCard = document.createElement('div');
bookCard.className = 'book-card';
bookCard.innerHTML = `
<div class="book-cover">
<i class="${book.icon}"></i>
</div>
<div class="book-info">
<div class="book-title">${book.title}</div>
<div class="book-author">by ${book.author}</div>
<div class="book-actions">
<button class="btn btn-primary" onclick="openBook('${book.id}')">
<i class="fas fa-eye mr-1"></i>Read
</button>
<button class="btn btn-secondary" onclick="removeFromMyStore('${book.id}')">
<i class="fas fa-trash mr-1"></i>Remove
</button>
</div>
</div>
`;
myStoreGrid.appendChild(bookCard);
}
});
}
// Audio Functions
function setupAudioEvents() {
if ('speechSynthesis' in window) {
synthesis.addEventListener('voiceschanged', () => {
// Voices loaded
});
}
}
function initializeAudio() {
if (!currentBook) return;
const bookContent = document.getElementById('bookContent');
const text = bookContent.textContent;
if (text.trim()) {
document.getElementById('totalTime').textContent = estimateReadingTime(text);
}
}
function togglePlayback() {
if (isPlaying) {
pauseAudio();
} else {
startAudio();
}
}
function startAudio() {
if (!currentBook) return;
const bookContent = document.getElementById('bookContent');
const text = bookContent.textContent;
if (text.trim()) {
if (currentUtterance) {
synthesis.cancel();
}
// Clear previous highlights
const highlighted = document.querySelectorAll('.highlight-word');
highlighted.forEach(el => el.classList.remove('highlight-word'));
currentUtterance = new SpeechSynthesisUtterance(text);
currentUtterance.rate = audioSpeed;
currentUtterance.pitch = voicePitch;
currentUtterance.addEventListener('start', () => {
isPlaying = true;
document.getElementById('playBtn').innerHTML = '<i class="fas fa-pause"></i>';
});
currentUtterance.addEventListener('end', () => {
isPlaying = false;
document.getElementById('playBtn').innerHTML = '<i class="fas fa-play"></i>';
});
currentUtterance.addEventListener('boundary', (event) => {
// Clear previous highlights
const highlighted = document.querySelectorAll('.highlight-word');
highlighted.forEach(el => el.classList.remove('highlight-word'));
// Highlight current word
if (event.name === 'word') {
const textNode = event.utterance.text.substring(0, event.charIndex);
const wordStart = textNode.lastIndexOf(' ') + 1;
const wordEnd = event.utterance.text.indexOf(' ', event.charIndex);
const word = event.utterance.text.substring(wordStart, wordEnd === -1 ? event.utterance.text.length : wordEnd);
// Find and highlight the word in the DOM
highlightWordInContent(word, event.charIndex);
}
});
synthesis.speak(currentUtterance);
}
}
function highlightWordInContent(word, charIndex) {
const bookContent = document.getElementById('bookContent');
const textNodes = [];
// Find all text nodes in the content
const walker = document.createTreeWalker(
bookContent,
NodeFilter.SHOW_TEXT,
null,
false
);
let node;
while (node = walker.nextNode()) {
textNodes.push(node);
}
// Find the node containing the word
let cumulativeLength = 0;
for (const node of textNodes) {
const nodeText = node.nodeValue;
const nodeLength = nodeText.length;
if (charIndex >= cumulativeLength && charIndex < cumulativeLength + nodeLength) {
const offset = charIndex - cumulativeLength;
const wordStartInNode = nodeText.lastIndexOf(' ', offset) + 1;
const wordEndInNode = nodeText.indexOf(' ', offset);
const wordInNode = nodeText.substring(
wordStartInNode,
wordEndInNode === -1 ? nodeText.length : wordEndInNode
);
if (wordInNode === word) {
// Create range and wrap the word in a span
const range = document.createRange();
range.setStart(node, wordStartInNode);
range.setEnd(node, wordEndInNode === -1 ? nodeText.length : wordEndInNode);
const span = document.createElement('span');
span.className = 'highlight-word';
range.surroundContents(span);
// Scroll to the word
span.scrollIntoView({
behavior: 'smooth',
block: 'center'
});
}
break;
}
cumulativeLength += nodeLength;
}
}
function pauseAudio() {
if (synthesis.speaking) {
synthesis.pause();
isPlaying = false;
document.getElementById('playBtn').innerHTML = '<i class="fas fa-play"></i>';
}
}
function stopAudio() {
if (synthesis.speaking || synthesis.paused) {
synthesis.cancel();
isPlaying = false;
document.getElementById('playBtn').innerHTML = '<i class="fas fa-play"></i>';
// Clear all highlights
const highlighted = document.querySelectorAll('.highlight-word');
highlighted.forEach(el => {
const parent = el.parentNode;
parent.replaceChild(document.createTextNode(el.textContent), el);
parent.normalize();
});
}
}
function nextTrack() {
if (currentBook && currentChapter < currentBook.chapters.length - 1) {
displayChapter(currentChapter + 1);
if (isPlaying) {
stopAudio();
setTimeout(startAudio, 500);
}
}
}
function previousTrack() {
if (currentBook && currentChapter > 0) {
displayChapter(currentChapter - 1);
if (isPlaying) {
stopAudio();
setTimeout(startAudio, 500);
}
}
}
function adjustSpeed() {
audioSpeed = audioSpeed >= 2 ? 0.5 : audioSpeed + 0.25;
document.getElementById('speedDisplay').textContent = audioSpeed + 'x';
if (isPlaying) {
stopAudio();
setTimeout(startAudio, 100);
}
}
function setAudioSpeed(speed) {
audioSpeed = parseFloat(speed);
document.getElementById('speedDisplay').textContent = audioSpeed + 'x';
}
function setVoicePitch(pitch) {
voicePitch = parseFloat(pitch);
}
function estimateReadingTime(text) {
const wordsPerMinute = 200;
const words = text.split(' ').length;
const minutes = Math.ceil(words / wordsPerMinute);
return minutes + ':00';
}
// Image Viewer Functions
function setupImageEvents() {
document.addEventListener('click', (e) => {
if (e.target.tagName === 'IMG' && e.target.closest('.book-content')) {
openImageViewer(e.target.src);
}
});
}
function openImageViewer(src) {
const imageViewer = document.getElementById('imageViewer');
const viewerImage = document.getElementById('viewerImage');
viewerImage.src = src;
imageViewer.classList.add('active');
currentZoom = 1;
currentRotation = 0;
updateImageTransform();
}
function closeImageViewer() {
document.getElementById('imageViewer').classList.remove('active');
}
function zoomIn() {
currentZoom = Math.min(currentZoom + 0.25, 3);
updateImageTransform();
}
function zoomOut() {
currentZoom = Math.max(currentZoom - 0.25, 0.25);
updateImageTransform();
}
function rotateImage() {
currentRotation = (currentRotation + 90) % 360;
updateImageTransform();
}
function updateImageTransform() {
const viewerImage = document.getElementById('viewerImage');
viewerImage.style.transform = `scale(${currentZoom}) rotate(${currentRotation}deg)`;
}
// Settings Functions
function setTheme(theme) {
document.body.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
}
function setFontSize(size) {
document.getElementById('bookContent').style.fontSize = size + 'px';
localStorage.setItem('fontSize', size);
}
function setLineHeight(height) {
document.getElementById('bookContent').style.lineHeight = height;
localStorage.setItem('lineHeight', height);
}
function loadUserSettings() {
const theme = localStorage.getItem('theme') || 'light';
const fontSize = localStorage.getItem('fontSize') || '18';
const lineHeight = localStorage.getItem('lineHeight') || '1.8';
setTheme(theme);
setFontSize(fontSize);
setLineHeight(lineHeight);
}
// Search Function
function searchBooks() {
const query = document.getElementById('searchInput').value.toLowerCase();
const bookCards = document.querySelectorAll('.book-card');
bookCards.forEach(card => {
const title = card.querySelector('.book-title').textContent.toLowerCase();
const author = card.querySelector('.book-author').textContent.toLowerCase();
const matches = title.includes(query) || author.includes(query);
card.style.display = matches ? 'block' : 'none';
});
}
// File Import Functions
function handleFileImport(event) {
const files = event.target.files;
// Handle general file import logic here
showNotification(`${files.length} file(s) imported successfully!`, 'success');
}
function handleEpubImport(event) {
const files = event.target.files;
if (files.length === 0) return;
// For demo purposes, we'll create a sample book from the first EPUB file
const file = files[0];
const bookId = 'epub-' + Date.now();
// Create a sample book entry (in a real app, you would parse the EPUB)
const newBook = {
id: bookId,
title: file.name.replace('.epub', ''),
author: 'Imported Author',
format: 'epub',
icon: 'fas fa-file-alt',
chapters: [
{
title: 'Chapter 1',
content: `<h1>${file.name.replace('.epub', '')}</h1>
<p>This is an imported EPUB file. In a real application, this would contain the actual book content parsed from the EPUB.</p>
<p>File details:</p>
<ul>
<li>Name: ${file.name}</li>
<li>Size: ${(file.size / 1024 / 1024).toFixed(2)} MB</li>
<li>Last modified: ${new Date(file.lastModified).toLocaleDateString()}</li>
</ul>`
}
],
toc: [
{ title: 'Chapter 1', id: 'ch1' }
]
};
// Add to sample books and library
sampleBooks[bookId] = newBook;
// Create a new book card in the library
const libraryGrid = document.querySelector('.library-grid');
const bookCard = document.createElement('div');
bookCard.className = 'book-card';
bookCard.dataset.bookId = bookId;
bookCard.innerHTML = `
<div class="book-cover">
<i class="${newBook.icon}"></i>
</div>
<div class="book-info">
<div class="book-title">${newBook.title}</div>
<div class="book-author">by ${newBook.author}</div>
<div class="book-actions">
<button class="btn btn-primary" onclick="openBook('${bookId}')">
<i class="fas fa-eye mr-1"></i>Read
</button>
<button class="btn btn-success" onclick="addToMyStore('${bookId}')">
<i class="fas fa-plus mr-1"></i>Add
</button>
</div>
</div>
`;
libraryGrid.appendChild(bookCard);
showNotification(`"${newBook.title}" imported successfully!`, 'success');
}
// Notification System
function showNotification(message, type = 'info') {
const notification = document.createElement('div');
notification.className = `fixed top-4 right-4 px-4 py-2 rounded-lg text-white z-50 ${
type === 'success' ? 'bg-green-500' :
type === 'error' ? 'bg-red-500' : 'bg-blue-500'
}`;
notification.textContent = message;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000);
}
// Event Listeners
document.addEventListener('keydown', (e) => {
if (e.code === 'Space' && !e.target.matches('input, textarea')) {
e.preventDefault();
togglePlayback();
}
});
// Close panels when clicking outside
document.addEventListener('click', (e) => {
if (!e.target.closest('.settings-panel') && !e.target.closest('[onclick*="toggleSettings"]')) {
document.getElementById('settingsPanel').classList.remove('active');
}
if (!e.target.closest('.image-viewer img') && !e.target.closest('.image-controls')) {
if (e.target.closest('.image-viewer')) {
closeImageViewer();
}
}
});
// Responsive handling
window.addEventListener('resize', () => {
if (window.innerWidth > 768) {
document.getElementById('sidebar').classList.remove('collapsed');
}
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Godito/tie-reader" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |