Hided hr in popup when no upper buttons are present

This commit is contained in:
ManeraKai 2024-03-14 12:59:15 +03:00
parent 498801763f
commit d53d84e398
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 6 additions and 1 deletions

View File

@ -70,10 +70,12 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
// Set visibility of control buttons
if (tabs[0].url) {
const hr = document.getElementById("hr")
url = new URL(tabs[0].url)
servicesHelper.switchInstance(url).then(r => {
if (r) {
document.getElementById("change_instance_div").style.display = ""
hr.style.display = ""
document.getElementById("change_instance").addEventListener("click", async () =>
browser.tabs.update({ url: await servicesHelper.switchInstance(url) })
)
@ -82,6 +84,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.copyRaw(url, true).then(r => {
if (r) {
document.getElementById("copy_original_div").style.display = ""
hr.style.display = ""
document.getElementById("copy_original").addEventListener("click", () =>
servicesHelper.copyRaw(url)
)
@ -90,6 +93,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.reverse(url).then(r => {
if (r) {
document.getElementById("redirect_to_original_div").style.display = ""
hr.style.display = ""
document.getElementById("redirect_to_original").addEventListener("click", () =>
browser.runtime.sendMessage("reverseTab")
)
@ -98,6 +102,7 @@ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
servicesHelper.redirectAsync(url, "main_frame", null, true).then(r => {
if (r) {
document.getElementById("redirect_div").style.display = ""
hr.style.display = ""
document.getElementById("redirect").addEventListener("click", () =>
browser.runtime.sendMessage("redirectTab")
)

View File

@ -30,7 +30,7 @@ html(lang="en")
svg(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" preserveAspectRatio="xMinYMin meet" fill="currentColor")
path(d="M 17,20 V 11 Q 17,10.175 16.412,9.587 15.825,9 15,9 H 6.8 L 8.4,7.4 7,6 3,10 7,14 8.4,12.6 6.8,11 H 15 v 9 z" id="path2")
hr
hr(id="hr" style="display: none")
div(id="current_site")
include /src/pages/popup/switches