automatically switch to linux/mac if detected
This commit is contained in:
		
							parent
							
								
									8dc0d2cbaf
								
							
						
					
					
						commit
						cb1a30881d
					
				| 
						 | 
					@ -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>
 | 
				
			||||||
| 
						 | 
					@ -3,10 +3,10 @@ title: Getting Started
 | 
				
			||||||
description: Get started with Shulkerscript
 | 
					description: Get started with Shulkerscript
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import { Steps, FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
 | 
					import { Steps, FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
 | 
				
			||||||
 | 
					import OsTabSwitcher from '../../../components/OsTabSwitcher.astro';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Installation
 | 
					## Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
To get started with Shulkerscript, you need to install the Shulkerscript CLI.
 | 
					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).
 | 
					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)*
 | 
					### Quickinstall script *(recommended)*
 | 
				
			||||||
 | 
					<OsTabSwitcher />
 | 
				
			||||||
<Steps>
 | 
					<Steps>
 | 
				
			||||||
1. <Tabs>
 | 
					1. <Tabs>
 | 
				
			||||||
        <TabItem label="Windows" icon="seti:windows">
 | 
					        <TabItem label="Windows" icon="seti:windows">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue