let base_ttrss = "https://fr.marks.kitchen/public.php?op=subscribe&feed_url=" function subscribe_link(feed_url){ return `${base_ttrss}${encodeURIComponent(feed_url)}`; } window.onload = function () { browser.tabs.query({ active: true, currentWindow: true }, function (tabs) { browser.tabs.sendMessage(tabs[0].id, {}).then( function (feed_urls) { let feeds = document.getElementById('feeds'); // let feed_urls = get_feed_urls() console.log("received ", feed_urls.length) feed_urls.forEach(item => { let newLink = document.createElement('a'); newLink["href"] = item.url newLink.innerText = item.type; let subLink = document.createElement('a'); subLink["href"] = subscribe_link(item.url) subLink.innerText = "subscribe"; let newDiv = document.createElement('div'); newDiv.append(newLink) newDiv.append(subLink) feeds.append(newDiv) }) }); }); }