mirror of
https://github.com/Motschen/midnightdust-eu.git
synced 2025-12-17 11:05:08 +01:00
Improve reliability of the version selector
This commit is contained in:
@@ -3,8 +3,7 @@ import { Icon } from 'astro-icon/components'
|
|||||||
import { loaderList, versionList} from '../js/modversion.js'
|
import { loaderList, versionList} from '../js/modversion.js'
|
||||||
---
|
---
|
||||||
|
|
||||||
<div id="version-dropdown">
|
<version-dropdown>
|
||||||
<div class="">
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<label for="loader-selector" class="sr-only">Select the Modloader</label>
|
<label for="loader-selector" class="sr-only">Select the Modloader</label>
|
||||||
<select
|
<select
|
||||||
@@ -28,11 +27,13 @@ import { loaderList, versionList} from '../js/modversion.js'
|
|||||||
<Icon name="ion:copy-outline"></Icon>
|
<Icon name="ion:copy-outline"></Icon>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</version-dropdown>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getResultingVersion, setGameVersion, setLoaderVersion } from "../js/modversion";
|
import { getResultingVersion, setGameVersion, setLoaderVersion } from "../js/modversion";
|
||||||
|
// Define the behaviour for our new type of HTML element.
|
||||||
|
class VersionDropdown extends HTMLElement {
|
||||||
|
connectedCallback() {
|
||||||
// Get the gradle.properties code block
|
// Get the gradle.properties code block
|
||||||
const versionLabel = document.getElementById("midnightlib-version");
|
const versionLabel = document.getElementById("midnightlib-version");
|
||||||
// Get the 2 selectors defined above
|
// Get the 2 selectors defined above
|
||||||
@@ -55,7 +56,10 @@ import { getResultingVersion, setGameVersion, setLoaderVersion } from "../js/mod
|
|||||||
setGameVersion(value);
|
setGameVersion(value);
|
||||||
if (versionLabel) versionLabel.innerText = `midnightlib_version = `+getResultingVersion();
|
if (versionLabel) versionLabel.innerText = `midnightlib_version = `+getResultingVersion();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Tell the browser to use our VersionDropdown class for <version-dropdown> elements.
|
||||||
|
customElements.define('version-dropdown', VersionDropdown);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" is:global>
|
<style lang="scss" is:global>
|
||||||
|
|||||||
Reference in New Issue
Block a user