2020-12-08 19:59:56 +01:00
|
|
|
'use strict';
|
|
|
|
const {remote, ipcRenderer} = require('electron');
|
2020-12-05 21:08:32 +01:00
|
|
|
const {
|
|
|
|
getCurrentWindow,
|
|
|
|
minimizeWindow,
|
|
|
|
unmaximizeWindow,
|
|
|
|
maxUnmaxWindow,
|
|
|
|
isWindowMaximized,
|
|
|
|
closeWindow,
|
2020-12-08 19:59:56 +01:00
|
|
|
} = require("./include/menubar.js");
|
2020-12-05 21:08:32 +01:00
|
|
|
|
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
2020-12-08 19:59:56 +01:00
|
|
|
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")
|
2020-12-05 21:08:32 +01:00
|
|
|
|
|
|
|
minimizeButton.addEventListener("click", e => {
|
2020-12-08 19:59:56 +01:00
|
|
|
window.minimizeWindow()
|
|
|
|
})
|
2020-12-05 21:08:32 +01:00
|
|
|
|
|
|
|
maxUnmaxButton.addEventListener("click", e => {
|
2020-12-08 19:59:56 +01:00
|
|
|
const icon = maxUnmaxButton.querySelector("#icon-maxUnmax")
|
2020-12-05 21:08:32 +01:00
|
|
|
|
2020-12-08 19:59:56 +01:00
|
|
|
window.maxUnmaxWindow()
|
2020-12-05 21:08:32 +01:00
|
|
|
|
|
|
|
// Change the middle maximize-unmaximize icons.
|
|
|
|
if (window.isWindowMaximized()) {
|
2020-12-08 19:59:56 +01:00
|
|
|
icon.classList.remove("icon-square")
|
|
|
|
icon.classList.add("icon-clone")
|
2020-12-05 21:08:32 +01:00
|
|
|
} else {
|
2020-12-08 19:59:56 +01:00
|
|
|
icon.classList.add("icon-square")
|
|
|
|
icon.classList.remove("icon-clone")
|
2020-12-05 21:08:32 +01:00
|
|
|
}
|
2020-12-08 19:59:56 +01:00
|
|
|
})
|
2020-12-05 21:08:32 +01:00
|
|
|
|
|
|
|
closeButton.addEventListener("click", e => {
|
2020-12-08 19:59:56 +01:00
|
|
|
window.closeWindow()
|
|
|
|
})
|
|
|
|
})
|