You've already forked Openterface_assets
mirror of
https://github.com/TechxArtisanStudio/Openterface_assets.git
synced 2025-06-10 16:33:42 -07:00
add platform-specific download button functionality
This commit is contained in:
@@ -40,3 +40,53 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
setTimeout(showSlides, 6000);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.platform-download').forEach(function(block) {
|
||||
const mainBtn = block.querySelector('.big-download-btn, .btnappstore, .btngogoleplay');
|
||||
block.querySelectorAll('.format-option').forEach(function(opt) {
|
||||
opt.addEventListener('click', function() {
|
||||
block.querySelectorAll('.format-option').forEach(o => o.classList.remove('selected'));
|
||||
opt.classList.add('selected');
|
||||
mainBtn.href = opt.dataset.href;
|
||||
mainBtn.textContent = 'Download ' + opt.dataset.label;
|
||||
|
||||
// Special case for macOS App Store
|
||||
if (block.dataset.platform === 'macos') {
|
||||
if (opt.dataset.label === 'App Store') {
|
||||
mainBtn.classList.remove('big-download-btn', 'macos');
|
||||
mainBtn.classList.add('btnappstore');
|
||||
mainBtn.textContent = '';
|
||||
} else {
|
||||
mainBtn.classList.remove('btnappstore');
|
||||
mainBtn.classList.add('big-download-btn', 'macos');
|
||||
}
|
||||
}
|
||||
|
||||
// Special case for Android Play Store
|
||||
if (block.dataset.platform === 'android') {
|
||||
if (opt.dataset.label === 'Play Store') {
|
||||
mainBtn.classList.remove('big-download-btn', 'android');
|
||||
mainBtn.classList.add('btngogoleplay');
|
||||
mainBtn.textContent = '';
|
||||
} else {
|
||||
mainBtn.classList.remove('btngogoleplay');
|
||||
mainBtn.classList.add('big-download-btn', 'android');
|
||||
}
|
||||
}
|
||||
|
||||
// Special case for Linux Flathub
|
||||
if (block.dataset.platform === 'linux') {
|
||||
if (opt.dataset.label === 'FlatHub') {
|
||||
mainBtn.classList.remove('big-download-btn', 'linux');
|
||||
mainBtn.classList.add('btnflathub');
|
||||
mainBtn.textContent = '';
|
||||
} else {
|
||||
mainBtn.classList.remove('btnflathub');
|
||||
mainBtn.classList.add('big-download-btn', 'linux');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user