StardewModLauncher/assets/index.html

49 lines
883 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Stardew Mod Launcher</title>
</head>
<body>
<h1>Hallo :)</h1>
<button onclick="hello()">Click me!</button>
<h2>Mod list</h2>
<ul id="mod_list">
<li>(not loaded yet)</li>
</ul>
<script>
function hello() {
pywebview.api.hello().then((result) => {
alert(result);
});
}
function list_mods() {
pywebview.api.list_mods().then((mod_list) => {
const list_ul = document.getElementById('mod_list');
list_ul.textContent = '';
mod_list.forEach((item) => {
const new_li = document.createElement('li');
new_li.textContent = item;
list_ul.appendChild(new_li);
});
});
}
window.addEventListener('pywebviewready', () => {
list_mods();
});
</script>
</body>
</html>