mirror of
https://github.com/aureliendavid/rsspreview.git
synced 2025-08-22 19:28:39 +00:00
handle xhtml descriptions in atom feed (#9)
This commit is contained in:
parent
9b0475d211
commit
7b32d30192
@ -1,5 +1,5 @@
|
||||
|
||||
Firefox has removed support for RSS in versions 62+.
|
||||
Firefox has removed support for RSS in versions 64+.
|
||||
|
||||
This includes the feed preview feature that was quite useful for some people.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "RSSPreview",
|
||||
"version": "2.2",
|
||||
"version": "2.3",
|
||||
"author": "Aurelien David",
|
||||
"homepage_url": "https://github.com/aureliendavid/rsspreview",
|
||||
|
||||
|
4
rss.xsl
4
rss.xsl
@ -53,8 +53,8 @@
|
||||
|
||||
<div class="lastUpdated"><xsl:value-of select="pubDate | atom:updated | rss1:pubDate" /></div>
|
||||
</h3>
|
||||
<div class="feedRawContent">
|
||||
<xsl:value-of select="description | atom:summary | atom:content | rss1:description" />
|
||||
<div class="feedRawContent" desctype="{atom:content/@type}">
|
||||
<xsl:copy-of select="description | atom:summary | atom:content | rss1:description" />
|
||||
</div>
|
||||
<div class="enclosures">
|
||||
<xsl:for-each select="enclosure | atom:link[@rel='enclosure'] | rss1:enclosure">
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
|
||||
function applyxsl(xmlin, xsl, node, doc=document) {
|
||||
|
||||
var xsltProcessor = new XSLTProcessor();
|
||||
xsltProcessor.importStylesheet(xsl);
|
||||
|
||||
@ -85,18 +84,24 @@
|
||||
var tohtml = el.getElementsByClassName("feedRawContent");
|
||||
for (var i = 0; i<tohtml.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
var html_desc = html_parser.parseFromString('<div class="feedEntryContent">'+tohtml[i].innerText+'</div>', "text/html");
|
||||
var xml_desc = xml_parser.serializeToString(html_desc.body.firstChild);
|
||||
|
||||
tohtml[i].insertAdjacentHTML('afterend', xml_desc);
|
||||
tohtml[i].setAttribute("todel", 1);
|
||||
|
||||
// in case of xhtml the content is already parsed
|
||||
if (tohtml[i].getAttribute("desctype") == "xhtml") {
|
||||
tohtml[i].classList.add("feedEntryContent");
|
||||
tohtml[i].classList.remove("feedRawContent");
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.log(tohtml[i].innerHTML);
|
||||
else {
|
||||
|
||||
try {
|
||||
var html_desc = html_parser.parseFromString('<div class="feedEntryContent">'+tohtml[i].innerText+'</div>', "text/html");
|
||||
var xml_desc = xml_parser.serializeToString(html_desc.body.firstChild);
|
||||
|
||||
tohtml[i].insertAdjacentHTML('afterend', xml_desc);
|
||||
tohtml[i].setAttribute("todel", 1);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
console.log(tohtml[i].innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user