Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Image viewer window - remote (data) part */
import * as conf from "conf.js";
import { CHILDREN, READ } from "path/path.js";
const remote = require("electron").remote;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export function match(path) {
let ext = path.toString().split(".").pop();
if (!ext) { return; }
return ext.match(/jpe?g|gif|png|svg|bmp|ico/i);
}
export async function view(path, list) {
let [width, height] = remote.getCurrentWindow().getSize();
let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions, currentOptions);
let window = new remote.BrowserWindow(options);
window.setMenu(null);
/* Audio/Video viewer window - remote (data) part */
import * as conf from "conf.js";
const remote = require("electron").remote;
const audio = /(ogg|mp3|wav|m4a)$/i;
const video = /(mpe?g|mkv|webm|mov|mp4)$/i;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export function match(path) {
let ext = path.toString().split(".").pop();
return ext.match(audio) || ext.match(video);
}
export function view(path, list) {
let [width, height] = remote.getCurrentWindow().getSize();
let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions, currentOptions);
let window = new remote.BrowserWindow(options);
window.setMenu(null);
window.loadURL(`file://${__dirname}/../viewer/av/index.html`);
/* Text viewer window - remote (data) part */
import * as conf from "conf.js";
const remote = require("electron").remote;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
/* views everything */
export function match(path) {
return true;
}
export function view(path, list) {
let [width, height] = remote.getCurrentWindow().getSize();
let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions, currentOptions);
let window = new remote.BrowserWindow(options);
window.setMenu(null);
window.loadURL(`file://${__dirname}/../viewer/text/index.html`);
import * as wm from "util/windowmanager.js";
import * as conf from "conf.js";
const remote = require("electron").remote;
const TIMEOUT = 1000/30; // throttle updates to once per TIMEOUT
const windowOptions = {
resizable: false,
fullscreenable: false,
center: true,
width: 500,
height: 100,
show: false,
useContentSize: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export default class Progress {
constructor(config) {
this._config = config;
this._data = {};
this._window = null;
this._timeout = null;
}
open() {
let options = Object.assign({}, windowOptions, {title: this._config.title});
options.parent = remote.getCurrentWindow();
this._window = new remote.BrowserWindow(options);
this._window.setMenu(null);
/* Issue window - remote (data) part */
import * as wm from "util/windowmanager.js";
import * as conf from "conf.js";
const remote = require("electron").remote;
const windowOptions = {
resizable: false,
fullscreenable: false,
alwaysOnTop: true,
center: true,
width: 500,
height: 60,
show: false,
useContentSize: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export default class Issue {
constructor(config) {
this._config = config;
this._window = null;
this._resolve = null;
}
open() {
let options = Object.assign({}, windowOptions, {title: this._config.title});
options.parent = remote.getCurrentWindow();
this._window = new remote.BrowserWindow(options);
this._window.setMenu(null);
this._window.loadURL(`file://${__dirname}/../issue/index.html`);
import * as conf from "conf.js";
const remote = require("electron").remote;
let window;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export function open() {
if (window) {
window.focus();
return;
}
// let [width, height] = remote.getCurrentWindow().getSize();
// let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions /*, currentOptions */);
window = new remote.BrowserWindow(options);
window.setMenu(null);
window.loadURL(`file://${__dirname}/../settings/index.html`);