-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
108 lines (90 loc) · 2.21 KB
/
main.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
107
108
const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
const { electron } = require('process')
const shell = require('electron').shell
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
let win = null;
var settingsWin = null;
function createWindow () {
win = new BrowserWindow({
frame: false,
width: 1250,
height: 750,
backgroundColor: '#262626',
icon: path.join(__dirname, "src/res/orange.png"),
//icon: 'http://dcrft.pl/uploads/60507a7abea3c2456d59f979/dcrft_shadow_fixed.ico',
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
settingsWin = new BrowserWindow({
frame: false,
width: 625,
height: 375,
show: false,
resizable: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
settingsWin.loadFile('src/settings/settings.html');
ipcMain.on('settings', function () {
if (settingsWin.isVisible())
settingsWin.hide()
else
settingsWin.show()
})
win.loadFile('src/index.html');
// win.maximize();
// win.webContents.openDevTools()
}
app.whenReady().then(createWindow);
/*var request = new XMLHttpRequest();
request.open('GET', 'http://site12079.web1.titanaxe.com/dcrftlauncher.php?action=joined');
request.send();*/
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
ipcMain.on('close-app', (event) => {
app.quit();
});
ipcMain.on('close-settings', (event) => {
win.webContents.send("close-settings");
settingsWin.hide();
});
ipcMain.on('minimize-app', (event) => {
win.minimize();
});
ipcMain.on('maximize-app', (event) => {
if ( win.isMaximized() ) {
win.unmaximize();
} else {
win.maximize();
}
});
ipcMain.on('devtools', (event) => {
win.webContents.openDevTools()
});
ipcMain.on('devtools1', (event) => {
settingsWin.webContents.openDevTools()
});
ipcMain.on('reload-app', (event) => {
app.relaunch();
app.quit();
});
ipcMain.on('hideLauncher', (event) => {
win.hide();
});
ipcMain.on('showLauncher', (event) => {
win.show();
});