Update DiscordPreview.js

This commit is contained in:
Mirco Wittrien 2020-04-11 18:43:30 +02:00
parent 41117f315b
commit 4306107b9a
1 changed files with 16 additions and 0 deletions

View File

@ -69,6 +69,22 @@
if (data.titlebar) document.querySelector(".preview-titlebar").outerHTML = data.titlebar;
document.body.firstElementChild.style.removeProperty("display");
let electron = require("electron");
if (electron) {
let browserWindow = electron.remote.getCurrentWindow();
if (browserWindow) {
let closeButton = document.querySelector(dotCNC.titlebarmacbuttonclose + dotCN.titlebarwinbuttonclose);
if (closeButton) closeButton.addEventListener("click", browserWindow.close);
let maxButton = document.querySelector(dotCNC.titlebarmacbuttonmax + dotCN.titlebarwinbuttonminmax)
if (maxButton) maxButton.addEventListener("click", _ => {
if (browserWindow.isMaximized()) browserWindow.unmaximize();
else browserWindow.maximize();
});
let minButton = document.querySelector(dotCNC.titlebarmacbuttonmax + dotCN.titlebarwinbuttonminmax + ":last-child")
if (minButton) minButton.addEventListener("click", browserWindow.minimize);
}
}
break;
case "Eval":
window.evalResult = null;