pull/9/head
aandrew-me 3 years ago
parent 75208e90ae
commit d48a88525f

@ -1,6 +1,6 @@
const { app, BrowserWindow, dialog, ipcMain } = require("electron"); const { app, BrowserWindow, dialog, ipcMain } = require("electron");
const { autoUpdater } = require("electron-updater"); const { autoUpdater } = require("electron-updater");
let win let win;
function createWindow() { function createWindow() {
let isTransparent = false; let isTransparent = false;
@ -8,22 +8,22 @@ function createWindow() {
isTransparent = true; isTransparent = true;
} }
win = new BrowserWindow({ win = new BrowserWindow({
show: false, show: false,
icon: __dirname + "/public/icon.png", icon: __dirname + "/public/icon.png",
spellcheck: false, spellcheck: false,
transparent: isTransparent, transparent: isTransparent,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false contextIsolation: false,
} },
}); });
win.loadFile("html/index.html") win.loadFile("html/index.html");
win.maximize(); win.maximize();
// win.setMenu(null) // win.setMenu(null)
win.show(); win.show();
win.webContents.openDevTools() win.webContents.openDevTools();
autoUpdater.checkForUpdatesAndNotify(); autoUpdater.checkForUpdatesAndNotify();
} }
@ -39,21 +39,19 @@ app.whenReady().then(() => {
} }
}); });
ipcMain.on("load-page", (event, arg) => { ipcMain.on("load-page", (event, arg) => {
win.loadFile(arg) win.loadFile(arg);
}) });
ipcMain.on("select-location", ()=>{ ipcMain.on("select-location", () => {
const location = dialog.showOpenDialogSync(win, { const location = dialog.showOpenDialogSync(win, {
properties: ['openFile', 'openDirectory'] properties: ["openFile", "openDirectory"],
}) });
if (location){ if (location) {
win.webContents.send("downloadPath", location) win.webContents.send("downloadPath", location);
} }
}) });
app.on("window-all-closed", () => { app.on("window-all-closed", () => {
if (process.platform !== "darwin") { if (process.platform !== "darwin") {

@ -14,17 +14,16 @@ getId("menuIcon").addEventListener("click", (event) => {
getId("menuIcon").style.transform = "rotate(0deg)"; getId("menuIcon").style.transform = "rotate(0deg)";
menuIsOpen = false; menuIsOpen = false;
let count = 0; let count = 0;
let opacity = 1 let opacity = 1;
const fade = setInterval(() => { const fade = setInterval(() => {
if (count >= 10) { if (count >= 10) {
clearInterval(fade); clearInterval(fade);
} else { } else {
opacity -= .1 opacity -= 0.1;
getId("menu").style.opacity = opacity; getId("menu").style.opacity = opacity;
count++; count++;
} }
}, 50); }, 50);
} else { } else {
getId("menuIcon").style.transform = "rotate(90deg)"; getId("menuIcon").style.transform = "rotate(90deg)";
menuIsOpen = true; menuIsOpen = true;
@ -36,8 +35,6 @@ getId("menuIcon").addEventListener("click", (event) => {
} }
}); });
// Video and audio toggle // Video and audio toggle
videoToggle.addEventListener("click", (event) => { videoToggle.addEventListener("click", (event) => {
@ -61,13 +58,12 @@ let darkTheme = false;
let circle = getId("themeToggleInside"); let circle = getId("themeToggleInside");
const root = document.querySelector(":root"); const root = document.querySelector(":root");
let enabledTransparent = localStorage.getItem("enabledTransparent") let enabledTransparent = localStorage.getItem("enabledTransparent");
let bgColor = "" let bgColor = "";
if (enabledTransparent == "true"){ if (enabledTransparent == "true") {
bgColor = "rgba(40,40,40, .7)" bgColor = "rgba(40,40,40, .7)";
} } else {
else{ bgColor = "rgb(40,40,40)";
bgColor = "rgb(40,40,40)"
} }
function toggle() { function toggle() {

@ -425,14 +425,9 @@ function download(type) {
getId( getId(
newFolderName + "prog" newFolderName + "prog"
).textContent = `Progress: ${progress}%`; ).textContent = `Progress: ${progress}%`;
}) })
.on("end", ()=>{ .on("end", () => {
afterSave( afterSave(downloadDir, filename, newFolderName + "prog");
downloadDir,
filename,
newFolderName + "prog"
);
}) })
.pipe(fs.createWriteStream(path.join(downloadDir, filename))); .pipe(fs.createWriteStream(path.join(downloadDir, filename)));
} }

Loading…
Cancel
Save