|
66 | 66 | window.share_id = "{{share_id}}";
|
67 | 67 | window.share_url = "{{share_url}}";
|
68 | 68 | window.start_id = "{{conversation_id}}";
|
69 |
| - |
70 |
| - // Initialize collapsible sections when the page loads |
71 |
| - document.addEventListener('DOMContentLoaded', function() { |
72 |
| - const collapsibleHeaders = document.querySelectorAll('.collapsible-header'); |
73 |
| - collapsibleHeaders.forEach(header => { |
74 |
| - // Ensure sections are collapsed by default |
75 |
| - const content = header.nextElementSibling; |
76 |
| - content.classList.add('hidden'); |
77 |
| - content.style.display = "none"; |
78 |
| - content.style.maxHeight = "0"; |
79 |
| - |
80 |
| - // Update arrow direction |
81 |
| - const arrow = header.querySelector('i.fa-solid'); |
82 |
| - arrow.classList.remove('fa-chevron-down'); |
83 |
| - arrow.classList.add('fa-chevron-right'); |
84 |
| - |
85 |
| - header.addEventListener('click', function() { |
86 |
| - this.classList.toggle('active'); |
87 |
| - const content = this.nextElementSibling; |
88 |
| - const arrow = this.querySelector('i.fa-solid'); |
89 |
| - |
90 |
| - if (this.classList.contains('active')) { |
91 |
| - content.classList.remove('hidden'); |
92 |
| - content.style.display = "block"; |
93 |
| - setTimeout(() => { |
94 |
| - content.style.maxHeight = content.scrollHeight + "px"; |
95 |
| - }, 10); |
96 |
| - arrow.classList.remove('fa-chevron-right'); |
97 |
| - arrow.classList.add('fa-chevron-down'); |
98 |
| - } else { |
99 |
| - content.style.maxHeight = "0"; |
100 |
| - setTimeout(() => { |
101 |
| - content.classList.add('hidden'); |
102 |
| - content.style.display = "none"; |
103 |
| - }, 300); |
104 |
| - arrow.classList.remove('fa-chevron-down'); |
105 |
| - arrow.classList.add('fa-chevron-right'); |
106 |
| - } |
107 |
| - }); |
108 |
| - }); |
109 |
| - |
110 |
| - // Override functions to prevent duplicate provider sections |
111 |
| - window.setupCollapsibleFields = function() { |
112 |
| - // Only initialize the collapsible headers that don't already have event listeners |
113 |
| - const collapsibleHeaders = document.querySelectorAll('.collapsible-header:not([data-initialized])'); |
114 |
| - collapsibleHeaders.forEach(header => { |
115 |
| - // Mark as initialized to prevent duplicate event listeners |
116 |
| - header.setAttribute('data-initialized', 'true'); |
117 |
| - |
118 |
| - // Remove existing event listeners by cloning and replacing |
119 |
| - const newHeader = header.cloneNode(true); |
120 |
| - header.parentNode.replaceChild(newHeader, header); |
121 |
| - |
122 |
| - newHeader.addEventListener('click', function() { |
123 |
| - this.classList.toggle('active'); |
124 |
| - const content = this.nextElementSibling; |
125 |
| - |
126 |
| - if (content.classList.contains('hidden')) { |
127 |
| - content.classList.remove('hidden'); |
128 |
| - content.style.display = "block"; |
129 |
| - setTimeout(() => { |
130 |
| - content.style.maxHeight = (content.scrollHeight + 100) + "px"; |
131 |
| - }, 10); |
132 |
| - } else { |
133 |
| - content.style.maxHeight = "0"; |
134 |
| - setTimeout(() => { |
135 |
| - content.classList.add('hidden'); |
136 |
| - content.style.display = "none"; |
137 |
| - }, 300); |
138 |
| - } |
139 |
| - }); |
140 |
| - }); |
141 |
| - }; |
142 |
| - |
143 |
| - // Initialize our provider sections |
144 |
| - const initializeProviderSections = function() { |
145 |
| - // Get our provider sections |
146 |
| - const providerSections = document.querySelectorAll('.provider-section'); |
147 |
| - |
148 |
| - // Initialize each section |
149 |
| - providerSections.forEach(section => { |
150 |
| - const header = section.querySelector('.collapsible-header'); |
151 |
| - const content = section.querySelector('.collapsible-content'); |
152 |
| - |
153 |
| - if (header && content) { |
154 |
| - // Add click event to header |
155 |
| - header.addEventListener('click', function() { |
156 |
| - this.classList.toggle('active'); |
157 |
| - |
158 |
| - if (this.classList.contains('active')) { |
159 |
| - content.classList.remove('hidden'); |
160 |
| - content.style.display = "block"; |
161 |
| - setTimeout(() => { |
162 |
| - content.style.maxHeight = content.scrollHeight + "px"; |
163 |
| - }, 10); |
164 |
| - } else { |
165 |
| - content.style.maxHeight = "0"; |
166 |
| - setTimeout(() => { |
167 |
| - content.classList.add('hidden'); |
168 |
| - content.style.display = "none"; |
169 |
| - }, 300); |
170 |
| - } |
171 |
| - }); |
172 |
| - } |
173 |
| - }); |
174 |
| - }; |
175 |
| - |
176 |
| - // Call the initialization function when the page loads |
177 |
| - document.addEventListener('DOMContentLoaded', initializeProviderSections); |
178 |
| - |
179 |
| - // Also call it when the settings panel is opened |
180 |
| - document.querySelector('.settings_icon').addEventListener('click', function() { |
181 |
| - setTimeout(initializeProviderSections, 100); |
182 |
| - }); |
183 |
| - }); |
184 | 69 | </script>
|
185 | 70 | <title>G4F Chat</title>
|
186 | 71 | </head>
|
|
0 commit comments