Spaces:
Sleeping
Sleeping
clean js
Browse files
app.py
CHANGED
@@ -2613,65 +2613,6 @@ HEAD = """
|
|
2613 |
});
|
2614 |
}
|
2615 |
</script>
|
2616 |
-
|
2617 |
-
<script>
|
2618 |
-
function changeImage(direction, count, galleryIndex) {
|
2619 |
-
// Find the current visible image by iterating over possible indices
|
2620 |
-
var currentImage = null;
|
2621 |
-
var currentIndex = -1;
|
2622 |
-
for (var i = 0; i < count; i++) {
|
2623 |
-
var img = document.querySelector('.slide-image-' + galleryIndex + '-' + i);
|
2624 |
-
if (img && img.style.display !== 'none') {
|
2625 |
-
currentImage = img;
|
2626 |
-
currentIndex = i;
|
2627 |
-
break;
|
2628 |
-
}
|
2629 |
-
}
|
2630 |
-
|
2631 |
-
// If no current image is visible, show the first one and return
|
2632 |
-
if (currentImage === null) {
|
2633 |
-
document.querySelector('.slide-image-' + galleryIndex + '-0').style.display = 'block';
|
2634 |
-
console.error('No current image found for galleryIndex ' + galleryIndex + ', defaulting to first image.');
|
2635 |
-
return;
|
2636 |
-
}
|
2637 |
-
|
2638 |
-
// Hide the current image
|
2639 |
-
currentImage.style.display = 'none';
|
2640 |
-
|
2641 |
-
// Calculate the index of the next image to show
|
2642 |
-
var newIndex = (currentIndex + direction + count) % count;
|
2643 |
-
|
2644 |
-
// Select the next image and show it
|
2645 |
-
var nextImage = document.querySelector('.slide-image-' + galleryIndex + '-' + newIndex);
|
2646 |
-
if (nextImage) {
|
2647 |
-
nextImage.style.display = 'block';
|
2648 |
-
} else {
|
2649 |
-
console.error('No image found for galleryIndex ' + galleryIndex + ' and newIndex ' + newIndex);
|
2650 |
-
}
|
2651 |
-
}
|
2652 |
-
</script>
|
2653 |
-
|
2654 |
-
<script>
|
2655 |
-
var selectButtons = document.querySelectorAll('.chatbot_select_btn');
|
2656 |
-
|
2657 |
-
// 为每个按钮添加点击事件监听器
|
2658 |
-
selectButtons.forEach(function(button) {
|
2659 |
-
button.addEventListener('click', function() {
|
2660 |
-
// 获取 #chatbot_select_accordion 下的第一个 button 元素
|
2661 |
-
var firstButton = document.querySelector('#chatbot_select_accordion button');
|
2662 |
-
var displayDiv = document.querySelector('#chatbot_select_accordion div:nth-child(3)');
|
2663 |
-
// 检查这个按钮是否存在
|
2664 |
-
if (firstButton) {
|
2665 |
-
// 移除 'open' 类
|
2666 |
-
firstButton.classList.remove('open');
|
2667 |
-
}
|
2668 |
-
if (displayDiv) {
|
2669 |
-
// display none
|
2670 |
-
displayDiv.style.display = 'none';
|
2671 |
-
}
|
2672 |
-
});
|
2673 |
-
});
|
2674 |
-
</script>
|
2675 |
"""
|
2676 |
|
2677 |
with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, secondary_hue=gr.themes.colors.amber, text_size = gr.themes.sizes.text_lg), head=HEAD) as demo:
|
|
|
2613 |
});
|
2614 |
}
|
2615 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2616 |
"""
|
2617 |
|
2618 |
with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, secondary_hue=gr.themes.colors.amber, text_size = gr.themes.sizes.text_lg), head=HEAD) as demo:
|