oliver-aizip kai-aizip commited on
Commit
c0c83e3
·
verified ·
1 Parent(s): e101547

Delete static/js (#21)

Browse files

- Delete static/js (25dd629c0769dcb055888d66eff2e397a024f073)


Co-authored-by: Kai <kai-aizip@users.noreply.huggingface.co>

Files changed (1) hide show
  1. static/js/scroll_helpers.js +0 -51
static/js/scroll_helpers.js DELETED
@@ -1,51 +0,0 @@
1
- /**
2
- * Script to handle text scrolling in the RAG Summarizer Arena
3
- * Uses a simplified approach relying primarily on Gradio's autoscroll parameter
4
- */
5
-
6
- // Scroll to the query section when loading new content
7
- function scrollToQuerySection() {
8
- const querySection = document.getElementById('query-section');
9
- if (querySection) {
10
- setTimeout(() => {
11
- querySection.scrollIntoView({ behavior: 'smooth', block: 'start' });
12
- console.log('Scrolled to query section');
13
- }, 300); // Small delay to ensure content is loaded
14
- }
15
- }
16
-
17
- // Set up event listeners when DOM is loaded
18
- document.addEventListener('DOMContentLoaded', function() {
19
- console.log('Setting up basic scroll helpers...');
20
-
21
- // Monitor button clicks for scrolling to the query section
22
- function setupButtonListeners() {
23
- const tryAnotherBtn = document.getElementById('try-another-btn');
24
- if (tryAnotherBtn && !tryAnotherBtn.hasAttribute('data-scroll-handler')) {
25
- tryAnotherBtn.addEventListener('click', scrollToQuerySection);
26
- tryAnotherBtn.setAttribute('data-scroll-handler', 'true');
27
- console.log('Added listener to try-another-btn');
28
- }
29
-
30
- const randomQuestionBtn = document.querySelector('.query-button');
31
- if (randomQuestionBtn && !randomQuestionBtn.hasAttribute('data-scroll-handler')) {
32
- randomQuestionBtn.addEventListener('click', scrollToQuerySection);
33
- randomQuestionBtn.setAttribute('data-scroll-handler', 'true');
34
- console.log('Added listener to query-button');
35
- }
36
- }
37
-
38
- // Set up button listeners
39
- setupButtonListeners();
40
-
41
- // Watch for DOM changes to catch dynamically added elements
42
- const bodyObserver = new MutationObserver(() => {
43
- setupButtonListeners();
44
- });
45
-
46
- // Start observing the body for changes
47
- bodyObserver.observe(document.body, {
48
- childList: true,
49
- subtree: true
50
- });
51
- });