nostr-links/content.js
2025-04-23 12:59:32 +04:00

21 lines
634 B
JavaScript

document.addEventListener('DOMContentLoaded', function() {
const alternateLinks = document.querySelectorAll('link[rel="alternate"][type="application/nostr+json"]');
if (alternateLinks.length > 0) {
console.debug("[nostr-links] Found:", alternateLinks);
const links = Array.from(alternateLinks).map((link, index) => ({
uri: link.href.replace(/^(nostr|web+nostr):/, ""),
text: link.title.trim()
// icon: "icon.png"
}));
browser.runtime.sendMessage({
action: "showNostrLinksPageAction",
links: links
});
} else {
console.debug("[nostr-links] No nostr links found");
}
});