fix link behavior

This commit is contained in:
Zeke Sikelianos 2017-09-29 12:26:03 -07:00
parent 56581b416d
commit bf2b6b3ac4

View file

@ -2,13 +2,13 @@ const {remote, shell} = require('electron')
const path = require('path') const path = require('path')
const electronPath = path.relative(process.cwd(), remote.process.execPath) const electronPath = path.relative(process.cwd(), remote.process.execPath)
document.onclick = (e) => { Array.from(document.querySelectorAll('a[href]')).forEach(link => {
e.preventDefault() const url = link.getAttribute('href')
if (e.target.tagName === 'A') { link.addEventListener('click', (e) => {
shell.openExternal(e.target.href) e.preventDefault()
} shell.openExternal(url)
return false })
} })
document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}` document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}`
document.querySelector('.chrome-version').innerText = `Chromium v${process.versions.chrome}` document.querySelector('.chrome-version').innerText = `Chromium v${process.versions.chrome}`