Find links without content type, prefer typed
This commit is contained in:
parent
bb56e269c4
commit
f04773a3a9
11
content.js
11
content.js
@ -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 => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user