electron/default_app/index.html

160 lines
3.3 KiB
HTML
Raw Normal View History

<html>
<head>
2015-04-08 17:16:10 +00:00
<title>Electron</title>
2014-05-05 08:02:52 +00:00
<style>
body {
2016-02-17 17:51:24 +00:00
color: #45828E;
background-color: #A5ECFA;
font-family: 'Helvetica Neue', 'Open Sans', Helvetica, Arial, sans-serif;
2016-02-17 18:01:18 +00:00
padding: 0;
margin: 0;
}
.container {
padding: 15px 30px;
2014-05-05 08:02:52 +00:00
}
h2 {
2016-02-17 18:01:18 +00:00
background-color: #76C7D7;
color: #FAF7F3;
2014-05-05 08:02:52 +00:00
font-weight: 400;
2016-02-17 18:01:18 +00:00
padding: 15px 30px;
margin: 0;
2014-05-05 08:02:52 +00:00
}
a {
2016-02-17 17:51:24 +00:00
color: #39AEC6;
2014-05-05 08:02:52 +00:00
text-decoration: none;
}
2016-02-17 17:51:24 +00:00
2014-05-05 08:02:52 +00:00
a:hover {
text-decoration: underline;
}
pre, code {
font-family: "Menlo","Lucida Console",monospace;
2016-02-17 18:21:05 +00:00
border: 1px solid #076274;
2016-02-17 17:51:24 +00:00
background-color: #076274;
color: #C5F3FC;
2014-05-05 08:02:52 +00:00
border-radius: 3px;
}
pre {
white-space: pre-wrap;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
}
2014-05-05 08:30:37 +00:00
2016-02-17 17:51:24 +00:00
code {
padding: 1px 4px 1px 4px;
font-size: 13px;
}
2014-05-05 08:30:37 +00:00
#holder {
2016-02-17 17:53:16 +00:00
border: 2px dashed #448691;
2014-05-05 08:30:37 +00:00
margin: 0 auto;
height: 300px;
2016-02-17 17:53:16 +00:00
color: #45828E;
2014-05-05 08:30:37 +00:00
font-size: 40px;
line-height: 300px;
text-align: center;
2014-05-05 08:46:25 +00:00
-webkit-user-select: none;
2014-05-05 08:30:37 +00:00
}
2016-02-17 17:51:24 +00:00
2014-05-05 08:30:37 +00:00
#holder.hover {
2016-02-17 18:07:32 +00:00
background-color: #7BDCEF;
2014-05-05 08:30:37 +00:00
}
2014-05-05 08:02:52 +00:00
</style>
</head>
<body>
<script>
const electron = require('electron');
const remote = electron.remote;
const shell = electron.shell;
var execPath = remote.process.execPath;
var command = execPath + ' path-to-your-app';
2014-05-05 08:46:25 +00:00
document.onclick = function(e) {
e.preventDefault();
if (e.target.tagName == 'A')
shell.openExternal(e.target.href);
2014-05-05 08:46:25 +00:00
return false;
};
2014-05-05 08:30:37 +00:00
document.ondragover = document.ondrop = function(e) {
e.preventDefault();
return false;
2014-05-05 08:46:25 +00:00
};
</script>
<h2>
<script>
2016-02-17 18:01:35 +00:00
document.write(`Welcome to Electron ${process.versions.electron}`)
</script>
</h2>
2016-02-17 18:01:18 +00:00
<div class="container">
2016-02-17 18:01:18 +00:00
<p>
2016-02-17 18:11:35 +00:00
To run your app with Electron, execute the following command in your
2016-02-17 18:01:18 +00:00
Console (or Terminal):
</p>
2016-02-17 18:01:18 +00:00
<script>document.write('<pre>' + command + '</pre>')</script>
<p>
The <code>path-to-your-app</code> should be the path to your own Electron
2016-02-17 18:02:53 +00:00
app.
</p>
<p>You can read the
2016-02-17 18:01:18 +00:00
<script>
document.write(
2016-03-31 23:50:30 +00:00
`<a href='https://github.com/electron/electron/blob/v${process.versions.electron}/docs/tutorial/quick-start.md'>quick start</a>`
2016-02-17 18:01:18 +00:00
);
</script>
guide in Electron's
<script>
document.write(
2016-03-31 23:50:30 +00:00
`<a href='https://github.com/electron/electron/tree/v${process.versions.electron}/docs#readme'>docs</a>`
2016-02-17 18:01:18 +00:00
);
</script>
2016-02-17 18:10:36 +00:00
to learn how to write one.
2016-02-17 18:01:18 +00:00
</p>
<p>
Or you can just drag your app here to run it:
</p>
2014-05-05 08:30:37 +00:00
2016-02-17 18:01:18 +00:00
<div id="holder">
Drag your app here to run it
</div>
2014-05-05 08:30:37 +00:00
</div>
<script>
var holder = document.getElementById('holder');
holder.ondragover = function () {
this.className = 'hover';
return false;
};
holder.ondragleave = holder.ondragend = function () {
this.className = '';
return false;
};
holder.ondrop = function (e) {
this.className = '';
e.preventDefault();
var file = e.dataTransfer.files[0];
require('child_process').execFile(execPath, [file.path], {
detached: true, stdio: 'ignore'
}).unref();
return false;
};
</script>
</body>
</html>