From 122114d09903cd9af5cb5f6b04e9f3eec09b7a28 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 24 Nov 2022 16:31:13 +0700 Subject: [PATCH] remove reduntant popup elements --- extension/index.html | 1 - extension/popup.js | 99 -------------------------------------------- extension/style.css | 6 +-- 3 files changed, 2 insertions(+), 104 deletions(-) diff --git a/extension/index.html b/extension/index.html index 0903861..92b0713 100644 --- a/extension/index.html +++ b/extension/index.html @@ -17,7 +17,6 @@ v0.0.3
-
diff --git a/extension/popup.js b/extension/popup.js index d6985d0..beb4653 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -141,68 +141,6 @@ function setStatusIcon(connected) { } -function downloadEvent() { - - let button = document.getElementById("downloadButton"); - let payload = { - "download": { - "url": button.getAttribute("data-id") - } - }; - - function handleResponse(message) { - console.log("popup.js response: " + JSON.stringify(message)); - browserType.storage.local.remove("youtube").then(response => { - let download = document.getElementById("download"); - download.innerHTML = "" - let message = document.createElement("p"); - message.innerText = "Download link sent to Tube Archivist" - download.appendChild(message) - download.appendChild(document.createElement("hr")); - }) - } - - function handleError(error) { - console.log(`Error: ${error}`); - } - - let sending = browserType.runtime.sendMessage(payload); - sending.then(handleResponse, handleError) - -} - - -function subscribeEvent() { - - let button = document.getElementById("subscribeButton"); - let payload = { - "subscribe": { - "url": button.getAttribute("data-id") - } - }; - - function handleResponse(message) { - console.log("popup.js response: " + JSON.stringify(message)); - browserType.storage.local.remove("youtube").then(response => { - let download = document.getElementById("download"); - download.innerHTML = "" - let message = document.createElement("p"); - message.innerText = "Subscribe link sent to Tube Archivist" - download.appendChild(message) - download.appendChild(document.createElement("hr")); - }) - } - - function handleError(error) { - console.log(`Error: ${error}`); - } - - let sending = browserType.runtime.sendMessage(payload); - sending.then(handleResponse, handleError) - -} - - // fill in form document.addEventListener("DOMContentLoaded", async () => { @@ -241,41 +179,4 @@ document.addEventListener("DOMContentLoaded", async () => { setCookiesOptions(result) }) - browserType.storage.local.get("youtube", function(result) { - if (result.youtube) { - createButtons(result); - } - }) - }) - - -function createButtons(result) { - - let download = document.getElementById("download"); - let linkType = document.createElement("h3"); - linkType.innerText = result.youtube.type.charAt(0).toUpperCase() + result.youtube.type.slice(1); - let title = document.createElement("p"); - title.innerText = result.youtube.title; - - // dl button - let downloadButton = document.createElement("button"); - downloadButton.innerText = "download"; - downloadButton.id = "downloadButton"; - downloadButton.setAttribute("data-id", result.youtube.url); - downloadButton.addEventListener("click", function(){downloadEvent()}, false); - - // subscribe button - let subscribeButton = document.createElement("button"); - subscribeButton.innerText = "subscribe"; - subscribeButton.id = "subscribeButton"; - subscribeButton.setAttribute("data-id", result.youtube.url); - subscribeButton.addEventListener("click", function(){subscribeEvent()}, false); - - download.appendChild(linkType); - download.appendChild(title); - download.appendChild(downloadButton); - download.appendChild(subscribeButton); - download.appendChild(document.createElement("hr")); - -} diff --git a/extension/style.css b/extension/style.css index 288dfdb..1d8052e 100644 --- a/extension/style.css +++ b/extension/style.css @@ -48,8 +48,7 @@ hr { align-items: center; justify-content: center; } -.submit button, -.youtube-page button { +.submit button { margin: 10px; border-radius: 0; padding: 5px 13px; @@ -58,8 +57,7 @@ hr { background-color: #259485; color: #ffffff; } -.submit button:hover, -.youtube-page button:hover { +.submit button:hover { background-color: #97d4c8; transform: scale(1.05); color: #00202f;