This commit is contained in:
2025-04-23 12:43:41 +04:00
commit 44d5b62b3c
9 changed files with 173 additions and 0 deletions

49
popup/nostr-links.css Normal file
View File

@@ -0,0 +1,49 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
background-color: #fff;
min-width: 200px;
border: 1px solid #ccc;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.dropdown-menu {
list-style: none;
margin: 0;
padding: 4px 0;
}
.dropdown-menu li {
margin: 0;
padding: 0;
}
.dropdown-menu a {
display: flex;
align-items: center;
padding: 8px 12px;
color: #333;
text-decoration: none;
white-space: nowrap;
transition: background-color 0.1s ease;
}
.dropdown-menu a:hover {
background-color: #f0f0f0;
color: #000;
}
.dropdown-menu a.disabled {
color: #999;
pointer-events: none;
cursor: default;
}
.menu-icon {
display: none;
width: 16px;
height: 16px;
margin-right: 8px;
vertical-align: middle;
}

13
popup/nostr-links.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nostr Links</title>
<link rel="stylesheet" href="nostr-links.css">
</head>
<body>
<ul class="dropdown-menu" id="link-menu"></ul>
<script src="nostr-links.js"></script>
</body>
</html>

20
popup/nostr-links.js Normal file
View File

@@ -0,0 +1,20 @@
browser.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const tabId = tabs[0].id;
browser.runtime.sendMessage({ action: "getNostrLinks", tabId }, (response) => {
const menu = document.getElementById("link-menu");
if (response.links && response.links.length > 0) {
menu.innerHTML = response.links
.map(
(link) => `
<li>
<a href="web+nostr:${link.uri}" target="_blank">
${link.text || "Open on Nostr"}
</a>
</li>
`
)
.join("");
}
});
});