diff --git a/app/ux/WebView.js b/app/ux/WebView.js index d4286955..2ce7666d 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -178,15 +178,29 @@ Ext.define('Rambox.ux.WebView',{ // Open links in default browser webview.addEventListener('new-window', function(e) { - // hack to fix multiple browser tabs on Skype link click, re #11 - if ( e.url.match('https:\/\/web.skype.com\/..\/undefined') ) { - e.preventDefault(); - return; - } else if ( e.url.indexOf('imgpsh_fullsize') >= 0 ) { - require('electron').ipcRenderer.send('image:download', e.url, e.target.partition); - e.preventDefault(); - return; + switch ( me.type ) { + case 'skype': + // hack to fix multiple browser tabs on Skype link click, re #11 + if ( e.url.match('https:\/\/web.skype.com\/..\/undefined') ) { + e.preventDefault(); + return; + } else if ( e.url.indexOf('imgpsh_fullsize') >= 0 ) { + ipc.send('image:download', e.url, e.target.partition); + e.preventDefault(); + return; + } + break; + case 'hangouts': + if ( e.url.indexOf('plus.google.com/u/0/photos/albums') >= 0 ) { + ipc.send('image:popup', e.url, e.target.partition); + e.preventDefault(); + return; + } + break; + default: + break; } + const protocol = require('url').parse(e.url).protocol; if (protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:') { e.preventDefault(); diff --git a/electron/main.js b/electron/main.js index e9a4e2f2..fbc80ebf 100644 --- a/electron/main.js +++ b/electron/main.js @@ -324,6 +324,26 @@ ipcMain.on('image:download', function(event, url, partition) { tmpWindow.webContents.downloadURL(url); }); +// Hangouts +ipcMain.on('image:popup', function(event, url, partition) { + let tmpWindow = new BrowserWindow({ + width: mainWindow.getBounds().width + ,height: mainWindow.getBounds().height + ,parent: mainWindow + ,icon: __dirname + '/../resources/Icon.ico' + ,backgroundColor: '#FFF' + ,autoHideMenuBar: true + ,skipTaskbar: true + ,webPreferences: { + partition: partition + } + }); + + tmpWindow.maximize(); + + tmpWindow.loadURL(url); +}); + // Proxy if ( config.get('proxy') ) app.commandLine.appendSwitch('proxy-server', config.get('proxyHost')+':'+config.get('proxyPort'));