Update main.py
Browse files
main.py
CHANGED
@@ -226,33 +226,18 @@ def proxy(path):
|
|
226 |
|
227 |
// Touch gestures for mobile
|
228 |
let initialDistance = 0;
|
229 |
-
let initialTouchX, initialTouchY;
|
230 |
-
let lastTouchX, lastTouchY;
|
231 |
-
let isTouchDragging = false;
|
232 |
-
|
233 |
modal.addEventListener('touchstart', function(e) {
|
234 |
if (e.touches.length === 2) {
|
235 |
-
// Pinch to zoom gesture
|
236 |
initialDistance = Math.hypot(
|
237 |
e.touches[0].pageX - e.touches[1].pageX,
|
238 |
e.touches[0].pageY - e.touches[1].pageY
|
239 |
);
|
240 |
-
} else if (e.touches.length === 1) {
|
241 |
-
// Single touch for dragging
|
242 |
-
isTouchDragging = true;
|
243 |
-
initialTouchX = e.touches[0].clientX - translateX;
|
244 |
-
initialTouchY = e.touches[0].clientY - translateY;
|
245 |
-
lastTouchX = e.touches[0].clientX;
|
246 |
-
lastTouchY = e.touches[0].clientY;
|
247 |
-
modalImg.style.transition = 'none';
|
248 |
}
|
249 |
});
|
250 |
|
251 |
modal.addEventListener('touchmove', function(e) {
|
252 |
-
e.preventDefault(); // Prevent page scrolling
|
253 |
-
|
254 |
if (e.touches.length === 2) {
|
255 |
-
|
256 |
const currentDistance = Math.hypot(
|
257 |
e.touches[0].pageX - e.touches[1].pageX,
|
258 |
e.touches[0].pageY - e.touches[1].pageY
|
@@ -261,35 +246,7 @@ def proxy(path):
|
|
261 |
scale = Math.min(Math.max(scale + delta, 0.5), 3);
|
262 |
initialDistance = currentDistance;
|
263 |
applyTransform();
|
264 |
-
} else if (e.touches.length === 1 && isTouchDragging) {
|
265 |
-
// Single touch dragging
|
266 |
-
translateX = e.touches[0].clientX - initialTouchX;
|
267 |
-
translateY = e.touches[0].clientY - initialTouchY;
|
268 |
-
|
269 |
-
// Calculate velocity for momentum
|
270 |
-
lastTouchX = e.touches[0].clientX;
|
271 |
-
lastTouchY = e.touches[0].clientY;
|
272 |
-
|
273 |
-
applyTransform();
|
274 |
-
}
|
275 |
-
});
|
276 |
-
|
277 |
-
modal.addEventListener('touchend', function(e) {
|
278 |
-
isTouchDragging = false;
|
279 |
-
modalImg.style.transition = 'transform 0.3s ease-out';
|
280 |
-
});
|
281 |
-
|
282 |
-
// Double tap to reset zoom
|
283 |
-
let lastTap = 0;
|
284 |
-
modal.addEventListener('touchend', function(e) {
|
285 |
-
const currentTime = new Date().getTime();
|
286 |
-
const tapLength = currentTime - lastTap;
|
287 |
-
if (tapLength < 300 && tapLength > 0) {
|
288 |
-
// Double tap detected
|
289 |
-
resetZoom();
|
290 |
-
e.preventDefault();
|
291 |
}
|
292 |
-
lastTap = currentTime;
|
293 |
});
|
294 |
|
295 |
// Add click event to all images
|
@@ -453,20 +410,10 @@ def proxy(path):
|
|
453 |
backdrop-filter: blur(10px);
|
454 |
border: 1px solid rgba(255, 255, 255, 0.8);
|
455 |
}
|
456 |
-
/* Table container for horizontal scrolling on mobile */
|
457 |
-
.table-container {
|
458 |
-
width: 100%;
|
459 |
-
overflow-x: auto;
|
460 |
-
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
|
461 |
-
margin: 30px 0;
|
462 |
-
border-radius: 16px;
|
463 |
-
box-shadow: var(--card-shadow);
|
464 |
-
}
|
465 |
td {
|
466 |
padding: 20px;
|
467 |
border: 1px solid rgba(236, 240, 241, 0.8);
|
468 |
transition: var(--transition);
|
469 |
-
word-break: break-word; /* Break long words */
|
470 |
}
|
471 |
tr:nth-child(even) {
|
472 |
background: rgba(245, 247, 250, 0.5);
|
@@ -592,42 +539,22 @@ def proxy(path):
|
|
592 |
color: #3498db;
|
593 |
}
|
594 |
|
595 |
-
/* Responsive styles for tablets */
|
596 |
@media (max-width: 768px) {
|
597 |
-
body {
|
598 |
-
padding: 15px;
|
599 |
-
font-size: 15px;
|
600 |
-
}
|
601 |
.breadcrumb {
|
602 |
flex-direction: column;
|
603 |
align-items: flex-start;
|
604 |
padding: 15px;
|
605 |
-
margin-bottom: 20px;
|
606 |
-
}
|
607 |
-
.breadcrumb a {
|
608 |
-
padding: 6px 12px;
|
609 |
-
font-size: 14px;
|
610 |
-
width: 100%;
|
611 |
-
box-sizing: border-box;
|
612 |
-
margin-bottom: 5px;
|
613 |
}
|
614 |
ul {
|
615 |
grid-template-columns: 1fr;
|
616 |
gap: 15px;
|
617 |
}
|
618 |
-
table {
|
619 |
-
|
620 |
-
display: block;
|
621 |
-
overflow-x: auto;
|
622 |
-
white-space: nowrap;
|
623 |
-
}
|
624 |
-
td {
|
625 |
-
padding: 12px;
|
626 |
-
}
|
627 |
.open-image-btn {
|
628 |
width: 100%;
|
629 |
text-align: center;
|
630 |
-
padding: 10px 15px;
|
631 |
}
|
632 |
.modal img {
|
633 |
max-width: 95%;
|
@@ -637,69 +564,6 @@ def proxy(path):
|
|
637 |
top: 10px;
|
638 |
right: 15px;
|
639 |
}
|
640 |
-
.close-container {
|
641 |
-
top: 10px;
|
642 |
-
right: 10px;
|
643 |
-
}
|
644 |
-
.zoom-controls {
|
645 |
-
display: flex;
|
646 |
-
gap: 5px;
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
/* Responsive styles for mobile phones */
|
651 |
-
@media (max-width: 480px) {
|
652 |
-
body {
|
653 |
-
padding: 10px;
|
654 |
-
font-size: 14px;
|
655 |
-
}
|
656 |
-
.breadcrumb {
|
657 |
-
padding: 10px;
|
658 |
-
margin-bottom: 15px;
|
659 |
-
}
|
660 |
-
.breadcrumb a {
|
661 |
-
padding: 5px 10px;
|
662 |
-
font-size: 13px;
|
663 |
-
}
|
664 |
-
table {
|
665 |
-
font-size: 12px;
|
666 |
-
}
|
667 |
-
td {
|
668 |
-
padding: 8px;
|
669 |
-
}
|
670 |
-
img {
|
671 |
-
margin: 5px 0;
|
672 |
-
}
|
673 |
-
.open-image-btn {
|
674 |
-
padding: 8px 12px;
|
675 |
-
font-size: 13px;
|
676 |
-
margin: 8px 0;
|
677 |
-
}
|
678 |
-
.modal {
|
679 |
-
padding: 0;
|
680 |
-
}
|
681 |
-
.modal img {
|
682 |
-
max-width: 100%;
|
683 |
-
max-height: 90vh;
|
684 |
-
}
|
685 |
-
.close-container {
|
686 |
-
top: 5px;
|
687 |
-
right: 5px;
|
688 |
-
gap: 5px;
|
689 |
-
}
|
690 |
-
.zoom-controls {
|
691 |
-
display: flex;
|
692 |
-
justify-content: space-between;
|
693 |
-
width: 100%;
|
694 |
-
margin-bottom: 5px;
|
695 |
-
}
|
696 |
-
.zoom-btn {
|
697 |
-
flex: 1;
|
698 |
-
margin: 0 2px;
|
699 |
-
padding: 4px 8px;
|
700 |
-
font-size: 12px;
|
701 |
-
}
|
702 |
-
}
|
703 |
}
|
704 |
'''
|
705 |
# Check if head exists, if not create it
|
@@ -711,21 +575,8 @@ def proxy(path):
|
|
711 |
html_tag = soup.new_tag('html')
|
712 |
html_tag.append(head_tag)
|
713 |
soup.append(html_tag)
|
714 |
-
|
715 |
-
# Add viewport meta tag for proper mobile scaling
|
716 |
-
viewport_meta = soup.new_tag('meta')
|
717 |
-
viewport_meta['name'] = 'viewport'
|
718 |
-
viewport_meta['content'] = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'
|
719 |
-
soup.head.append(viewport_meta)
|
720 |
-
|
721 |
soup.head.append(style_tag)
|
722 |
|
723 |
-
# Wrap tables in container for mobile scrolling
|
724 |
-
for table in soup.find_all('table'):
|
725 |
-
table_container = soup.new_tag('div')
|
726 |
-
table_container['class'] = 'table-container'
|
727 |
-
table.wrap(table_container)
|
728 |
-
|
729 |
# Convert navigation links to breadcrumb
|
730 |
nav_links = soup.find_all('a', href=True)
|
731 |
breadcrumb_div = soup.new_tag('div')
|
|
|
226 |
|
227 |
// Touch gestures for mobile
|
228 |
let initialDistance = 0;
|
|
|
|
|
|
|
|
|
229 |
modal.addEventListener('touchstart', function(e) {
|
230 |
if (e.touches.length === 2) {
|
|
|
231 |
initialDistance = Math.hypot(
|
232 |
e.touches[0].pageX - e.touches[1].pageX,
|
233 |
e.touches[0].pageY - e.touches[1].pageY
|
234 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
});
|
237 |
|
238 |
modal.addEventListener('touchmove', function(e) {
|
|
|
|
|
239 |
if (e.touches.length === 2) {
|
240 |
+
e.preventDefault();
|
241 |
const currentDistance = Math.hypot(
|
242 |
e.touches[0].pageX - e.touches[1].pageX,
|
243 |
e.touches[0].pageY - e.touches[1].pageY
|
|
|
246 |
scale = Math.min(Math.max(scale + delta, 0.5), 3);
|
247 |
initialDistance = currentDistance;
|
248 |
applyTransform();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
|
|
250 |
});
|
251 |
|
252 |
// Add click event to all images
|
|
|
410 |
backdrop-filter: blur(10px);
|
411 |
border: 1px solid rgba(255, 255, 255, 0.8);
|
412 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
td {
|
414 |
padding: 20px;
|
415 |
border: 1px solid rgba(236, 240, 241, 0.8);
|
416 |
transition: var(--transition);
|
|
|
417 |
}
|
418 |
tr:nth-child(even) {
|
419 |
background: rgba(245, 247, 250, 0.5);
|
|
|
539 |
color: #3498db;
|
540 |
}
|
541 |
|
|
|
542 |
@media (max-width: 768px) {
|
543 |
+
body { padding: 15px; }
|
|
|
|
|
|
|
544 |
.breadcrumb {
|
545 |
flex-direction: column;
|
546 |
align-items: flex-start;
|
547 |
padding: 15px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
}
|
549 |
ul {
|
550 |
grid-template-columns: 1fr;
|
551 |
gap: 15px;
|
552 |
}
|
553 |
+
table { font-size: 14px; }
|
554 |
+
td { padding: 12px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
.open-image-btn {
|
556 |
width: 100%;
|
557 |
text-align: center;
|
|
|
558 |
}
|
559 |
.modal img {
|
560 |
max-width: 95%;
|
|
|
564 |
top: 10px;
|
565 |
right: 15px;
|
566 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
}
|
568 |
'''
|
569 |
# Check if head exists, if not create it
|
|
|
575 |
html_tag = soup.new_tag('html')
|
576 |
html_tag.append(head_tag)
|
577 |
soup.append(html_tag)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
soup.head.append(style_tag)
|
579 |
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
# Convert navigation links to breadcrumb
|
581 |
nav_links = soup.find_all('a', href=True)
|
582 |
breadcrumb_div = soup.new_tag('div')
|