| 
									
										
										
										
											2020-08-27 07:31:51 -07:00
										 |  |  | const { ipcRenderer, shell } = require('electron') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const saveBtn = document.getElementById('save-dialog') | 
					
						
							|  |  |  | const links = document.querySelectorAll('a[href]') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | saveBtn.addEventListener('click', event => { | 
					
						
							|  |  |  |   ipcRenderer.send('save-dialog') | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ipcRenderer.on('saved-file', (event, path) => { | 
					
						
							|  |  |  |   if (!path) path = 'No path' | 
					
						
							|  |  |  |   document.getElementById('file-saved').innerHTML = `Path selected: ${path}` | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Array.prototype.forEach.call(links, (link) => { | 
					
						
							|  |  |  |   const url = link.getAttribute('href') | 
					
						
							|  |  |  |   if (url.indexOf('http') === 0) { | 
					
						
							|  |  |  |     link.addEventListener('click', (e) => { | 
					
						
							|  |  |  |       e.preventDefault() | 
					
						
							|  |  |  |       shell.openExternal(url) | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-11-01 05:04:24 +11:00
										 |  |  | }) |