From cc2d4f41ebfede83b96efa5fb85462daf2d20125 Mon Sep 17 00:00:00 2001 From: kodxana Date: Tue, 14 Jul 2020 13:27:58 +0200 Subject: [PATCH] Added new button to popup --- popup/popup.css | 26 ++++++++++++++++++++++++++ popup/popup.html | 8 +++++++- popup/popup.js | 13 +++++++++---- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/popup/popup.css b/popup/popup.css index efd5a72..1f3abe0 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -13,6 +13,26 @@ body { margin-bottom: 15px; } +.container2 { + display: block; + text-align: center; + margin: 0 auto; + width: 80%; + margin-bottom: 15px; +} + +.btn1 { + border-radius: 5px; + background-color: #075656; + border: 4px solid #075656; + color: whitesmoke; + font-weight: 400; + padding: 4px 15px; + margin-right: 25px; + text-align: center; +} + + button { border-radius: 5px; background-color: #075656; @@ -36,3 +56,9 @@ label { margin: 15px auto; display: block; } + +.span { + width: 50px; + height: 50px; + background: black; +} diff --git a/popup/popup.html b/popup/popup.html index e9a962e..d647ea0 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -10,13 +10,19 @@ - +
+
+ + + + + diff --git a/popup/popup.js b/popup/popup.js index 3a2d8e5..a91a1f2 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -9,7 +9,7 @@ chrome.storage.local.get(['enabled', 'redirect'], ({ enabled, redirect }) => { const currentButton = enabled ? enable : disable; currentButton.classList.add('active'); - + const currentRadio = !redirect ? lbrySite : redirect === 'lbry.tv' ? lbrySite : lbryApp; currentRadio.classList.add('active'); }); @@ -18,7 +18,7 @@ const checkElementForClass = (elToAdd, elToRemove) => { if(!elToAdd.classList.contains('active')){ elToAdd.classList.add('active'); - elToRemove.classList.remove('active'); + elToRemove.classList.remove('active'); } } @@ -27,12 +27,12 @@ const attachClick = (selector, handler) =>{ const element = event.target; const name = event.target.getAttribute('name'); const value = event.target.getAttribute('value'); - typeof handler==='function' ? handler(element, name, value): null; + typeof handler==='function' ? handler(element, name, value): null; }); } attachClick('.enable', (element, name, value) => { - const parsedValue = !!+value; + const parsedValue = !!+value; if(name){ checkElementForClass(element, name === 'enable' ? disable : enable ); chrome.storage.local.set({ enabled: parsedValue }); @@ -45,3 +45,8 @@ attachClick('.redirect', (element, name, value) => { chrome.storage.local.set({ redirect: value }); } }); + +var button = document.getElementById("btn1"); +button.addEventListener("click", function(){ + chrome.tabs.create({url:"/tools/YTtoLBRY.html"}); +});