This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
106 lines (83 loc) · 2.5 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Importations
const { app, ipcMain, BrowserWindow, shell } = require("electron");
const path = require("path");
// --------------------
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
menu: false,
title: "Pentagone II Launcher",
icon: path.join(__dirname, "./assets/images/ICON_ROND/PentagoneII-IconLogo-Blanc_RondBleu.png"),
resizable: true,
width: 1300,
height: 750,
minWidth: 1250,
minHeight: 650,
center: true,
webPreferences: {
nodeIntegration: true,
devTools: true,
nodeIntegrationInWorker: true,
enableRemoteModule: true,
webSecurity: true,
contextIsolation: false
},
});
mainWindow.loadFile(path.join(__dirname, "./index.html")); // /!\ A MODIFIER /!\
mainWindow.setMenuBarVisibility(false);
mainWindow.webContents.on('new-window', function (e, url) { // Ouvrir les URL dans le navigateur
if ('file://' === url.substr(0, 'file://'.length)) {
return;
}
e.preventDefault();
shell.openExternal(url);
});
}
app.whenReady().then(() => {
createWindow();
app.on("activate", function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on("window-all-closed", function () {
if (process.platform != "darwin") app.quit();
});
ipcMain.on("quit", () => {
app.quit()
})
ipcMain.on("noLogged", () => {
mainWindow.loadFile(path.join(__dirname, "login.html"))
})
ipcMain.on("login", () => {
mainWindow.loadFile(path.join(__dirname, "app.html"))
})
ipcMain.on("play", (event, data) => {
mainWindow.loadFile(path.join(__dirname, "launch.html"))
.then(function () {
event.sender.send("data", { appData: app.getPath("appData"), })
})
})
ipcMain.on("logout", (event, user) => {
mainWindow.loadFile(path.join(__dirname, "login.html"))
})
ipcMain.on("loadingLauncher", () => {
mainWindow.loadFile(path.join(__dirname, "loading.html"))
})
ipcMain.on("news", () => {
mainWindow.loadFile(path.join(__dirname, "news.html"))
})
ipcMain.on("diapo", () => {
mainWindow.loadFile(path.join(__dirname, "diapo.html"))
})
ipcMain.on("settings", () => {
mainWindow.loadFile(path.join(__dirname, "settings.html"))
})
ipcMain.on("backhome", () => {
mainWindow.loadFile(path.join(__dirname, "index.html"))
})
ipcMain.on("backapp", () => {
mainWindow.loadFile(path.join(__dirname, "app.html"))
})
ipcMain.on("quit", () => {
app.quit();
})