1
0
mirror of https://github.com/aureliendavid/rsspreview.git synced 2025-08-24 12:18:38 +00:00

unhtml entry titles

This commit is contained in:
Aurelien David 2018-12-12 19:32:22 +01:00
parent d9aa4e58c6
commit a422b7c9c6
2 changed files with 29 additions and 2 deletions

View File

@ -43,11 +43,11 @@
<xsl:choose>
<xsl:when test="link | atom:link/@href | rss1:link">
<a href="{link | atom:link/@href | rss1:link}" target="_blank">
<span><xsl:value-of select="title | atom:title | rss1:title" /></span>
<span class="entrytitle"><xsl:value-of select="title | atom:title | rss1:title" /></span>
</a>
</xsl:when>
<xsl:otherwise>
<span><xsl:value-of select="title | atom:title | rss1:link" /></span>
<span class="entrytitle"><xsl:value-of select="title | atom:title | rss1:link" /></span>
</xsl:otherwise>
</xsl:choose>

View File

@ -129,6 +129,32 @@
}
function formattitles() {
var et = document.getElementsByClassName("entrytitle");
console.log(et);
for (var i = 0; i<et.length; i++) {
//basically removes html content if there is some
//only do it if there's a tag to avoid doing it when text titles cointain a '&'
//(which can be caught but still displays an error in console, which is annoying)
if (et[i].innerText.indexOf('<') >= 0) {
var tmp = document.createElement("span");
try {
tmp.innerHTML = et[i].innerText;
et[i].innerText = tmp.textContent;
}
catch (e) {}
}
}
}
function addfeedurl(url) {
var h1 = document.getElementById("feedTitleText");
@ -215,6 +241,7 @@
formatdescriptions();
formatfilenames();
formatfilesizes();
formattitles();
extensionimages();
document.title = /*"RSSPreview: " + */document.getElementById("feedTitleText").innerText;