freeftf/downloadList.js

73 lines
2.6 KiB
JavaScript
Raw Normal View History

2024-08-15 14:54:04 +02:00
/*
* freeftf website
* Copyright (C) 2024 Patrick_Pluto
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2024-08-15 15:00:20 +02:00
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
2024-08-15 06:06:49 +02:00
// 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);
});
2024-08-15 15:04:04 +02:00
// @license-end