mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-28 08:57:32 +01:00
39 lines
922 B
JavaScript
39 lines
922 B
JavaScript
const { app, BrowserWindow, Menu, globalShortcut, shell } = require("electron");
|
|
|
|
Menu.setApplicationMenu(false);
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
show: false,
|
|
webPreferences: {
|
|
devTools: true,
|
|
},
|
|
});
|
|
|
|
win.removeMenu();
|
|
win.maximize();
|
|
win.loadFile("index.html");
|
|
win.show();
|
|
win.webContents.openDevTools();
|
|
globalShortcut.register("f5", function () {
|
|
win.loadFile("index.html");
|
|
});
|
|
globalShortcut.register("f8", function () {
|
|
win.loadFile("index.html", { query: { noScripts: "true" } });
|
|
});
|
|
|
|
win.webContents.on("new-window", function (e, url) {
|
|
// make sure local urls stay in electron perimeter
|
|
if ("file://" === url.substr(0, "file://".length)) {
|
|
return;
|
|
}
|
|
|
|
// and open every other protocols on the browser
|
|
e.preventDefault();
|
|
shell.openExternal(url);
|
|
});
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
});
|