Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Fix video popup
Browse files Browse the repository at this point in the history
  • Loading branch information
ebith committed May 31, 2018
1 parent f0fed82 commit a18531c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {app, BrowserWindow, shell} from 'electron';
import path from 'path';
import url from 'url';
import libUrl from 'url';
import Store from 'electron-store';
import loadDevtool from 'electron-load-devtool';
import Auth from './auth';
Expand Down Expand Up @@ -35,7 +35,8 @@ const createWindow = () => {

win.webContents.on('new-window', (event, url) => {
event.preventDefault();
if (/\.(jpg|png|gif|mp4)$/.test(url)) {
const pathname = new libUrl.URL(url).pathname;
if (/\.(jpg|png|gif|mp4)$/.test(pathname)) {
const popup = new BrowserWindow({show: false});
popup.once('ready-to-show', () => {
popup.webContents.executeJavaScript(`
Expand Down Expand Up @@ -81,7 +82,7 @@ const createWindow = () => {
});

win.loadURL(
url.format({
libUrl.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true,
Expand Down

0 comments on commit a18531c

Please # to comment.