UI: Improve multi OS display #205
@ -129,6 +129,21 @@
|
|||||||
const activePlatform = navigator.platform.toLowerCase();
|
const activePlatform = navigator.platform.toLowerCase();
|
||||||
const activePlatformPrefix = activePlatform.substring(0, 3);
|
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) {
|
btnInstallActionItem.forEach(function(item) {
|
||||||
// Hide all items by default
|
// Hide all items by default
|
||||||
item.classList.add('d-none');
|
item.classList.add('d-none');
|
||||||
@ -147,6 +162,15 @@
|
|||||||
if (itemPlatformBasePrefix.startsWith(activePlatformPrefix)) {
|
if (itemPlatformBasePrefix.startsWith(activePlatformPrefix)) {
|
||||||
item.classList.add('btn-install-action-item-active');
|
item.classList.add('btn-install-action-item-active');
|
||||||
item.classList.remove('d-none');
|
item.classList.remove('d-none');
|
||||||
|
|
||||||
|
// TODO: WIP show only relevant item for active macOS architecture, if architecture detection reliably works
|
||||||
|
if (activePlatformPrefix.startsWith('mac')) {
|
||||||
|
if (isArchARM()) {
|
||||||
|
console.log('Platform: macOS Apple Silicon');
|
||||||
|
} else {
|
||||||
|
console.log('Platform: macOS Intel');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user