1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 13:25:24 +03:00

Fix opening of external links in browser.

This commit is contained in:
mikeller 2019-07-14 09:39:08 +12:00
parent 9b531a9e98
commit c00431cdc8

View file

@ -5,8 +5,6 @@ var nwGui = getNwGui();
var googleAnalytics = analytics; var googleAnalytics = analytics;
var analytics = undefined; var analytics = undefined;
openNewWindowsInExternalBrowser();
$(document).ready(function () { $(document).ready(function () {
$.getJSON('version.json', function(data) { $.getJSON('version.json', function(data) {
CONFIGURATOR.gitChangesetId = data.gitChangesetId; CONFIGURATOR.gitChangesetId = data.gitChangesetId;
@ -88,6 +86,12 @@ function setupAnalytics(result) {
this.close(true); this.close(true);
}); });
win.on('new-win-policy', function(frame, url, policy) {
// do not open the window
policy.ignore();
// and open it in external browser
nwGui.Shell.openExternal(url);
});
} else { } else {
// Looks like we're in Chrome - but the event does not actually get fired // Looks like we're in Chrome - but the event does not actually get fired
chrome.runtime.onSuspend.addListener(sendCloseEvent); chrome.runtime.onSuspend.addListener(sendCloseEvent);
@ -808,19 +812,6 @@ function getManifestVersion(manifest) {
return version; return version;
} }
function openNewWindowsInExternalBrowser() {
if (nwGui) {
//Get the current window
var win = nwGui.Window.get();
//Listen to the new window event
win.on('new-win-policy', function (frame, url, policy) {
gui.Shell.openExternal(url);
policy.ignore();
});
}
}
function showErrorDialog(message) { function showErrorDialog(message) {
var dialog = $('.dialogError')[0]; var dialog = $('.dialogError')[0];