automatically switch to linux/mac if detected

This commit is contained in:
Hölting, Moritz (Intern) 2025-08-06 10:23:35 +02:00
parent 8dc0d2cbaf
commit cb1a30881d
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,31 @@
<script defer>
const isLinux = /Linux/.test(window.navigator.platform) || ["Macintosh", "MacIntel", "MacPOC", "Mac68K"].indexOf(window.navigator.platform) !== -1;
if (isLinux) {
(async () => {
function waitForElements(selector) {
return new Promise(resolve => {
if (document.querySelectorAll(selector).length > 0) {
return resolve(document.querySelectorAll(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
observer.disconnect();
resolve(document.querySelectorAll(selector));
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
waitForElements("starlight-tabs a").then(() => {
setTimeout(() => {
document.querySelectorAll("starlight-tabs a").values().filter(el => el.innerText === "Linux / macOS").forEach(el => el.click());
}, 1000);
});
})()
}
</script>

View File

@ -3,10 +3,10 @@ title: Getting Started
description: Get started with Shulkerscript
---
import { Steps, FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
import OsTabSwitcher from '../../../components/OsTabSwitcher.astro';
## Installation
To get started with Shulkerscript, you need to install the Shulkerscript CLI.
You can either [download](#download-from-github) the latest release from the GitHub releases page or [build it from source](#building-from-source).
@ -15,6 +15,7 @@ If you want to try out Shulkerscript without installing anything, you can use th
:::
### Quickinstall script *(recommended)*
<OsTabSwitcher />
<Steps>
1. <Tabs>
<TabItem label="Windows" icon="seti:windows">