diff options
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -4,24 +4,32 @@ function subscribe_link(feed_url){ } window.onload = function () { + let feeds = document.getElementById('feeds'); + feeds.innerText = "Loading..." + console.log(feeds.innerHTML.toString()) 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) + feeds.innerText = "" 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) }) + if(feed_urls.length == 0) { + let newP = document.createElement('p') + newP.innerText = "No feeds found" + feeds.append(newP) + } }); }); } |