-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
104 lines (86 loc) · 2.93 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
// Load require apps
var electron = require("electron");
var ipcMain = electron.ipcMain;
var dialog = electron.dialog;
var app = require("app");
var path = require("path");
globalShortcut = require("global-shortcut");
var BrowserWindow = require("browser-window");
// Disable Loggings (Remove this to see any errors within terminal)
console.log = function() {}
app.commandLine.appendSwitch('enable-transparent-visuals');
// Load Flash Plugin
var flash_path = path.join("/usr/lib/Transformice/resources/app/flash-plugin_32x/libpepflashplayer.so");
app.commandLine.appendSwitch("ppapi-flash-path", flash_path);
app.commandLine.appendSwitch("ppapi-flash-version", "26.0.0.151");
// Shows Errors in Terminal
dialog.showErrorBox = function(title, content) {
console.log(`${title}\n${content}`);
};
// Loads web pages for index.html functions
require("ipc").on("load-page", (event, arg) => {
win.loadURL(arg);
});
// App Closes Functions
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
// Starts Application
app.on("ready", function() {
win = new BrowserWindow({
"width": 800,
"height": 600,
// Set frame to true if you want exit button
"frame": false,
'transparent': true,
'title': "Transformice",
'icon': path.join(__dirname, "TFM/icon.png"),
"web-preferences": {
"plugins": true,
"sandbox": true
}
});
// Load Application Functions
var id = win.id
globalShortcut.register("Ctrl+Shift+q", () => {
var window = BrowserWindow.fromId(id);
window.close()
});
globalShortcut.register("Ctrl+Shift+m", () => {
var window = BrowserWindow.fromId(id);
window.minimize();
});
globalShortcut.register("Ctrl+Shift+f", () => {
var window = BrowserWindow.fromId(id);
if (window.isMaximized()) {
window.unmaximize();
} else {
window.maximize();
}
});
globalShortcut.register("Ctrl+Shift+a", () => {
win.loadURL("http://atelier801.com/index");
});
globalShortcut.register("Ctrl+Shift+t", () => {
win.loadURL("http://www.transformice.com/TransformiceChargeur.swf");
});
globalShortcut.register("Ctrl+Shift+h", () => {
win.loadURL("http://www.nekodancer.com/ChargeurNekodancer.swf");
});
globalShortcut.register("Ctrl+Shift+z", () => {
win.loadURL("http://www.fortoresse.com/ChargeurFortoresse.swf");
});
globalShortcut.register("Ctrl+Shift+v", () => {
win.loadURL("http://www.anvilgod.com");
});
globalShortcut.register("Ctrl+Shift+b", () => {
win.loadURL("http://www.bouboum.com/ChargeurBouboum.swf");
});
globalShortcut.register("Ctrl+Shift+n", () => {
win.loadURL("file://" + __dirname + "/TFM/index.html");
});
// Loads index.html
win.loadURL("file://" + __dirname + "/TFM/index.html");
});