app.on('before-quit', (e) => { var windows = BrowserWindow.getAllWindows(); if(!windows.length) { return; } var window = BrowserWindow.getFocusedWindow(); if(!window) { windows[0].show(); } onCloseWindow(e, 'Quit Mancy', 'Do you want to quit?'); if(e.returnValue) { promptOnClose = false; } else { e.preventDefault(); } });
event.preventDefault(); shell.openExternal(url); });
event.preventDefault(); win.webContents.send("saveDownloads");
if (config.get('sendAnalytics')) analytics.track('will-navigate'); if (!allowedUrl(url)) { e.preventDefault(); shell.openExternal(url); e.preventDefault(); if (allowedUrl(url)) { webContents.loadURL(url);
// Save the instance data to config DB before quitting app.on('will-quit', async function (event) { if (!finalPrefs) { event.preventDefault(); await saveSession(); app.quit(); } });
// Prevent navigation when links or files are dropping into the app, turning it into a browser. // https://github.com/discord/discord/pull/278 mainWindow.webContents.on('will-navigate', (evt, url) => { if (!insideAuthFlow && !url.startsWith(WEBAPP_ENDPOINT)) { evt.preventDefault(); } });
app.on('open-file', (event, f) => { event.preventDefault(); sqlodm.application.findOne({is_default: true}).then( application => { open2(f, application.identifier, '-b'); }, error => { logger.error('Failed to open file. Error: ', error); createSecondaryWindow(f); } ); });
mainWindow.on('close', e => { if (mainWindow === null) { // this means we're quitting popoutWindows.closePopouts(); return; } webContentsSend('MAIN_WINDOW_BLUR'); // Save our app settings saveWindowConfig(mainWindow); // Quit app if that's the setting if (!settings.get('MINIMIZE_TO_TRAY', true)) { electron.app.quit(); return; } // Else, minimize to tray setWindowVisible(false); e.preventDefault(); });
// Handle opening files app.on('will-finish-launching', () => { app.on('open-file', (event, path) => { event.preventDefault() tryOpenFiles(path) }); });
// When a recent file is clicked, send its path app.on('open-file', function(event, filePath) { event.preventDefault(); console.log(filePath) mainWindow.webContents.send('open-file-reply', filePath) });
app.on('open-url', function(event, uri) { openURL(uri); event.preventDefault(); });
mainWindow.on('page-title-updated', (e, title) => { if (mainWindow === null) { return; } e.preventDefault(); if (!title.endsWith('Lightcord')) { title += ' - Lightcord'; } mainWindow.setTitle(title); });
mainWindow.on('page-title-updated', (e, title) => { if (mainWindow === null) { return; } e.preventDefault(); if (!title.endsWith('Lightcord')) { title += ' - Lightcord'; } mainWindow.setTitle(title); });
// Prevent navigation when links or files are dropping into the app, turning it into a browser. // https://github.com/discord/discord/pull/278 mainWindow.webContents.on('will-navigate', (evt, url) => { if (!insideAuthFlow && !url.startsWith(WEBAPP_ENDPOINT)) { evt.preventDefault(); } });