diff options
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,13 +1,17 @@ -var base_ttrss = undefined - -function subscribe_link(feed_url){ - return `${base_ttrss}/public.php?op=subscribe&feed_url=${encodeURIComponent(feed_url)}`; +var base_reader = undefined + +function subscribe_link(reader, feed_url){ + if(reader == "ttrss"){ + return `${base_reader}/public.php?op=subscribe&feed_url=${encodeURIComponent(feed_url)}`; + } else { + return `${base_reader}/bookmarklet?uri=${encodeURIComponent(feed_url)}`; + } } window.onload = async function () { - let settings = await browser.storage.sync.get(["tr", "rb"]); - base_ttrss = settings.tr; + let settings = await browser.storage.sync.get(["rb", "reader", "instance"]); + base_reader = settings.instance; let base_rb = settings.rb; let feeds = document.getElementById('feeds'); feeds.innerText = "Loading..." @@ -38,9 +42,9 @@ window.onload = async function () { let newDiv = document.createElement('div'); newDiv.append(newLink) - if(base_ttrss){ + if(base_reader){ let subLink = document.createElement('a'); - subLink["href"] = subscribe_link(item.url) + subLink["href"] = subscribe_link(settings.reader, item.url) subLink.innerText = "subscribe"; newDiv.append(subLink) } |