webView.addEventListener('new-window', function (event) { log('webview new-window', JSON.stringify(event)); const url = urls.skipFacebookRedirect(event.url); event.preventDefault(); // download url if (urls.isDownloadUrl(url)) { log('on webview new-window, downloading', url); webView.getWebContents().loadURL(url); return; } // open it externally (if preference is set) if (prefs.get('links-in-browser')) { log('on webview new-window, externally', url); shell.openExternal(url); return; } // otherwise open it in a new app window (unless it's an audio/video call) if (event.frameName !== 'Video Call' || event.url !== 'about:blank') { const options = { title: event.frameName || global.manifest.productName, darkTheme: global.manifest.darkThemes.includes(prefs.get('theme')) }; log('on webview new-window, new window', url, options); const newWindow = new remote.BrowserWindow(options); newWindow.loadURL(url); event.newGuest = newWindow; } });
click: () => clipboard.writeText(urls.skipFacebookRedirect(params.linkURL))