Merge pull request #15 from lbryio/external_links
open http links in external app (probably browser)
This commit is contained in:
commit
aeaf09af6c
1 changed files with 14 additions and 1 deletions
15
ui/js/app.js
15
ui/js/app.js
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue