aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content_scripts/bridges/instagram.js (renamed from bridges/instagram.js)0
-rw-r--r--content_scripts/bridges/twitter.js (renamed from bridges/twitter.js)0
-rw-r--r--content_scripts/bridges/youtube.js (renamed from bridges/youtube.js)0
-rw-r--r--content_scripts/cs.js (renamed from cs.js)0
-rw-r--r--index.js62
-rw-r--r--manifest.json18
-rw-r--r--options/index.html (renamed from options.html)2
-rw-r--r--options/index.js (renamed from options.js)0
-rw-r--r--popup/index.js123
-rw-r--r--popup/main.html (renamed from main.html)6
-rw-r--r--res/icon_128.png (renamed from icon_128.png)bin1995 -> 1995 bytes
-rw-r--r--res/icon_default.png (renamed from icon_default.png)bin3510 -> 3510 bytes
12 files changed, 139 insertions, 72 deletions
diff --git a/bridges/instagram.js b/content_scripts/bridges/instagram.js
index 0ced06a..0ced06a 100644
--- a/bridges/instagram.js
+++ b/content_scripts/bridges/instagram.js
diff --git a/bridges/twitter.js b/content_scripts/bridges/twitter.js
index e9855cb..e9855cb 100644
--- a/bridges/twitter.js
+++ b/content_scripts/bridges/twitter.js
diff --git a/bridges/youtube.js b/content_scripts/bridges/youtube.js
index 202873b..202873b 100644
--- a/bridges/youtube.js
+++ b/content_scripts/bridges/youtube.js
diff --git a/cs.js b/content_scripts/cs.js
index e57176b..e57176b 100644
--- a/cs.js
+++ b/content_scripts/cs.js
diff --git a/index.js b/index.js
deleted file mode 100644
index 86220b9..0000000
--- a/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-
-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(["rb", "reader", "instance"]);
- base_reader = settings.instance;
- let base_rb = settings.rb;
- let feeds = document.getElementById('feeds');
- feeds.innerText = "Loading..."
- browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
- browser.tabs.sendMessage(tabs[0].id, {}).then(
- function (feed_urls) {
- feeds.innerText = ""
- if(!base_rb) {
- let newSettingsLink = document.createElement("a")
- newSettingsLink["href"] = "/options.html"
- newSettingsLink.innerText = "RSS-bridge instance not set! Click here to open options.";
- let newDiv = document.createElement('div');
- newDiv.append(newSettingsLink);
- feeds.appendChild(newDiv);
-
- let newP = document.createElement('p')
- newP.innerText = `Found ${feed_urls.length} feeds`
- feeds.append(newP)
- return;
- }
-
- feed_urls.forEach(item => {
- let newLink = document.createElement('a');
- newLink["href"] = item.url
- newLink.innerText = item.type;
-
-
- let newDiv = document.createElement('div');
- newDiv.append(newLink)
-
- if(base_reader){
- let subLink = document.createElement('a');
- subLink["href"] = subscribe_link(settings.reader, item.url)
- subLink.innerText = "subscribe";
- newDiv.append(subLink)
- }
-
- feeds.append(newDiv)
- })
- if(feed_urls.length == 0) {
- let newP = document.createElement('p')
- newP.innerText = "No feeds found"
- feeds.append(newP)
- }
- });
- });
-}
-
diff --git a/manifest.json b/manifest.json
index 0fa1dea..a98c9d8 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.2",
+ "version": "1.3",
"content_scripts": [
{
"matches": [
@@ -10,17 +10,17 @@
"https://*/*"
],
"js": [
- "bridges/youtube.js",
- "bridges/twitter.js",
- "bridges/instagram.js",
- "cs.js"
+ "content_scripts/bridges/youtube.js",
+ "content_scripts/bridges/twitter.js",
+ "content_scripts/bridges/instagram.js",
+ "content_scripts/cs.js"
]
}
],
"browser_action": {
- "default_icon": "icon_default.png",
+ "default_icon": "res/icon_default.png",
"default_title": "See feeds for this page",
- "default_popup": "main.html"
+ "default_popup": "popup/main.html"
},
"permissions": [
"http://*/*",
@@ -29,7 +29,7 @@
"tabs"
],
"options_ui": {
- "page": "options.html"
+ "page": "options/index.html"
},
"browser_specific_settings": {
"gecko": {
@@ -38,6 +38,6 @@
}
},
"icons": {
- "128": "icon_128.png"
+ "128": "res/icon_128.png"
}
}
diff --git a/options.html b/options/index.html
index 5677612..9817b71 100644
--- a/options.html
+++ b/options/index.html
@@ -33,7 +33,7 @@
</tr>
</table>
</form>
- <script src="options.js"></script>
+ <script src="options/index.js"></script>
</body>
</html>
diff --git a/options.js b/options/index.js
index 3d85dbe..3d85dbe 100644
--- a/options.js
+++ b/options/index.js
diff --git a/popup/index.js b/popup/index.js
new file mode 100644
index 0000000..c674f39
--- /dev/null
+++ b/popup/index.js
@@ -0,0 +1,123 @@
+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(["rb", "reader", "instance"]);
+ base_reader = settings.instance;
+ let base_rb = settings.rb;
+ let feeds = document.getElementById('feeds');
+ feeds.innerText = "Loading..."
+ browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {
+ browser.tabs.sendMessage(tabs[0].id, {}).then(
+ function (feed_urls) {
+ feeds.innerText = ""
+ if(!base_rb) {
+ let newSettingsLink = document.createElement("a")
+ newSettingsLink["href"] = "/options.html"
+ newSettingsLink.innerText = "RSS-bridge instance not set! Click here to open options.";
+ let newDiv = document.createElement('div');
+ newDiv.append(newSettingsLink);
+ feeds.appendChild(newDiv);
+
+ let newP = document.createElement('p')
+ newP.innerText = `Found ${feed_urls.length} feeds`
+ feeds.append(newP)
+ return;
+ }
+
+ feed_urls.forEach(item => {
+ let newLink = document.createElement('a');
+ newLink["href"] = item.url
+ newLink.innerText = item.type;
+
+
+ let newDiv = document.createElement('div');
+ newDiv.append(newLink)
+
+ let previewLink = document.createElement('a');
+ previewLink["onclick"] = function(){
+ fetch(item.url)
+ .then( r => r.text() )
+ .then(r => new window.DOMParser().parseFromString(r, "text/xml"))
+ .then(p => {
+ let channelTitle = "Items"
+ let description = undefined
+ let items = []
+ let lastBuild = undefined
+ console.log(p.firstChild.children)
+ for(const channel of p.firstChild.children) {
+ //p.firstChild.children.forEach(channel => {
+ for(const child of channel.children) {
+ //channel.children.forEach(child => {
+ if(child.tagName == "title"){
+ channelTitle = child.textContent
+ } else if (child.tagName == "lastBuildDate") {
+ lastBuild = child.textContent
+ } else if (child.tagName == "description") {
+ description = child.textContent
+ } else if (child.tagName == "item") {
+ item = {}
+ for(const c of child.children){
+ //child.children.forEach(c => {
+ item[c.tagName] = c.innerHTML
+ }
+ items.push(item)
+ }
+ }
+ }
+ console.log(items)
+ let tableEl = document.createElement("table")
+ items.forEach(item => {
+ let trEl = document.createElement("tr")
+ tableEl.append(trEl)
+
+ let tdEl = document.createElement("td")
+
+ let titleEl = document.createElement("a")
+ titleEl.href = item["link"]
+ titleEl.innerText = item["title"]
+ let wrapperDiv = document.createElement("div")
+ wrapperDiv.append(titleEl)
+ let wrapperDiv2 = document.createElement("div")
+ wrapperDiv2.innerText = item["pubDate"]
+ tdEl.append(wrapperDiv)
+ tdEl.append(wrapperDiv2)
+ trEl.append(tdEl)
+
+ let td3El = document.createElement("td")
+ td3El.innerHTML = item["description"]
+ trEl.append(td3El)
+
+ })
+ feeds.append(tableEl)
+ })
+ }
+ previewLink["href"] = "#"
+ previewLink.innerText = "preview";
+ newDiv.append(previewLink)
+
+ if(base_reader){
+ let subLink = document.createElement('a');
+ subLink["href"] = subscribe_link(settings.reader, item.url)
+ subLink.innerText = "subscribe";
+ newDiv.append(subLink)
+ }
+
+ feeds.append(newDiv)
+ })
+ if(feed_urls.length == 0) {
+ let newP = document.createElement('p')
+ newP.innerText = "No feeds found"
+ feeds.append(newP)
+ }
+ });
+ });
+}
+
diff --git a/main.html b/popup/main.html
index 1895055..81f8f06 100644
--- a/main.html
+++ b/popup/main.html
@@ -6,6 +6,12 @@
div a {
margin: 1em;
}
+ table td a {
+ margin: 0em;
+ }
+ td {
+ border: 1px solid black;
+ }
</style>
</head>
<body>
diff --git a/icon_128.png b/res/icon_128.png
index a3e973d..a3e973d 100644
--- a/icon_128.png
+++ b/res/icon_128.png
Binary files differ
diff --git a/icon_default.png b/res/icon_default.png
index 75ca555..75ca555 100644
--- a/icon_default.png
+++ b/res/icon_default.png
Binary files differ