-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
194 lines (171 loc) · 7.65 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<html>
<head>
<link rel="stylesheet" href="node_modules/materialize-css/dist/css/materialize.min.css">
<link rel="stylesheet" href="assets/material-icons/material-icons.css">
<style>
.collection {
border: 1px solid #9b9b9b;
}
.collection .collection-item {
background-color: #4c4c4c;
cursor: pointer;
}
.collection .collection-item.avatar {
min-height: 101px;
padding-left: 160px;
position: relative;
}
.collection-item .title {
font-weight: bold;
font-size: 20px;
}
.collection-item p {
margin: 0;
color: #a5a3a3;
}
.collection-item.avatar > .thumbnail {
position: absolute;
width: 150px;
height: 100px;
overflow: hidden;
left: 0;
top: 0;
display: inline-block;
vertical-align: middle;
background-position: center;
background-size: cover;
}
.collection-item > .editorVersion {
float: right;
text-align: right;
color: #7d7d7d;
}
</style>
</head>
<body>
<br/>
<div class="container">
<div class="row" style="color:#d2d2d2;">
<div class="col s4">
<img src="assets/images/logo-x512.png" class="responsive-img">
</div>
<div class="col s8">
<div class="row" style="margin-bottom: 5px;">
<h4>Hi!</h4>
<p class="flow-text">
Welcome to the <strong>PluginBlueprint</strong> Editor!
</p>
</div>
<div class="row" style="margin-bottom: 5px;">
<a class="btn btn-small" href="https://pluginblueprint.net/discord" target="_blank"><i class="material-icons left">chat</i> Discord Server</a>
<a class="btn btn-small" href="https://pluginblueprint.net/wiki" target="_blank"><i class="material-icons left">help</i> Wiki / Examples</a>
</div>
<div class="row" id="updateCheckContent" style="height: 48px;">
<img src="assets/images/spinner.svg" style="width: 48px; float:left;">
<span style="float: left; line-height: 48px; height: 48px; vertical-align: middle;">Checking for updates...</span>
</div>
</div>
</div>
<br/>
<br/>
<div class="row">
<button class="btn createNewProject"><i class="material-icons left">add</i> Create new Project</button>
<button class="btn" id="openProject"><i class="material-icons left">folder_open</i> Open Project</button>
</div>
<div class="row" id="recentProjectRow">
<h5>Recent Projects <a href="#" class="createNewProject right-align" style="color:#d2d2d2;"><i class="material-icons right">add</i></a></h5>
<ul class="collection" id="recentProjects">
<!-- Dynamic -->
</ul>
</div>
</div>
<script>
const {ipcRenderer, shell} = require("electron");
const {dialog, Menu, getCurrentWindow, app, getGlobal} = require("electron").remote;
const analytics = getGlobal("analytics");
const prompt = require("electron-prompt");
const $ = require("jquery");
const Sentry = require("@sentry/electron");
getCurrentWindow().setMenu(Menu.buildFromTemplate([
{
label: "File",
submenu: [
{
label: "New", role: "new", click: () => {
ipcRenderer.send("showCreateNewProject");
}
},
{
label: "Open", role: "open", click: () => {
ipcRenderer.send("showOpenProject");
}
},
{
type: "separator"
},
{
role: "toggledevtools"
},
]
}
]));
$(document).ready(function () {
console.log("" +
"PluginBlueprint, Version " + app.getVersion() + "\n" +
"Copyright (c) 2018, Haylee Schaefer\n" +
"All rights reserved.\n");
Sentry.init({
dsn: 'https://[email protected]/1309246',
beforeSend(event) {
// Check if it is an exception, if so, show the report dialog
if (event.exception) {
Sentry.showReportDialog();
}
return event;
}
});
console.log("Checking for updates...");
ipcRenderer.send("checkUpdate");
analytics.pageview("/", "", "Home").send();
});
ipcRenderer.send("getRecentProjects");
$(".createNewProject").click(() => {
ipcRenderer.send("showCreateNewProject");
analytics.event("Home", "Create New Project").send();
});
$("#openProject").click(() => {
ipcRenderer.send("showOpenProject");
analytics.event("Home", "Open Project").send();
});
ipcRenderer.on("recentProjects", function (event, arg) {
for (let i = 0; i < arg.length; i++) {
if (!arg[i] || !arg[i].path) continue;
let item = $('<li class="collection-item avatar">' + (arg[i].thumbnail ? '<div class="thumbnail" style="background-image: url(data:image/jpeg;base64,' + arg[i].thumbnail + ')"></div>' : '') + '<span class="title">' + arg[i].name + '</span><p>' + arg[i].path + '</p><span class="editorVersion">' + arg[i].editorVersion + '</span></li>');
item.click(() => {
ipcRenderer.send("openProject", arg[i].path);
analytics.event("Home", "Open Recent Project").send();
});
item.appendTo($("#recentProjects"));
}
if (arg.length === 0) {
$("#recentProjectRow").hide();
}
});
// external links
$(document).on('click', 'a[href^="http"]', function (event) {
event.preventDefault();
shell.openExternal(this.href);
analytics.pageview(this.href).send();
});
ipcRenderer.on("updateInfo", function (event, arg) {
$("#updateCheckContent").empty();
if (arg.hasUpdate) {
console.log("Update available!", arg);
$("#updateCheckContent").append("<strong>Update available!</strong> (v" + arg.updateVersion + ") <a href='https://pluginblueprint.net/downloads'>Download</a>")
} else {
console.log("No update found", arg)
}
});
</script>
</body>
</html>