4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00
Launcher/script.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-12-05 21:08:32 +01:00
const {remote} = require('electron');
const {Menu, BrowserWindow, MenuItem, shell} = remote;
const {
getCurrentWindow,
minimizeWindow,
unmaximizeWindow,
maxUnmaxWindow,
isWindowMaximized,
closeWindow,
} = require("./menubar.js");
window.addEventListener("DOMContentLoaded", () => {
window.getCurrentWindow = getCurrentWindow;
window.minimizeWindow = minimizeWindow;
window.unmaximizeWindow = unmaximizeWindow;
window.maxUnmaxWindow = maxUnmaxWindow;
window.isWindowMaximized = isWindowMaximized;
window.closeWindow = closeWindow;
const minimizeButton = document.getElementById("minimize-btn");
const maxUnmaxButton = document.getElementById("max-unmax-btn");
const closeButton = document.getElementById("close-btn");
minimizeButton.addEventListener("click", e => {
window.minimizeWindow();
});
maxUnmaxButton.addEventListener("click", e => {
const icon = maxUnmaxButton.querySelector("#icon-maxUnmax");
window.maxUnmaxWindow();
// Change the middle maximize-unmaximize icons.
if (window.isWindowMaximized()) {
icon.classList.remove("icon-square");
icon.classList.add("icon-clone");
} else {
icon.classList.add("icon-square");
icon.classList.remove("icon-clone");
}
});
closeButton.addEventListener("click", e => {
window.closeWindow();
});
});