|
1 | | - |
2 | 1 | // Main download section with OS detection |
3 | 2 | .download-main.mg3t |
4 | 3 | .download-hero |
@@ -202,18 +201,30 @@ script. |
202 | 201 | document.addEventListener('DOMContentLoaded', function() { |
203 | 202 | const tabButtons = document.querySelectorAll('.tab-btn'); |
204 | 203 | const tabPanels = document.querySelectorAll('.tab-panel'); |
205 | | - |
| 204 | + |
| 205 | + function activateTab(tabName) { |
| 206 | + tabButtons.forEach(btn => { |
| 207 | + const isTarget = btn.getAttribute('data-tab') === tabName; |
| 208 | + btn.classList.toggle('active', isTarget); |
| 209 | + }); |
| 210 | + tabPanels.forEach(panel => { |
| 211 | + const isTarget = panel.getAttribute('data-tab') === tabName; |
| 212 | + panel.classList.toggle('active', isTarget); |
| 213 | + }); |
| 214 | + } |
| 215 | + |
| 216 | + // Set default tab based on detected OS |
| 217 | + try { |
| 218 | + const os = typeof detectOS === 'function' ? detectOS() : 'windows'; |
| 219 | + activateTab(os); |
| 220 | + } catch (e) { |
| 221 | + activateTab('windows'); |
| 222 | + } |
| 223 | + |
206 | 224 | tabButtons.forEach(button => { |
207 | 225 | button.addEventListener('click', function() { |
208 | 226 | const targetTab = this.getAttribute('data-tab'); |
209 | | - |
210 | | - // Remove active class from all buttons and panels |
211 | | - tabButtons.forEach(btn => btn.classList.remove('active')); |
212 | | - tabPanels.forEach(panel => panel.classList.remove('active')); |
213 | | - |
214 | | - // Add active class to clicked button and corresponding panel |
215 | | - this.classList.add('active'); |
216 | | - document.querySelector(`.tab-panel[data-tab="${targetTab}"]`).classList.add('active'); |
| 227 | + activateTab(targetTab); |
217 | 228 | }); |
218 | 229 | }); |
219 | 230 | }); |
|
0 commit comments