Find links without content type, prefer typed

This commit is contained in:
2025-05-26 10:23:10 +04:00
parent bb56e269c4
commit f04773a3a9

View File

@@ -1,8 +1,11 @@
document.addEventListener('DOMContentLoaded', function() {
const linkRels = ['alternate', 'me', 'author'];
const selector = linkRels.map(rel => `link[rel="${rel}"][type="application/nostr+json"]`).join(',');
const links = document.querySelectorAll(selector);
const linkMap = new Map();
const linkRels = ['alternate', 'me', 'author'];
const selectorUntyped = linkRels.map(rel => `link[rel="${rel}"][href^="nostr:"]`).join(',');
const selectorTyped = linkRels.map(rel => `link[rel="${rel}"][type="application/nostr+json"]`).join(',');
const untypedLinks = document.querySelectorAll(selectorUntyped);
const typedLinks = document.querySelectorAll(selectorTyped);
const links = [...untypedLinks, ...typedLinks]
const linkMap = new Map();
if (links.length > 0) {
links.forEach(link => {