..
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 | const remote = require('electron').remote;
$(document).ready(function () {
var monitorWidth = screen.width;
var monitorHeight = screen.height;
$('.nav-group').on('click', 'span', function () {
$('.nav-group span.active').removeClass('active');
$(this).addClass('active');
});
$('.templateIcon').click(function (e) {
$('.template .templateIcon').removeClass('clicked');
$('.template .templateName span').removeClass('clickedText');
$(this).addClass('clicked');
var parentId = ($(this).parent().attr('id'));
$('#' + parentId + ' .templateName span').addClass('clickedText')
e.stopPropagation()
})
$(document).on("click", function (e) {
if ($(e.target).is(".templateIcon, .templateName span") === false) {
$('.template .templateIcon').removeClass('clicked');
$('.template .templateName span').removeClass('clickedText');
}
});
$('#startSelected').click(function () {
if ($('.template .templateIcon').hasClass('clicked')) {
var parentId = ($('.clicked').parent().attr('id'));
start(parentId);
}
else {
showError('No Template Selected!', 'No template was selected. Please Select a template to get started!')
}
});
$('#cancelSelected').click(function () {
var window = remote.getCurrentWindow();
window.close();
});
function showError(heading, message) {
const { remote } = window.require('electron')
const dialog = remote.dialog
dialog.showErrorBox(heading, message);
}
function start(id) {
var templateURL = 'file://' + __dirname + `/templates/${id}/template.html`;
var window = remote.getCurrentWindow();
window.setSize(monitorWidth * 0.75, monitorHeight * 0.75, false);
window.center();
window.loadURL(templateURL);
}
})
|
|