Merge pull request #15 from lbryio/external_links

open http links in external app (probably browser)
This commit is contained in:
Jeremy Kauffman 2017-03-16 10:00:46 -04:00 committed by GitHub
commit aeaf09af6c

View file

@ -22,7 +22,7 @@ import {Modal, ExpandableModal} from './component/modal.js';
import {Link} from './component/link.js';
const {remote, ipcRenderer} = require('electron');
const {remote, ipcRenderer, shell} = require('electron');
const {download} = remote.require('electron-dl');
@ -60,6 +60,19 @@ var App = React.createClass({
this.alertError(event.detail);
});
//open links in external browser
document.addEventListener('click', function(event) {
var target = event.target;
while (target && target !== document) {
if (target.matches('a[href^="http"]')) {
event.preventDefault();
shell.openExternal(target.href);
return;
}
target = target.parentNode;
}
});
lbry.checkNewVersionAvailable((isAvailable) => {
if (!isAvailable || sessionStorage.getItem('upgradeSkipped')) {
return;