Find links without content type, prefer typed
This commit is contained in:
parent
bb56e269c4
commit
f04773a3a9
@ -1,7 +1,10 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const linkRels = ['alternate', 'me', 'author'];
|
const linkRels = ['alternate', 'me', 'author'];
|
||||||
const selector = linkRels.map(rel => `link[rel="${rel}"][type="application/nostr+json"]`).join(',');
|
const selectorUntyped = linkRels.map(rel => `link[rel="${rel}"][href^="nostr:"]`).join(',');
|
||||||
const links = document.querySelectorAll(selector);
|
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();
|
const linkMap = new Map();
|
||||||
|
|
||||||
if (links.length > 0) {
|
if (links.length > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user