aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-11-21 19:14:49 -0600
committerMark Powers <markppowers0@gmail.com>2020-11-21 19:14:49 -0600
commitbc61a2273f84b9ce65ee57c63770ceba0eb11bf9 (patch)
tree0211524097ffecef4f25acfb6a2bfd56341cffdb
parentf11f68adebf45123adbd0b9889bd40349ef4e7a0 (diff)
Add no feeds and loading messages
-rw-r--r--.gitignore2
-rw-r--r--README.md6
-rw-r--r--index.js14
3 files changed, 18 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cd7ce5c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.web-extension-id
+web-ext-artifacts/
diff --git a/README.md b/README.md
index dbd33c8..7a92d3f 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
This extension has a popup that will give you the option to select from feeds on a page natively (from the link tag in the head), or with RSS-bridge configured to your liking.
-This code is inspired and cloned somewhat from https://github.com/idealclover/Easy-to-RSS/
+This code is inspired and cloned somewhat from https://github.com/idealclover/Easy-to-RSS/. Icons are sourced from this repository as well.
+
+# TODO
+- Add youtube rss
+
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)
+ }
});
});
}