aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/index.js b/index.js
index 978cabc..8a6f81b 100644
--- a/index.js
+++ b/index.js
@@ -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)
+ }
});
});
}