diff --git a/README.md b/README.md index 2f689d1..95dd191 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A GUI for downloading Video and Audio files from YouTube using Nodejs and Electr ✅ No external dependencies needed -✅ And ofcourse no trackers or ads +✅ And of-course no trackers or ads ## Screenshots @@ -70,3 +70,7 @@ To run with [Electron](https://www.electronjs.org/) : ``` npm start ``` +To build for Linux +``` +npm run linux +``` \ No newline at end of file diff --git a/assets/css/index.css b/assets/css/index.css index 7667731..8f2f414 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -188,14 +188,22 @@ label { background-color: rgb(64, 227, 64); color: white; border: none; + border-bottom: 5px solid rgb(50, 185, 50); font-size: large; cursor: pointer; display: inline-block; outline:none; + position:relative; animation-duration: 0.5s; animation-timing-function: linear; } +.submitBtn:active{ + border:none; + top:5px; + margin-bottom: 5px; + transition:.3s; +} #incorrectMsg { color: rgb(250, 59, 59); diff --git a/html/about.html b/html/about.html index a30c786..66a333d 100644 --- a/html/about.html +++ b/html/about.html @@ -27,9 +27,7 @@ const { ipcRenderer, shell } = require("electron") document.getElementById("back").addEventListener("click", ()=>{ - ipcRenderer.send("load-page", __dirname + "/index.html") - }) - + ipcRenderer.send("close-secondary") }) document.getElementById("sourceLink").addEventListener("click", ()=>{ shell.openExternal("https://github.com/aandrew-me/ytDownloader") }) diff --git a/html/index.html b/html/index.html index 314a072..12bbb22 100644 --- a/html/index.html +++ b/html/index.html @@ -28,7 +28,7 @@ - +
Processing diff --git a/html/old.html b/html/old.html deleted file mode 100644 index 5b14da2..0000000 --- a/html/old.html +++ /dev/null @@ -1,79 +0,0 @@ -

YouTube Downloader

- - - - -

- -
- Loading - - - - - - - - - - - -
- - -
-
- - -
-

Title:

- -
- - -
- - -
- -
- - -
- - -
- -
- Preparing - - - - - - - - - - - -
- -

- -
- -
- -
- -
- -
- - -
\ No newline at end of file diff --git a/html/preferences.html b/html/preferences.html index b4ed75f..8497776 100644 --- a/html/preferences.html +++ b/html/preferences.html @@ -10,6 +10,7 @@ Home

Preferences

+ Restart app for changes to take place

1. Download location

Default location:

@@ -29,7 +30,7 @@ } getId("back").addEventListener("click", ()=>{ - ipcRenderer.send("load-page", __dirname + "/index.html") + ipcRenderer.send("close-secondary") }) getId("selectLocation").addEventListener("click", ()=>{ diff --git a/main.js b/main.js index ff3c853..360f7cd 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ const { app, BrowserWindow, dialog, ipcMain } = require("electron"); const { autoUpdater } = require("electron-updater"); -let win; +let win, secondaryWindow; function createWindow() { let isTransparent = false; @@ -21,7 +21,7 @@ function createWindow() { win.loadFile("html/index.html"); win.maximize(); - // win.setMenu(null) + win.setMenu(null) win.show(); // win.webContents.openDevTools(); autoUpdater.checkForUpdatesAndNotify(); @@ -39,8 +39,25 @@ app.whenReady().then(() => { } }); -ipcMain.on("load-page", (event, arg) => { - win.loadFile(arg); +ipcMain.on("load-page", (event, file) => { + secondaryWindow = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + }, + parent: win, + modal: true, + show: false, + }); + // win.loadFile(file); + secondaryWindow.loadFile(file); + secondaryWindow.maximize(); + secondaryWindow.show(); +}); + +ipcMain.on("close-secondary", () => { + secondaryWindow.close(); + secondaryWindow = null; }); ipcMain.on("select-location", () => { diff --git a/package.json b/package.json index 92b28a1..698ccfd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "ytdl-core": "^4.11.1" }, "name": "ytdownloader", - "version": "2.0.6", + "version": "2.1.0", "main": "main.js", "scripts": { "start": "electron .", diff --git a/src/renderer.js b/src/renderer.js index b20fbf6..789b4e7 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -40,7 +40,9 @@ async function getVideoInfo(url) { .then((data) => { info = data; }) - .catch((error) => {}); + .catch((error) => { + console.log(error); + }); return info; } @@ -509,11 +511,28 @@ async function findInfo(url, itag) { } // Opening windows +function closeMenu(){ + getId("menuIcon").style.transform = "rotate(0deg)"; + menuIsOpen = false; + let count = 0; + let opacity = 1; + const fade = setInterval(() => { + if (count >= 10) { + clearInterval(fade); + } else { + opacity -= 0.1; + getId("menu").style.opacity = opacity; + count++; + } + }, 50); +} getId("preferenceWin").addEventListener("click", () => { + closeMenu() ipcRenderer.send("load-page", __dirname + "/preferences.html"); }); getId("aboutWin").addEventListener("click", () => { + closeMenu() ipcRenderer.send("load-page", __dirname + "/about.html"); });