redesign and add versions/links

This commit is contained in:
Shelley Vohr 2017-09-27 23:51:53 -04:00
parent 24913a5ef9
commit 0f34967648
No known key found for this signature in database
GPG key ID: F13993A75599653C
3 changed files with 181 additions and 120 deletions

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,16 @@ const url = require('url')
// Parse command line options. // Parse command line options.
const argv = process.argv.slice(1) const argv = process.argv.slice(1)
const option = { file: null, help: null, default: null, version: null, webdriver: null, modules: [] }
const option = {
file: null,
help: null,
default: null,
version: null,
webdriver: null,
modules: []
}
for (let i = 0; i < argv.length; i++) { for (let i = 0; i < argv.length; i++) {
if (argv[i] === '--version' || argv[i] === '-v') { if (argv[i] === '--version' || argv[i] === '-v') {
option.version = true option.version = true
@ -18,7 +27,8 @@ for (let i = 0; i < argv.length; i++) {
} else if (argv[i] === '--default' || argv[i] === '-d') { } else if (argv[i] === '--default' || argv[i] === '-d') {
option.default = true option.default = true
break break
} else if (argv[i] === '--interactive' || argv[i] === '-i') { } else if (argv[i] === '--interactive' || argv[i] === '-i' ||
argv[i] === '-repl' || argv[i] === '-r') {
option.interactive = true option.interactive = true
} else if (argv[i] === '--test-type=webdriver') { } else if (argv[i] === '--test-type=webdriver') {
option.webdriver = true option.webdriver = true
@ -44,11 +54,9 @@ app.on('window-all-closed', () => {
app.once('ready', () => { app.once('ready', () => {
if (Menu.getApplicationMenu()) return if (Menu.getApplicationMenu()) return
const template = [ const template = [{
{
label: 'Edit', label: 'Edit',
submenu: [ submenu: [{
{
role: 'undo' role: 'undo'
}, },
{ {
@ -79,8 +87,7 @@ app.once('ready', () => {
}, },
{ {
label: 'View', label: 'View',
submenu: [ submenu: [{
{
role: 'reload' role: 'reload'
}, },
{ {
@ -111,8 +118,7 @@ app.once('ready', () => {
}, },
{ {
role: 'window', role: 'window',
submenu: [ submenu: [{
{
role: 'minimize' role: 'minimize'
}, },
{ {
@ -122,8 +128,7 @@ app.once('ready', () => {
}, },
{ {
role: 'help', role: 'help',
submenu: [ submenu: [{
{
label: 'Learn More', label: 'Learn More',
click() { click() {
shell.openExternal('https://electron.atom.io') shell.openExternal('https://electron.atom.io')
@ -156,8 +161,7 @@ app.once('ready', () => {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
template.unshift({ template.unshift({
label: 'Electron', label: 'Electron',
submenu: [ submenu: [{
{
role: 'about' role: 'about'
}, },
{ {
@ -187,24 +191,19 @@ app.once('ready', () => {
} }
] ]
}) })
template[1].submenu.push( template[1].submenu.push({
{
type: 'separator' type: 'separator'
}, }, {
{
label: 'Speech', label: 'Speech',
submenu: [ submenu: [{
{
role: 'startspeaking' role: 'startspeaking'
}, },
{ {
role: 'stopspeaking' role: 'stopspeaking'
} }
] ]
} })
) template[3].submenu = [{
template[3].submenu = [
{
role: 'close' role: 'close'
}, },
{ {
@ -223,11 +222,9 @@ app.once('ready', () => {
} else { } else {
template.unshift({ template.unshift({
label: 'File', label: 'File',
submenu: [ submenu: [{
{
role: 'quit' role: 'quit'
} }]
]
}) })
} }

View file

@ -9,8 +9,9 @@ document.onclick = (e) => {
return false return false
} }
const version = process.versions.electron document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}`
document.querySelector('.header-version').innerText = version document.querySelector('.chrome-version').innerText = `Chrome v${process.versions.chrome}`
document.querySelector('.command-example').innerText = `${execPath} path-to-your-app` document.querySelector('.node-version').innerText = `Node v${process.versions.node}`
document.querySelector('.quick-start-link').href = `https://github.com/electron/electron/blob/v${version}/docs/tutorial/quick-start.md` document.querySelector('.v8-version').innerText = `v8 v${process.versions.v8}`
document.querySelector('.docs-link').href = `https://github.com/electron/electron/tree/v${version}/docs#readme`
document.querySelector('.command-example').innerText = `${execPath} path-to-app`