Find links without content type, prefer typed

This commit is contained in:
Râu Cao 2025-05-26 10:23:10 +04:00
parent bb56e269c4
commit f04773a3a9
Signed by: raucao
GPG Key ID: 37036C356E56CC51

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 => {