freeftf/downloadList.js
2024-08-15 06:06:49 +02:00

50 lines
1.7 KiB
JavaScript

// Define the download options for different platforms
const downloadData = {
"Linux": {
"arm32": "link-to-linux-arm32-download",
"arm64": "link-to-linux-arm64-download",
"x86_32": "link-to-linux-x86-32-download",
"x86_64": "link-to-linux-x86-64-download"
},
"Windows": {
"x86_64": "link-to-windows-x86-64-download",
"arm64": "link-to-windows-arm64-download"
},
"macOS": {
"Universal Binary": "link-to-macos-universal-binary-download"
}
};
// Function to create download links
function generateDownloadList(downloadData) {
const articleElement = document.querySelector('article');
for (let platform in downloadData) {
// Create platform heading
const platformHeading = document.createElement('h2');
platformHeading.textContent = platform;
articleElement.appendChild(platformHeading);
// Create list for the platform downloads
const ulElement = document.createElement('ul');
const downloads = downloadData[platform];
for (let version in downloads) {
const liElement = document.createElement('li');
const linkElement = document.createElement('a');
linkElement.href = downloads[version];
linkElement.textContent = version;
linkElement.setAttribute('download', version); // Optional: prompts the download
liElement.appendChild(linkElement);
ulElement.appendChild(liElement);
}
articleElement.appendChild(ulElement);
}
}
// Run the function to populate the download list on page load
window.addEventListener('DOMContentLoaded', () => {
generateDownloadList(downloadData);
});