EZPPLauncher/preload/preload.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-10-16 13:54:29 +00:00
const { ipcRenderer } = require('electron');
const { Titlebar, Color } = require('custom-electron-titlebar');
let titlebar;
window.addEventListener('DOMContentLoaded', () => {
titlebar = new Titlebar({
backgroundColor: Color.fromHex("#303030"),
itemBackgroundColor: Color.fromHex("#121212"),
menu: null,
maximizable: false
});
titlebar.updateTitle("EZPPLauncher");
const $ = require('jquery');
$("#folder-btn").on('click', async () => {
2022-10-16 14:47:43 +00:00
const success = await ipcRenderer.invoke('set-osu-dir');
if (success == undefined)
return;
2022-10-16 16:42:04 +00:00
if (success) {
2022-10-16 19:13:30 +00:00
//TODO: Alert User, folder set.
2022-10-16 16:42:04 +00:00
} else {
//TODO: Alert User, invalid osu folder selected
}
2022-10-16 13:54:29 +00:00
});
2022-10-16 19:13:30 +00:00
ipcRenderer.on('status_update', (event, status) => {
switch (status.type) {
case "up-to-date":
$("#launch-btn").attr('disabled', false);
$('#launch-btn').html('Launch');
break;
case "update-available":
$("#launch-btn").attr('disabled', false);
$('#launch-btn').html('Update');
break;
}
})
2022-10-16 13:54:29 +00:00
})