let types = { 'application/rss+xml': "rss", 'application/atom+xml': "atom", 'application/rdf+xml': "rdf", 'application/rss': "rss", 'application/atom': "atom", 'application/rdf': "rdf", 'text/rss+xml': "rss", 'text/atom+xml': "atom", 'text/rdf+xml': "rdf", 'text/rss': "rss", 'text/atom': "atom", 'text/rdf': "rdf" } // Scrape feed links from DOM function find_feeds_in_page() { let links = document.querySelectorAll('link[type]'); let feeds = []; for (let i = 0; i < links.length; i++) { if (links[i].hasAttribute('type') && links[i].getAttribute('type') in types) { let title = links[i].getAttribute('title') let href = links[i].getAttribute('href') let feed_url = new URL(href, window.location.href).href let type = types[links[i].getAttribute('type')] let feed = { name: `native: ${title || type}`, type: type, url: feed_url, }; feeds.push(feed); } } return feeds }