2017-04-24 18:54:05 +00:00
|
|
|
const {remote, shell} = require('electron')
|
2017-09-29 17:41:20 +00:00
|
|
|
const path = require('path')
|
2017-09-29 19:31:17 +00:00
|
|
|
const URL = require('url')
|
2017-09-29 17:41:20 +00:00
|
|
|
const electronPath = path.relative(process.cwd(), remote.process.execPath)
|
2017-04-24 18:54:05 +00:00
|
|
|
|
2017-09-29 19:26:03 +00:00
|
|
|
Array.from(document.querySelectorAll('a[href]')).forEach(link => {
|
2017-09-29 19:31:17 +00:00
|
|
|
// safely add `?utm_source=default_app
|
|
|
|
let url = URL.parse(link.getAttribute('href'), true)
|
|
|
|
url.query = Object.assign(url.query, {utm_source: 'default_app'})
|
|
|
|
url = URL.format(url)
|
|
|
|
|
2017-09-29 19:26:03 +00:00
|
|
|
link.addEventListener('click', (e) => {
|
|
|
|
e.preventDefault()
|
|
|
|
shell.openExternal(url)
|
|
|
|
})
|
|
|
|
})
|
2017-04-24 18:54:05 +00:00
|
|
|
|
2017-09-28 03:51:53 +00:00
|
|
|
document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}`
|
2017-09-29 17:41:48 +00:00
|
|
|
document.querySelector('.chrome-version').innerText = `Chromium v${process.versions.chrome}`
|
2017-09-28 03:51:53 +00:00
|
|
|
document.querySelector('.node-version').innerText = `Node v${process.versions.node}`
|
|
|
|
document.querySelector('.v8-version').innerText = `v8 v${process.versions.v8}`
|
2017-09-29 17:41:20 +00:00
|
|
|
document.querySelector('.command-example').innerText = `${electronPath} path-to-app`
|