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

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

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

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

Loading…
Cancel
Save