Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
<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://6d56f92bc4f84e44b66950ed04e92704@sentry.io/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>