Skip to content

Commit 34d8f4c

Browse files
committed
Fix UI
1 parent 233c9b7 commit 34d8f4c

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

src/views/parts/download.pug

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// Main download section with OS detection
32
.download-main.mg3t
43
.download-hero
@@ -202,18 +201,30 @@ script.
202201
document.addEventListener('DOMContentLoaded', function() {
203202
const tabButtons = document.querySelectorAll('.tab-btn');
204203
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+
206224
tabButtons.forEach(button => {
207225
button.addEventListener('click', function() {
208226
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);
217228
});
218229
});
219230
});

0 commit comments

Comments
 (0)