FCLauncher/FCLauncher/src/main.js

60 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-06-22 17:17:07 -06:00
const { invoke } = window.__TAURI__.tauri;
let greetInputEl;
let greetMsgEl;
async function greet() {
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
2024-06-22 18:36:47 -06:00
greetMsgEl.textContent = "testing";
//greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value });
2024-06-22 17:17:07 -06:00
}
window.addEventListener("DOMContentLoaded", () => {
greetInputEl = document.querySelector("#greet-input");
greetMsgEl = document.querySelector("#greet-msg");
document.querySelector("#greet-form").addEventListener("submit", (e) => {
e.preventDefault();
greet();
});
});
2024-06-22 18:36:47 -06:00
function packSelect() {
document.getElementById("myDropdown").classList.toggle("show");
}
function load() {
console.log("loading");
var dropdown = document.getElementById("Modpacks");
var opt = document.createElement("option");
opt.text = 'something';
opt.value = 'somethings value';
dropdown.options.add(opt);
}
window.onload = async function() {
invoke("get_modpacks").then(addModpacks);
}
function addModpacks(modpacks) {
var dropdown = document.getElementById("Modpacks");
var opt = document.createElement("option");
opt.text = modpacks[0];
opt.value = 'somethings value';
dropdown.options.add(opt);
}
//window.onclick = function(event) {
//if (!event.target.matches('.dropbtn')) {
//var dropdowns = document.getElementsByClassName("dropdown-content");
//var i;
//for (i = 0; i < dropdowns.length; i++) {
//var openDropdown = dropdowns[i];
//if (openDropdown.classList.contains('show')) {
//openDropdown.classList.remove('show');
//}
//}
//}
//}