From 17bfb2058d90ea63a21e754de8902e6a9fdaa578 Mon Sep 17 00:00:00 2001 From: Aurelien David Date: Fri, 26 Oct 2018 10:57:06 +0200 Subject: [PATCH] added feed url + support of rss 1.0 --- icons/home.png | Bin 0 -> 875 bytes manifest.json | 4 +- preview.css | 7 ++++ preview.js | 8 ++++ rss.xsl | 97 ++++++++++++++++++++++++++----------------------- rsspreview.js | 14 ++++++- 6 files changed, 80 insertions(+), 50 deletions(-) create mode 100644 icons/home.png diff --git a/icons/home.png b/icons/home.png new file mode 100644 index 0000000000000000000000000000000000000000..eacc7029e0257da5fdc37113b23ae04fcc6511e9 GIT binary patch literal 875 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGooCO|{#S9GG!XV7ZFl&wkP*AeO zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkD0|V0!PZ!6Kid%2y+|NB^AaLyL z%J&-_Zz@zim|N1^cfs$1;4Q&hoVNsTERbwqztND#ARG|Q6*To(zu>o@=YHC0b~!c7 z*&na>JfZ#O&lE?9_H~(Eg1}3X3Upz5@EP?#-CHsf?@5mrR&!?hEK1I`~aJF$h)#MSSW$ftEodpa$n ztzMnKXxr$$j(KUibO}Somi*lCCdLrujqKvbKQq273T`>UVE+F8x_$2Vz7-sfj4nHp zwGcGC~!Yh$9`rm<0bCGNla&W9f}nFf*OLE zCzzORn5V>`{BY&bc@m$P6?O=yYah5Hc_H+U%9X~{RZMf39IUsh-r){esb}wZ=f8MK z#`67p+2SX^v$Id$fBXHOv^m>kIt{fM{vTsg`qI{Qz|c+fcl@-Qn=j8z{O-1_E{8E~ zt+(d9NhQIdeoSZWXFk+4t4wj2%-X$dW6-;{*sxtM)sK6kBs^f+!$^J%Obshvgf}oU Xs8q18@RdFH6{N(|)z4*}Q$iB}Te4b; literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json index 77bcc70..c055409 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "RSSPreview", - "version": "1.1", + "version": "1.2", "author": "Aurelien David", "homepage_url": "https://github.com/aureliendavid/rsspreview", @@ -29,7 +29,7 @@ } ], - "web_accessible_resources": ["preview.html", "preview.js", "preview.css", "rss.xsl", "icons/file.png"], + "web_accessible_resources": ["preview.html", "preview.js", "preview.css", "rss.xsl", "icons/*.png"], "permissions": ["", "webRequest", "webRequestBlocking"] diff --git a/preview.css b/preview.css index 81488fb..32e5771 100644 --- a/preview.css +++ b/preview.css @@ -114,3 +114,10 @@ a[href] img { width: 16px; margin-right: 3px; } + +.headerIcon { + vertical-align: bottom; + height: 25px; + width: 25px; + margin-right: 2px; +} \ No newline at end of file diff --git a/preview.js b/preview.js index d82cd48..47db891 100644 --- a/preview.js +++ b/preview.js @@ -106,6 +106,13 @@ function formatfilesizes() { } } + +function addfeedurl(url) { + + var h1 = document.getElementById("feedTitleText"); + h1.innerHTML += ' :: Feed URL'; +} + function main() { var query_string = location.search.substring(1).split("&"); @@ -122,6 +129,7 @@ function main() { formatdescriptions(); formatfilenames(); formatfilesizes(); + addfeedurl(feed_url); document.title = "RSSPreview: " + document.getElementById("feedTitleText").innerText; diff --git a/rss.xsl b/rss.xsl index 58e8a09..eb1043d 100644 --- a/rss.xsl +++ b/rss.xsl @@ -1,77 +1,82 @@ + xmlns:atom="http://www.w3.org/2005/Atom" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rss1="http://purl.org/rss/1.0/" + exclude-result-prefixes="atom rdf" > - +
- - - -
- -

- - - - - - - - - - - -
-

-
- -
-
- - -
- - - (, ) -
- -
-
- -
-
- -
- +
+ + +
+ +

+ + + + + + + + + + + +
+

+
+ +
+
+ + +
+ + + (, ) +
+ +
+
+ +
+
+ +
+ - + +
diff --git a/rsspreview.js b/rsspreview.js index 3056bd2..c669121 100644 --- a/rsspreview.js +++ b/rsspreview.js @@ -10,10 +10,20 @@ } window.hasRun = true; - const rootName = document.getRootNode().documentElement.nodeName; + const rootName = document.getRootNode().documentElement.nodeName.toLowerCase(); - if (rootName == "rss" || rootName == "channel" || rootName == "feed") { + var isRSS1 = false; + if (rootName == "rdf" || rootName == "rdf:rdf") { + if (document.getRootNode().documentElement.attributes['xmlns']) { + isRSS1 = (document.getRootNode().documentElement.attributes['xmlns'].nodeValue.search('rss') > 0) + } + } + + + if ( rootName == "rss" || rootName == "channel" // rss2 + || rootName == "feed" // atom + || isRSS1 ) { var feed_url = window.location.href;