-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
103 lines (99 loc) · 2.41 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>CS:GO HUD</title>
<script src="https://code.jquery.com/jquery-2.2.0.min.js">
</script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel=
"stylesheet">
<script src="./server.js"></script>
<style>
body {
-webkit-user-select: none !important; /* Chrome all / Safari all */
-moz-user-select: none !important; /* Firefox all */
-ms-user-select: none !important; /* IE 10+ */
user-select: none !important; /* Likely future */
}
</style>
</head>
<body>
<script>
var fs = require('fs'),
gui = require('nw.gui'),
win = gui.Window.get();
const dev = !!gui.App.argv.length;
win.on('closed', function() {
tray.remove();
process.exit(0);
});
if (!!dev){
var dev_shortcut = new gui.Shortcut({
key : "Ctrl+Alt+Q",
active : function() {
win.showDevTools();
},
failed : function(msg) {
// fail to register the |key| or couldn't parse the |key|.
console.error(msg);
}
});
gui.App.registerGlobalHotKey(dev_shortcut);
}
var close_shortcut = new gui.Shortcut({
key : "Ctrl+Alt+C",
active : function() {
tray.remove();
win.close();
process.exit(0);
},
failed : function(msg) {
// fail to register the |key| or couldn't parse the |key|.
console.error(msg);
}
});
var min_shortcut = new gui.Shortcut({
key : "Ctrl+Alt+X",
active : function() {
win.minimize();
},
failed : function(msg) {
// fail to register the |key| or couldn't parse the |key|.
console.error(msg);
}
});
var menu_shortcut = new gui.Shortcut({
key : "Ctrl+Alt+Z",
active : function() {
$('body').load('./menu.html');
win.show();
win.focus();
},
failed : function(msg) {
// fail to register the |key| or couldn't parse the |key|.
console.error(msg);
}
});
gui.App.registerGlobalHotKey(close_shortcut);
gui.App.registerGlobalHotKey(min_shortcut);
gui.App.registerGlobalHotKey(menu_shortcut);
var tray = new gui.Tray({ title: 'CS:GO HUD', tooltip: 'CS:GO HUD', icon: 'logo.png' });
var menu = new gui.Menu();
menu.append(new gui.MenuItem({
label: "Choose HUD",
click: function() {
$('body').load('./menu.html');
}
}));
menu.append(new gui.MenuItem({
label: "Close",
click: function() {
tray.remove();
win.close();
process.exit(0);
}
}));
tray.menu = menu;
var huds = fs.readdirSync('./huds');
$('body').load('./menu.html');
</script>