aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.js20
-rw-r--r--manifest.json2
-rw-r--r--options.html15
-rw-r--r--options.js9
4 files changed, 31 insertions, 15 deletions
diff --git a/index.js b/index.js
index 2138dd5..86220b9 100644
--- a/index.js
+++ b/index.js
@@ -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)
}
diff --git a/manifest.json b/manifest.json
index 7ed3af5..9cb0321 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"description": "Finds feeds or generates RSS-Bridge URLs for the current page. Optional integration with tt-rss.",
"manifest_version": 2,
"name": "RSS-Bridge helper",
- "version": "1.0",
+ "version": "1.1",
"content_scripts": [
{
"matches": [
diff --git a/options.html b/options.html
index b248905..5677612 100644
--- a/options.html
+++ b/options.html
@@ -14,8 +14,17 @@
<td><input type="text" id="rb"></td>
</tr>
<tr>
- <td><label for="tr">tt-rss instance</label></td>
- <td><input type="text" id="tr"></td>
+ <td><label for="reader">reader type:</label></td>
+ <td>
+ <select name="reader" id="reader">
+ <option value="ttrss">TT-RSS</option>
+ <option value="miniflux">Miniflux</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="instance">instance URL:</label></td>
+ <td><input type="text" id="instance"></td>
</tr>
<tr>
<td>
@@ -27,4 +36,4 @@
<script src="options.js"></script>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/options.js b/options.js
index 1848954..3d85dbe 100644
--- a/options.js
+++ b/options.js
@@ -2,19 +2,22 @@ function saveOptions(e) {
e.preventDefault();
browser.storage.sync.set({
rb: document.querySelector("#rb").value,
- tr: document.querySelector("#tr").value
+ reader: document.querySelector("#reader").value,
+ instance: document.querySelector("#instance").value
});
}
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#rb").value = result.rb || "";
- document.querySelector("#tr").value = result.tr || "";
+ document.querySelector("#reader").value = result.reader|| "";
+ document.querySelector("#instance").value = result.instance || "";
}
function onError(error) {
console.log(`Error: ${error}`);
}
- let getting = browser.storage.sync.get(["rb", "tr"]);
+ let getting = browser.storage.sync.get(["rb", "instance", "reader"]);
getting.then(setCurrentChoice, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);
+