QIDNLF commited on
Commit
f24980a
ยท
verified ยท
1 Parent(s): beb518b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -19
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("๐Ÿ› ๏ธ [Gradio 6 ๋Œ€์‘] ์—ด ๋„ˆ๋น„ ์กฐ์ ˆ ์Šคํฌ๋ฆฝํŠธ ๊ฐ€๋™ ์‹œ์ž‘!");
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.userSelect = 'none';
562
- e.preventDefault();
563
  }
564
 
565
  function onMouseMove(e) {
 
 
 
566
  const currentX = e.clientX || e.pageX;
567
- const width = Math.max(50, startWidth + (currentX - startX));
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.userSelect = '';
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