1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +03:00

Fix opening of external links in browser. (#1534)

Fix opening of external links in browser.
This commit is contained in:
Michael Keller 2019-07-15 22:43:28 +12:00 committed by GitHub
commit 988c9a470c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,8 +5,6 @@ var nwGui = getNwGui();
var googleAnalytics = analytics;
var analytics = undefined;
openNewWindowsInExternalBrowser();
$(document).ready(function () {
$.getJSON('version.json', function(data) {
CONFIGURATOR.gitChangesetId = data.gitChangesetId;
@ -88,6 +86,12 @@ function setupAnalytics(result) {
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 {
// Looks like we're in Chrome - but the event does not actually get fired
chrome.runtime.onSuspend.addListener(sendCloseEvent);
@ -808,19 +812,6 @@ function getManifestVersion(manifest) {
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) {
var dialog = $('.dialogError')[0];