diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-11-22 22:29:17 -0600 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-11-22 22:29:17 -0600 |
commit | 2be03e1935e0019fa5c03893dc12acf6ee546222 (patch) | |
tree | a830421ef2bb22d08b0a2cca8c2e400c43ed8434 /index.js | |
parent | bc61a2273f84b9ce65ee57c63770ceba0eb11bf9 (diff) |
Add options and youtube feed support
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -1,28 +1,36 @@ -let base_ttrss = "https://fr.marks.kitchen/public.php?op=subscribe&feed_url=" + +var base_ttrss = undefined + function subscribe_link(feed_url){ - return `${base_ttrss}${encodeURIComponent(feed_url)}`; + return `${base_ttrss}/public.php?op=subscribe&feed_url=${encodeURIComponent(feed_url)}`; } -window.onload = function () { +window.onload = async function () { + let settings = await browser.storage.sync.get("tr"); + base_ttrss = settings.tr; 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) { 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) + + if(base_ttrss){ + let subLink = document.createElement('a'); + subLink["href"] = subscribe_link(item.url) + subLink.innerText = "subscribe"; + newDiv.append(subLink) + } + feeds.append(newDiv) }) if(feed_urls.length == 0) { |