UI: Improve multi OS display #205

Merged
Oleg-Komarov merged 40 commits from ui/multi-os into main 2024-07-16 07:24:07 +02:00
Showing only changes of commit 65ae4a9623 - Show all commits

View File

@ -106,6 +106,28 @@
// Create variables multiple
const btnInstallActionItem = document.querySelectorAll('.js-btn-install-action-item');
// Create function isArchARM
function isArchARM() {
// Check if userAgentData and getHighEntropyValues are supported
if (navigator.userAgentData && navigator.userAgentData.getHighEntropyValues) {
navigator.userAgentData
.getHighEntropyValues(["architecture"])
.then((values) => {
// Extract the architecture value
const arch = values.architecture;
// Check if the architecture is ARM
if (arch.toLowerCase().includes('arm')) {
return true;
} else {
return false;
}
});
} else {
// Fallback for browsers that do not support userAgentData or getHighEntropyValues
return false;
}
}
if (btnInstall == null) {
return;
}
@ -129,21 +151,6 @@
const activePlatform = navigator.platform.toLowerCase();
const activePlatformPrefix = activePlatform.substring(0, 3);
// Create function to detect architecture ARM
function isArchARM() {
let isARM = false;
// Newer browsers
if (navigator.userAgentData && navigator.userAgentData.platform) {
isARM = navigator.userAgentData.platform.includes('ARM');
} else {
// Fallback for older browsers
isARM = navigator.userAgent.includes('ARM') || navigator.userAgent.includes('arm');
}
return isARM;
}
btnInstallActionItem.forEach(function(item) {
// Hide all items by default
item.classList.add('d-none');