2023-11-27 17:27:39 +03:00
|
|
|
// Based on https://stackoverflow.com/a/38241481/724176
|
|
|
|
function getOS() {
|
|
|
|
const userAgent = window.navigator.userAgent,
|
2023-11-28 11:41:16 +03:00
|
|
|
platform = window.navigator.userAgentData?.platform || window.navigator.platform,
|
2023-11-27 17:27:39 +03:00
|
|
|
macosPlatforms = ["macOS", "Macintosh", "MacIntel", "MacPPC", "Mac68K"],
|
2023-11-28 11:48:31 +03:00
|
|
|
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
|
2023-11-27 17:27:39 +03:00
|
|
|
|
|
|
|
if (macosPlatforms.includes(platform)) {
|
|
|
|
return "macOS";
|
|
|
|
} else if (windowsPlatforms.includes(platform)) {
|
|
|
|
return "Windows";
|
|
|
|
} else if (/Android/.test(userAgent)) {
|
|
|
|
return "Android";
|
|
|
|
} else if (/Linux/.test(platform)) {
|
|
|
|
return "Linux";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function activateTab(tabName) {
|
2023-11-28 11:39:38 +03:00
|
|
|
// Find all label elements with the specified tab name
|
2023-11-27 17:27:39 +03:00
|
|
|
const labels = document.querySelectorAll(".tab-label");
|
|
|
|
|
|
|
|
labels.forEach((label) => {
|
2023-11-27 22:54:50 +03:00
|
|
|
if (label.textContent == tabName) {
|
2023-11-28 11:48:31 +03:00
|
|
|
// Find the associated input element using the "for" attribute
|
2023-11-27 17:27:39 +03:00
|
|
|
const tabInputId = label.getAttribute("for");
|
|
|
|
const tabInput = document.getElementById(tabInputId);
|
|
|
|
|
|
|
|
// Check if the input element exists before attempting to set the "checked" attribute
|
|
|
|
if (tabInput) {
|
|
|
|
// Activate the tab by setting its "checked" attribute to true
|
|
|
|
tabInput.checked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|