This repository has been archived on 2024-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
awesome-xlabs/localappdata/xlabs/data/launcher-ui/pages/iw6x.html

58 lines
1.7 KiB
HTML
Raw Normal View History

2023-08-13 16:46:26 -04:00
<div class="grid">
<span class="a container card" id="ghosts-sp">
<span class="title">Singleplayer</span>
<span class="content img" style="background-image: url(./img/iw6x-sp.png)"></span>
</span>
<span class="a container card" id="ghosts-mp">
<span class="title">Multiplayer</span>
<span class="content img" style="background-image: url(./img/iw6x-mp.png)"></span>
</span>
</div>
<style>
#content>.grid {
flex: 1 1 auto;
width: 100%;
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: minmax(100px, auto);
}
</style>
<script>
(function () {
function launchGhostsVariant(id) {
executeCommand('launch-ghosts', id);
}
function showConfigureWarning() {
window.showMessageBox("⚙ IW6x not configured",
"You have not configured your <b>Ghosts installation</b> path.<br><br>Please do so in the settings!",
["Ok"]).then(index => {
window.showSettings();
});
}
function handleGhosts() {
const el = this;
const id = el.id;
executeCommand('get-property', 'ghosts-install').then(folder => {
console.log(folder);
if (!folder) {
showConfigureWarning();
}
else {
launchGhostsVariant(id);
}
});
}
const ghostsNnodes = document.querySelectorAll("#content>.grid>.a");
for (var i = 0; i < ghostsNnodes.length; ++i) {
const node = ghostsNnodes[i];
node.onclick = handleGhosts;
}
})();
</script>