Update app.py
Browse files
app.py
CHANGED
|
@@ -497,10 +497,8 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
|
|
| 497 |
# ==========================================
|
| 498 |
js_resizable = """
|
| 499 |
function() {
|
| 500 |
-
console.log("๐ ๏ธ [
|
| 501 |
|
| 502 |
-
// [ํต์ฌ 1] Shadow DOM(๊ทธ๋ฆผ์ ๋) ๊ดํต ํ์๊ธฐ
|
| 503 |
-
// Gradio 6์ด ํ๋ฅผ ๊ฝ๊ฝ ์จ๊ฒจ๋์ด๋ ๊ฐ์ ๋ก ์ฐพ์๋
๋๋ค.
|
| 504 |
function findAllTables(root) {
|
| 505 |
let tables = [];
|
| 506 |
const elements = root.querySelectorAll('*');
|
|
@@ -522,11 +520,11 @@ function() {
|
|
| 522 |
tables.forEach(table => {
|
| 523 |
if (table.dataset.resizable === 'true') return;
|
| 524 |
|
|
|
|
| 525 |
table.style.tableLayout = 'fixed';
|
| 526 |
table.style.width = 'max-content';
|
| 527 |
table.style.minWidth = '100%';
|
| 528 |
|
| 529 |
-
// thead ์์ th ๋ฟ๋ง ์๋๋ผ, ๊ตฌ์กฐ๊ฐ ๋ค๋ฅผ ๊ฒฝ์ฐ๋ฅผ ๋๋นํด ์ฒซ ์ค ๋ชจ๋ ํ์
|
| 530 |
const headers = table.querySelectorAll('thead th, tr:first-child th, tr:first-child td');
|
| 531 |
|
| 532 |
headers.forEach(th => {
|
|
@@ -534,39 +532,43 @@ function() {
|
|
| 534 |
|
| 535 |
const resizer = document.createElement('div');
|
| 536 |
resizer.className = 'resizer';
|
| 537 |
-
|
| 538 |
-
// [ํต์ฌ 2] ์ธ๋ถ CSS๊ฐ ๋จนํ์ง ์์ ๊ฒ์ ๋๋นํด ์ธ๋ผ์ธ ์คํ์ผ๋ก ๋์์ธ ๊ฐ์ ์ฃผ์
|
| 539 |
-
resizer.style.width = '12px'; // ์กฐ๊ธ ๋ ๋๊ป๊ฒ 12px๋ก ์ค์
|
| 540 |
resizer.style.height = '100%';
|
| 541 |
resizer.style.position = 'absolute';
|
| 542 |
resizer.style.right = '0px';
|
| 543 |
resizer.style.top = '0px';
|
| 544 |
resizer.style.cursor = 'col-resize';
|
| 545 |
-
resizer.style.zIndex = '999999';
|
| 546 |
-
resizer.style.backgroundColor = 'rgba(255, 0, 0, 0.6)';
|
| 547 |
|
| 548 |
th.style.position = 'relative';
|
| 549 |
-
th.style.overflow = 'visible';
|
| 550 |
th.appendChild(resizer);
|
| 551 |
|
| 552 |
let startX, startWidth;
|
| 553 |
|
| 554 |
function onMouseDown(e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
startX = e.clientX || e.pageX;
|
| 556 |
startWidth = th.getBoundingClientRect().width;
|
|
|
|
| 557 |
document.addEventListener('mousemove', onMouseMove);
|
| 558 |
document.addEventListener('mouseup', onMouseUp);
|
| 559 |
|
| 560 |
-
resizer.style.backgroundColor = '#1a73e8';
|
| 561 |
-
document.body.style.
|
| 562 |
-
e.preventDefault();
|
| 563 |
}
|
| 564 |
|
| 565 |
function onMouseMove(e) {
|
|
|
|
|
|
|
|
|
|
| 566 |
const currentX = e.clientX || e.pageX;
|
| 567 |
-
const width = Math.max(
|
| 568 |
|
| 569 |
-
// ๋๋น 3์ค ๊ฐ์ ํ ๋น
|
| 570 |
th.style.width = width + 'px';
|
| 571 |
th.style.minWidth = width + 'px';
|
| 572 |
th.style.maxWidth = width + 'px';
|
|
@@ -575,18 +577,18 @@ function() {
|
|
| 575 |
function onMouseUp() {
|
| 576 |
document.removeEventListener('mousemove', onMouseMove);
|
| 577 |
document.removeEventListener('mouseup', onMouseUp);
|
|
|
|
| 578 |
resizer.style.backgroundColor = 'rgba(255, 0, 0, 0.6)';
|
| 579 |
-
document.body.style.
|
| 580 |
}
|
| 581 |
|
| 582 |
resizer.addEventListener('mousedown', onMouseDown);
|
| 583 |
});
|
|
|
|
| 584 |
table.dataset.resizable = 'true';
|
| 585 |
-
console.log("โ
ํ์ ๋ง์ฐ์ค ์กฐ์ ํธ๋ค ๋ถ์ฐฉ ์๋ฃ!");
|
| 586 |
});
|
| 587 |
};
|
| 588 |
|
| 589 |
-
// ํ๊ฐ ํ๋ฉด์ ๋ ๋๋ง๋ ๋๊น์ง 0.2์ด๋ง๋ค ํ์ (์ต๋ 10์ด๊ฐ ์๋)
|
| 590 |
let attempts = 0;
|
| 591 |
const interval = setInterval(() => {
|
| 592 |
attachResizers();
|
|
@@ -594,7 +596,7 @@ function() {
|
|
| 594 |
if (attempts > 50) clearInterval(interval);
|
| 595 |
}, 200);
|
| 596 |
|
| 597 |
-
return [];
|
| 598 |
}
|
| 599 |
"""
|
| 600 |
|
|
|
|
| 497 |
# ==========================================
|
| 498 |
js_resizable = """
|
| 499 |
function() {
|
| 500 |
+
console.log("๐ ๏ธ [์ต์ข
์์ ] ์ด ์กฐ์ ์ด๋ฒคํธ ๋ฐฉ์ด๋ง ๊ฐ๋!");
|
| 501 |
|
|
|
|
|
|
|
| 502 |
function findAllTables(root) {
|
| 503 |
let tables = [];
|
| 504 |
const elements = root.querySelectorAll('*');
|
|
|
|
| 520 |
tables.forEach(table => {
|
| 521 |
if (table.dataset.resizable === 'true') return;
|
| 522 |
|
| 523 |
+
// ํ ์ ์ฒด์ ์ ์ฝ์ ํ๋๋ค
|
| 524 |
table.style.tableLayout = 'fixed';
|
| 525 |
table.style.width = 'max-content';
|
| 526 |
table.style.minWidth = '100%';
|
| 527 |
|
|
|
|
| 528 |
const headers = table.querySelectorAll('thead th, tr:first-child th, tr:first-child td');
|
| 529 |
|
| 530 |
headers.forEach(th => {
|
|
|
|
| 532 |
|
| 533 |
const resizer = document.createElement('div');
|
| 534 |
resizer.className = 'resizer';
|
| 535 |
+
resizer.style.width = '12px';
|
|
|
|
|
|
|
| 536 |
resizer.style.height = '100%';
|
| 537 |
resizer.style.position = 'absolute';
|
| 538 |
resizer.style.right = '0px';
|
| 539 |
resizer.style.top = '0px';
|
| 540 |
resizer.style.cursor = 'col-resize';
|
| 541 |
+
resizer.style.zIndex = '999999';
|
| 542 |
+
resizer.style.backgroundColor = 'rgba(255, 0, 0, 0.6)';
|
| 543 |
|
| 544 |
th.style.position = 'relative';
|
| 545 |
+
th.style.overflow = 'visible';
|
| 546 |
th.appendChild(resizer);
|
| 547 |
|
| 548 |
let startX, startWidth;
|
| 549 |
|
| 550 |
function onMouseDown(e) {
|
| 551 |
+
// [ํต์ฌ ํด๊ฒฐ์ฑ
] ๋ธ๋ผ์ฐ์ ์ ํ
์คํธ ๋๋๊ทธ๋ ๋ค๋ฅธ ์ด๋ฒคํธ๋ฅผ ๊ฐ์ ๋ก ๋ง์ต๋๋ค.
|
| 552 |
+
e.preventDefault();
|
| 553 |
+
e.stopPropagation();
|
| 554 |
+
|
| 555 |
startX = e.clientX || e.pageX;
|
| 556 |
startWidth = th.getBoundingClientRect().width;
|
| 557 |
+
|
| 558 |
document.addEventListener('mousemove', onMouseMove);
|
| 559 |
document.addEventListener('mouseup', onMouseUp);
|
| 560 |
|
| 561 |
+
resizer.style.backgroundColor = '#1a73e8';
|
| 562 |
+
document.body.style.cursor = 'col-resize'; // ๋ง์ฐ์ค๊ฐ ํ๋ฉด ์ด๋์๋ ๋ฆฌ์ฌ์ด์ฆ ์ปค์ ์ ์ง
|
|
|
|
| 563 |
}
|
| 564 |
|
| 565 |
function onMouseMove(e) {
|
| 566 |
+
// [ํต์ฌ ํด๊ฒฐ์ฑ
] ์ด๋ฒคํธ๋ฅผ ๊ณ์ ๋ถ์ก์ ๋ก๋๋ค.
|
| 567 |
+
e.preventDefault();
|
| 568 |
+
|
| 569 |
const currentX = e.clientX || e.pageX;
|
| 570 |
+
const width = Math.max(30, startWidth + (currentX - startX));
|
| 571 |
|
|
|
|
| 572 |
th.style.width = width + 'px';
|
| 573 |
th.style.minWidth = width + 'px';
|
| 574 |
th.style.maxWidth = width + 'px';
|
|
|
|
| 577 |
function onMouseUp() {
|
| 578 |
document.removeEventListener('mousemove', onMouseMove);
|
| 579 |
document.removeEventListener('mouseup', onMouseUp);
|
| 580 |
+
|
| 581 |
resizer.style.backgroundColor = 'rgba(255, 0, 0, 0.6)';
|
| 582 |
+
document.body.style.cursor = ''; // ์ปค์ ์์๋ณต๊ตฌ
|
| 583 |
}
|
| 584 |
|
| 585 |
resizer.addEventListener('mousedown', onMouseDown);
|
| 586 |
});
|
| 587 |
+
|
| 588 |
table.dataset.resizable = 'true';
|
|
|
|
| 589 |
});
|
| 590 |
};
|
| 591 |
|
|
|
|
| 592 |
let attempts = 0;
|
| 593 |
const interval = setInterval(() => {
|
| 594 |
attachResizers();
|
|
|
|
| 596 |
if (attempts > 50) clearInterval(interval);
|
| 597 |
}, 200);
|
| 598 |
|
| 599 |
+
return [];
|
| 600 |
}
|
| 601 |
"""
|
| 602 |
|