click: function () { electron.shell.openExternal('http://tujiaw.github.io') }
showItemInFolder: (fullPath) => shell.showItemInFolder(fullPath),
openExternal: (fullPath) => shell.openExternal(fullPath)
const downloadsReducer = (state, action) => { const download = action.downloadId ? state.getIn(['downloads', action.downloadId]) : undefined if (!download && ![appConstants.APP_MERGE_DOWNLOAD_DETAIL, appConstants.APP_CLEAR_COMPLETED_DOWNLOADS, appConstants.APP_SELECT_DEFAULT_DOWNLOAD_PATH, appConstants.APP_CHANGE_SETTING, appConstants.APP_SET_STATE].includes(action.actionType)) { return state } switch (action.actionType) { case appConstants.APP_SET_STATE: if (getSetting(settings.DOWNLOAD_DEFAULT_PATH) === '') { const defaultPath = app.getPath('downloads') appActions.changeSetting(settings.DOWNLOAD_DEFAULT_PATH, defaultPath) } break case appConstants.APP_DOWNLOAD_REVEALED: fs.access(download.get('savePath'), fs.constants.F_OK, (err) => { if (err) { shell.openItem(path.dirname(download.get('savePath'))) } else { shell.showItemInFolder(download.get('savePath')) } }) break case appConstants.APP_DOWNLOAD_OPENED: fs.access(download.get('savePath'), fs.constants.F_OK, (err) => { if (err) { shell.beep() } else { shell.openItem(download.get('savePath')) } }) break case appConstants.APP_DOWNLOAD_ACTION_PERFORMED: switch (action.downloadAction) { case CANCEL: // It's important to update state before the cancel since it'll remove the reference state = state.setIn(['downloads', action.downloadId, 'state'], downloadStates.CANCELLED) cancelDownload(action.downloadId) break case PAUSE: pauseDownload(action.downloadId) break case RESUME: resumeDownload(action.downloadId) break } break case appConstants.APP_DOWNLOAD_COPIED_TO_CLIPBOARD: clipboard.writeText(download.get('url')) break case appConstants.APP_DOWNLOAD_DELETED: shell.moveItemToTrash(download.get('savePath')) state = state.deleteIn(['downloads', action.downloadId]) break case appConstants.APP_DOWNLOAD_CLEARED: state = state.deleteIn(['downloads', action.downloadId]) break case appConstants.APP_DOWNLOAD_REDOWNLOADED: const win = BrowserWindow.getFocusedWindow() if (win) { win.webContents.downloadURL(download.get('url'), true) state = state.deleteIn(['downloads', action.downloadId]) } else { shell.beep() } break case appConstants.APP_MERGE_DOWNLOAD_DETAIL: if (action.downloadDetail) { state = state.mergeIn(['downloads', action.downloadId], action.downloadDetail) } else { state = state.deleteIn(['downloads', action.downloadId]) } break case appConstants.APP_CLEAR_COMPLETED_DOWNLOADS: if (state.get('downloads')) { const downloads = state.get('downloads') .filter((download) => ![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.UNAUTHORIZED, downloadStates.CANCELLED].includes(download.get('state'))) state = state.set('downloads', downloads) } break case appConstants.APP_SELECT_DEFAULT_DOWNLOAD_PATH: const focusedWindow = BrowserWindow.getFocusedWindow() dialog.showDialog(focusedWindow, { defaultPath: app.getPath('downloads'), type: 'select-folder' }, (paths) => { if (Array.isArray(paths) && fs.lstatSync(paths[0]).isDirectory()) { appActions.changeSetting(settings.DOWNLOAD_DEFAULT_PATH, paths[0]) } }) break case appConstants.APP_CHANGE_SETTING: if (action.key === settings.DOWNLOAD_DEFAULT_PATH) { userPrefs.setUserPref('download.default_directory', action.value) } break } return state }
click: () => { shell.openExternal('https://github.com/vesparny/todoo/blob/master/CHANGELOG.md') }
buildDarwinTemplate() { const subMenuAbout = { label: 'eos-voter', submenu: [ { role: 'about' }, { type: 'separator' }, { label: 'Services', submenu: [] }, { type: 'separator' }, { label: 'Hide eos-voter', accelerator: 'Command+H', selector: 'hide:' }, { label: 'Hide Others', accelerator: 'Command+Shift+H', selector: 'hideOtherApplications:' }, { label: 'Show All', selector: 'unhideAllApplications:' }, { type: 'separator' }, { label: 'Quit', accelerator: 'Command+Q', click: () => { app.quit(); } } ] }; const subMenuEdit = { label: 'Edit', submenu: [ { label: 'Undo', accelerator: 'Command+Z', selector: 'undo:' }, { label: 'Redo', accelerator: 'Shift+Command+Z', selector: 'redo:' }, { type: 'separator' }, { label: 'Cut', accelerator: 'Command+X', selector: 'cut:' }, { label: 'Copy', accelerator: 'Command+C', selector: 'copy:' }, { label: 'Paste', accelerator: 'Command+V', selector: 'paste:' }, { label: 'Select All', accelerator: 'Command+A', selector: 'selectAll:' } ] }; const subMenuViewDev = { label: 'View', submenu: [ { role: 'reload' }, { role: 'forcereload' }, { role: 'toggledevtools' }, { type: 'separator' }, { role: 'resetzoom' }, { role: 'zoomin' }, { role: 'zoomout' }, { type: 'separator' }, { role: 'togglefullscreen' } ] }; const subMenuWindow = { label: 'Window', submenu: [ { label: 'Minimize', accelerator: 'Command+M', selector: 'performMiniaturize:' }, { label: 'Close', accelerator: 'Command+W', selector: 'performClose:' }, { type: 'separator' }, { label: 'Bring All to Front', selector: 'arrangeInFront:' } ] }; const subMenuHelp = { label: 'Help', submenu: [ { label: 'Source Code (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter'); } }, { label: 'Report Bug (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter/issues'); } }, { label: 'Releases (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter/releases'); } } ] }; return [ subMenuAbout, subMenuEdit, subMenuViewDev, subMenuWindow, subMenuHelp ]; }
app.on('ready', async () => { await installExtensions(); mainWindow = new BrowserWindow({ show: false, width: 476, height: 520, titleBarStyle: 'hidden' }); mainWindow.loadURL(`file://${__dirname}/app/app.html`); mainWindow.webContents.on('did-finish-load', () => { mainWindow.show(); mainWindow.focus(); }); mainWindow.on('close', (e) => { console.log('close') if (willQuitApp) { /* the user tried to quit the app */ mainWindow = null } else { /* the user only tried to close the mainWindow */ e.preventDefault() mainWindow.hide() } }) mainWindow.on('closed', () => { console.log('closed') mainWindow = null; }); if (process.env.NODE_ENV === 'development') { mainWindow.openDevTools() mainWindow.webContents.on('context-menu', (e, props) => { const { x, y } = props Menu.buildFromTemplate([{ label: 'Inspect element', click() { mainWindow.inspectElement(x, y); } }]).popup(mainWindow) }) } if (process.platform === 'darwin') { template = [{ label: 'macHosts', submenu: [{ label: 'About macHosts', selector: 'orderFrontStandardAboutPanel:' }, { type: 'separator' }, { label: 'Services', submenu: [] }, { type: 'separator' }, { label: 'Hide macHosts', accelerator: 'Command+H', selector: 'hide:' }, { label: 'Hide Others', accelerator: 'Command+Shift+H', selector: 'hideOtherApplications:' }, { label: 'Show All', selector: 'unhideAllApplications:' }, { type: 'separator' }, { label: 'Quit', accelerator: 'Command+Q', click() { app.quit(); } }] }, { label: 'Edit', submenu: [{ label: 'Undo', accelerator: 'Command+Z', role: 'undo', selector: 'undo:' }, { label: 'Redo', accelerator: 'Shift+Command+Z', role: 'redo', selector: 'redo:' }, { type: 'separator' }, { label: 'Cut', accelerator: 'Command+X', role: 'cut', selector: 'cut:' }, { label: 'Copy', accelerator: 'Command+C', role: 'copy', selector: 'copy:' }, { label: 'Paste', accelerator: 'Command+V', role: 'paste', selector: 'paste:' }, { label: 'Select All', accelerator: 'Command+A', role: 'selectAll', selector: 'selectAll:' }] }, { label: 'View', submenu: (process.env.NODE_ENV === 'development') ? [{ label: 'Reload', accelerator: 'Command+R', click() { mainWindow.webContents.reload(); } }, { label: 'Toggle Full Screen', accelerator: 'Ctrl+Command+F', click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } }, { label: 'Toggle Developer Tools', accelerator: 'Alt+Command+I', click() { mainWindow.toggleDevTools(); } }] : [{ label: 'Toggle Full Screen', accelerator: 'Ctrl+Command+F', click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } }] }, { label: 'Window', submenu: [{ label: 'Minimize', accelerator: 'Command+M', selector: 'performMiniaturize:' }, { label: 'Close', accelerator: 'Command+W', selector: 'performClose:' }, { type: 'separator' }, { label: 'Bring All to Front', selector: 'arrangeInFront:' }] }, { label: 'Help', submenu: [{ label: 'Learn More', click() { shell.openExternal('http://electron.atom.io'); } }, { label: 'Documentation', click() { shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme'); } }, { label: 'Community Discussions', click() { shell.openExternal('https://discuss.atom.io/c/electron'); } }, { label: 'Search Issues', click() { shell.openExternal('https://github.com/atom/electron/issues'); } }] }] menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(menu); } else { template = [{ label: '&File', submenu: [{ label: '&Open', accelerator: 'Ctrl+O' }, { label: '&Close', accelerator: 'Ctrl+W', click() { mainWindow.close(); } }] }, { label: '&View', submenu: (process.env.NODE_ENV === 'development') ? [{ label: '&Reload', accelerator: 'Ctrl+R', click() { mainWindow.webContents.reload(); } }, { label: 'Toggle &Full Screen', accelerator: 'F11', click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } }, { label: 'Toggle &Developer Tools', accelerator: 'Alt+Ctrl+I', click() { mainWindow.toggleDevTools(); } }] : [{ label: 'Toggle &Full Screen', accelerator: 'F11', click() { mainWindow.setFullScreen(!mainWindow.isFullScreen()); } }] }, { label: 'Help', submenu: [{ label: 'Learn More', click() { shell.openExternal('http://electron.atom.io'); } }, { label: 'Documentation', click() { shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme'); } }, { label: 'Community Discussions', click() { shell.openExternal('https://discuss.atom.io/c/electron'); } }, { label: 'Search Issues', click() { shell.openExternal('https://github.com/atom/electron/issues'); } }] }]; menu = Menu.buildFromTemplate(template); mainWindow.setMenu(menu); } });
const install = (e, filePath) => { shell.openItem(filePath) setTimeout(() => app.quit(), 100) }
openExternal (e) { shell.openExternal(this.props.item.url) }
updateElement.addEventListener('click', function (e) { e.preventDefault() shell.openExternal('https://hovancik.net/stretchly/downloads') })
myNotification.on('click', () => { console.log('Notification clicked') shell.openExternal('http://www.wisnuc.com/download') })
document.getElementById('homepage').addEventListener('click', function (e) { e.preventDefault() shell.openExternal('https://hovancik.net/stretchly') })
document.documentElement.addEventListener('click', (e) => { if (e.target.matches('a[href^="http"]')) { e.preventDefault(); Electron.shell.openExternal(e.target.href); } });
click: function () { electron.shell.openExternal('http://electron.atom.io') }
callback: function openPDF() { shell.openItem(`${filename}.pdf`); }
click: function () { electron.shell.openExternal(appConfig.contactUrl) }
buildDefaultTemplate() { const templateDefault = [{ label: '&File', submenu: [{ label: '&Open', accelerator: 'Ctrl+O' }, { label: '&Close', accelerator: 'Ctrl+W', click: () => { this.mainWindow.close(); } }] }, { label: '&View', submenu: (process.env.NODE_ENV === 'development') ? [{ label: '&Reload', accelerator: 'Ctrl+R', click: () => { this.mainWindow.webContents.reload(); } }, { label: 'Toggle &Full Screen', accelerator: 'F11', click: () => { this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen()); } }, { label: 'Toggle &Developer Tools', accelerator: 'Alt+Ctrl+I', click: () => { this.mainWindow.toggleDevTools(); } }] : [{ label: '&Reload', accelerator: 'Ctrl+R', click: () => { this.mainWindow.webContents.reload(); } }, { label: 'Toggle &Full Screen', accelerator: 'F11', click: () => { this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen()); } }, { label: 'Toggle &Developer Tools', accelerator: 'Alt+Ctrl+I', click: () => { this.mainWindow.toggleDevTools(); } }] }, { label: 'Help', submenu: [ { label: 'Source Code (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter'); } }, { label: 'Report Bug (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter/issues'); } }, { label: 'Releases (Github)', click() { shell.openExternal('https://github.com/greymass/eos-voter/releases'); } } ] }]; return templateDefault; }
click: function() { shell.openExternal("https://developer.chrome.com/devtools/docs/javascript-debugging"); }
rpc.on('open external', ({ url }) => { shell.openExternal(url); });
click: function() { shell.openExternal("https://github.com/s-a/iron-node"); }
onClick = () => shell.openExternal(url);
click: function() { shell.openExternal("http://s-a.github.io/donate/"); }
click: () => { shell.openExternal('https://github.com/vesparny/todoo') }
app.once('ready', () => { if (Menu.getApplicationMenu()) return const template = [ { label: 'Edit', submenu: [ { label: 'Undo', accelerator: 'CmdOrCtrl+Z', role: 'undo' }, { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' }, { type: 'separator' }, { label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Paste and Match Style', accelerator: 'Shift+Command+V', role: 'pasteandmatchstyle' }, { label: 'Delete', role: 'delete' }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectall' } ] }, { label: 'View', submenu: [ { label: 'Reload', accelerator: 'CmdOrCtrl+R', click (item, focusedWindow) { if (focusedWindow) focusedWindow.reload() } }, { label: 'Toggle Full Screen', accelerator: (() => { return (process.platform === 'darwin') ? 'Ctrl+Command+F' : 'F11' })(), click (item, focusedWindow) { if (focusedWindow) focusedWindow.setFullScreen(!focusedWindow.isFullScreen()) } }, { label: 'Toggle Developer Tools', accelerator: (() => { return (process.platform === 'darwin') ? 'Alt+Command+I' : 'Ctrl+Shift+I' })(), click (item, focusedWindow) { if (focusedWindow) focusedWindow.toggleDevTools() } } ] }, { label: 'Window', role: 'window', submenu: [ { label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' }, { label: 'Close', accelerator: 'CmdOrCtrl+W', role: 'close' } ] }, { label: 'Help', role: 'help', submenu: [ { label: 'Learn More', click () { shell.openExternal('http://electron.atom.io') } }, { label: 'Documentation', click () { shell.openExternal( `https://github.com/electron/electron/tree/v${process.versions.electron}/docs#readme` ) } }, { label: 'Community Discussions', click () { shell.openExternal('https://discuss.atom.io/c/electron') } }, { label: 'Search Issues', click () { shell.openExternal('https://github.com/electron/electron/issues') } } ] } ] if (process.platform === 'darwin') { template.unshift({ label: 'Electron', submenu: [ { label: 'About Electron', role: 'about' }, { type: 'separator' }, { label: 'Services', role: 'services', submenu: [] }, { type: 'separator' }, { label: 'Hide Electron', accelerator: 'Command+H', role: 'hide' }, { label: 'Hide Others', accelerator: 'Command+Alt+H', role: 'hideothers' }, { label: 'Show All', role: 'unhide' }, { type: 'separator' }, { label: 'Quit ' + app.getName(), accelerator: 'Command+Q', click () { app.quit() } } ] }) template[3].submenu = [ { label: 'Close', accelerator: 'CmdOrCtrl+W', role: 'close' }, { label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' }, { label: 'Zoom', role: 'zoom' }, { type: 'separator' }, { label: 'Bring All to Front', role: 'front' } ] } const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) })
click: () => { shell.openExternal('https://twitter.com/vesparny') }
openInEditor() { electron.shell.openItem(this.path); }
openItem: (fullPath) => shell.openItem(fullPath),
page.on('new-window', (e, url) => { e.preventDefault(); electron.shell.openExternal(url); });
handleExternal(e, url) { if(url != this.wc.getURL()) { e.preventDefault() electron.shell.openExternal(url) } }
module.exports = function createMenu ({ createWindow }) { return [ { label: 'Application', submenu: [ { role: 'about' }, { label: 'Preferences...', accelerator: 'Cmd+,', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('preferences'); } } }, { type: 'separator' }, { role: 'services', submenu: [] }, { type: 'separator' }, { role: 'hide' }, { role: 'hideothers' }, { role: 'unhide' }, { type: 'separator' }, { role: 'quit' } ] }, { label: 'Shell', submenu: [ { label: 'New Window', accelerator: 'CmdOrCtrl+N', click (item, focusedWindow) { createWindow(); } }, { label: 'New Tab', accelerator: 'CmdOrCtrl+T', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('new tab'); } else { createWindow(); } } }, { label: 'Close', accelerator: 'CmdOrCtrl+W', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('close tab'); } } } ] }, { label: 'Edit', submenu: [ { label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' }, { label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' }, { type: 'separator' }, { label: 'Clear', accelerator: 'CmdOrCtrl+K', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('clear'); } } } ] }, { label: 'View', submenu: [ { label: 'Reload', accelerator: 'CmdOrCtrl+R', click (item, focusedWindow) { if (focusedWindow) focusedWindow.reload(); } }, { label: 'Toggle Developer Tools', accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.webContents.toggleDevTools(); } } }, { type: 'separator' }, { label: 'Actual Size', accelerator: 'CmdOrCtrl+0', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('reset font size'); } } }, { label: 'Zoom In', accelerator: 'CmdOrCtrl+plus', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('increase font size'); } } }, { label: 'Zoom Out', accelerator: 'CmdOrCtrl+-', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('decrease font size'); } } } ] }, { label: 'Window', submenu: [ { role: 'minimize' }, { role: 'close' }, { type: 'separator' }, { label: 'Show Previous Tab', accelerator: 'CmdOrCtrl+Left', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('move left'); } } }, { label: 'Show Next Tab', accelerator: 'CmdOrCtrl+Right', click (item, focusedWindow) { if (focusedWindow) { focusedWindow.rpc.emit('move right'); } } }, { type: 'separator' }, { role: 'front' }, { role: 'togglefullscreen' } ] }, { role: 'help', submenu: [ { label: `${appName} Website`, click () { shell.openExternal('https://hyperterm.now.sh'); } }, { label: 'Report an Issue...', click () { const body = ` <!-- Please succinctly describe your issue and steps to reproduce it. --> - ${app.getName()} ${app.getVersion()} Electron ${process.versions.electron} ${process.platform} ${process.arch} ${os.release()}`; shell.openExternal(`https://github.com/zeit/hyperterm/issues/new?body=${encodeURIComponent(body)}`); } }, ...( 'darwin' !== process.platform ? [ { type: 'separator' }, { role: 'about', click () { dialog.showMessageBox({ title: `About ${appName}`, message: `${appName} ${app.getVersion()}`, detail: 'Created by Guillermo Rauch', icon: path.join(__dirname, 'static/Icon.png'), buttons: [] }); } } ] : [] ) ] } ]; };