From 923c36b0bba2825fc537631bac75b94c7e459f45 Mon Sep 17 00:00:00 2001 From: RyannKim327 Date: Sat, 1 Jun 2024 05:02:17 +0800 Subject: [PATCH] 06-01-24 05:02 [Auto Paste Clipboard Link] --- index.css | 113 +++++++++++++++++++++++++------------------------- index.js | 13 +++++- manifest.json | 4 +- 3 files changed, 71 insertions(+), 59 deletions(-) diff --git a/index.css b/index.css index b21b9cb..da35bb7 100644 --- a/index.css +++ b/index.css @@ -1,78 +1,79 @@ * { - margin: 0; - padding: 0; - box-sizing: border-box; - user-select: none; - outline: none; + margin: 0; + padding: 0; + box-sizing: border-box; + user-select: none; + outline: none; } -html{ - min-width: 25em; - min-height: 10em; +html { + min-width: 30em; + min-height: 25em; } main { - display: flex; - flex-direction: column; - align-items: center; + display: flex; + flex-direction: column; + align-items: center; } main > div { - display: flex; - flex-direction: column; - width: 75%; - box-sizing: border-box; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - margin: 1em; - box-shadow: 3px 3px 5px #333333; - align-items: center; - padding: .5em; - border-radius: .5em; + display: flex; + flex-direction: column; + width: 75%; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + margin: 1em; + box-shadow: 3px 3px 5px #333333; + align-items: center; + padding: 0.5em; + border-radius: 0.5em; } main > div > input { - border: 0; - background-color: transparent; - border-radius: .5em; - /* box-shadow: 3px 3px 5px #333333; */ - border: 1px black solid; - font-family: 'Times New Roman', Times, serif; - padding: .15em .5em; - width: 90%; - margin: .5em; - box-sizing: border-box; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; + border: 0; + background-color: transparent; + border-radius: 0.5em; + /* box-shadow: 3px 3px 5px #333333; */ + border: 1px black solid; + font-family: "Times New Roman", Times, serif; + padding: 0.15em 0.5em; + width: 90%; + margin: 0.5em; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; } main > div > #links { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; } -main > div > h3, main > div > h5{ - text-align: center; +main > div > h3, +main > div > h5 { + text-align: center; } main > div > #links { - max-height: 50vh; - overflow-y: scroll; - width: 100%; - margin: 1em; - padding: 0 .75em; + max-height: 50vh; + overflow-y: scroll; + width: 100%; + margin: 1em; + padding: 0 0.75em; } -main > div > #links > a{ - width: 100%; - text-align: center; - color: black; - text-decoration: none; - background-color: wheat; - border-radius: .5em; - box-shadow: 3px 3px 5px #333333; - margin: .25em; - padding: .1em 1em; -} \ No newline at end of file +main > div > #links > a { + width: 100%; + text-align: center; + color: black; + text-decoration: none; + background-color: wheat; + border-radius: 0.5em; + box-shadow: 3px 3px 5px #333333; + margin: 0.25em; + padding: 0.1em 1em; +} diff --git a/index.js b/index.js index 46f7271..a474882 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,17 @@ const url = "https://avd.vercel.app/convert" let converting = true +window.onfocus = async () => { + navigator.permissions.query({name: "clipboard-read"}) + const url = await navigator.clipboard.readText().then(c => { + if(c.includes("youtube.com") || c.includes("facebook.com")){ + document.getElementById("title").textContent = "Auto fetch data using clipboard onload" + requestDownload(c) + document.getElementById("url").value = c + } + }) +} + document.getElementById("url").onchange = () => { const urlData = document.getElementById("url").value if(urlData.includes("youtube.com") || urlData.includes("facebook.com")){ @@ -49,4 +60,4 @@ function requestDownload(videoURL){ converting = false }) } -} \ No newline at end of file +} diff --git a/manifest.json b/manifest.json index caac507..13d0f4e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Audio Video Downloader", - "version": "0.0.1", + "version": "0.0.2", "author": "RyannKim327", "permissions": [ "activeTab", @@ -37,4 +37,4 @@ "128": "logo.png" }, "manifest_version": 3 -} \ No newline at end of file +}