1
0
mirror of https://github.com/aureliendavid/rsspreview.git synced 2025-08-22 11:18:37 +00:00

Merge pull request #30 from jonafato/preview-full-content-option

Add option to preview full feed contents
This commit is contained in:
A. David 2019-02-28 10:04:15 +01:00 committed by GitHub
commit 325fd17273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -8,8 +8,9 @@
xmlns:media="http://search.yahoo.com/mrss/"
exclude-result-prefixes="atom atom03 rdf rss1 media" >
<xsl:output method="html" indent="yes" encoding="utf-8" />
<xsl:param name="fullPreview" />
<xsl:output method="html" indent="yes" encoding="utf-8" />
<xsl:template match="channel | atom:feed | atom03:feed | rss1:channel">
@ -58,7 +59,7 @@
<img class="mediaThumb" src="{ .//media:thumbnail/@url }" width="{ .//media:thumbnail/@width }" height="{ .//media:thumbnail/@height }" />
</xsl:if>
<xsl:choose>
<xsl:when test="atom:summary | atom03:summary">
<xsl:when test="not($fullPreview) and atom:summary | atom03:summary">
<div class="feedRawContent" desctype="{atom:summary/@type | atom03:summary/@type }">
<xsl:copy-of select="atom:summary | atom03:summary" />
</div>

View File

@ -18,6 +18,7 @@
valMaxWidth: "900px",
doDetect: false,
preventPreview: false,
fullPreview: false,
enableCss: false,
customCss: null
};
@ -47,6 +48,7 @@
function applyxsl(xmlin, xsl, node, doc = document) {
let xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
xsltProcessor.setParameter(null, 'fullPreview', options.fullPreview);
let fragment = xsltProcessor.transformToFragment(xmlin, doc);
node.appendChild(fragment);

View File

@ -11,6 +11,8 @@
<hr />
<label class="setting browser-style"><input type="checkbox" id="preventPreview" class="validate" > Display raw xml instead of preview page</label>
<hr />
<label class="setting browser-style"><input type="checkbox" id="fullPreview" class="validate" > Display full articles even when summaries are present</label>
<hr />
<label class="setting browser-style"><input type="checkbox" id="doThumb" class="validate" > Display media:thumbnail images</label>

View File

@ -8,6 +8,7 @@ function saveOptions(e) {
valMaxWidth: document.querySelector("#valMaxWidth").value,
doDetect: document.querySelector("#doDetect").checked,
preventPreview: document.querySelector("#preventPreview").checked,
fullPreview: document.querySelector("#fullPreview").checked,
enableCss: document.querySelector("#enableCss").checked,
customCss: document.querySelector("#customCss").value
});
@ -23,6 +24,7 @@ function restoreOptions() {
document.querySelector("#valMaxWidth").value = result.valMaxWidth;
document.querySelector("#doDetect").checked = result.doDetect;
document.querySelector("#preventPreview").checked = result.preventPreview;
document.querySelector("#fullPreview").checked = result.fullPreview;
document.querySelector("#enableCss").checked = result.enableCss;
document.querySelector("#customCss").value = result.customCss;
}
@ -37,6 +39,7 @@ function restoreOptions() {
valMaxWidth: "900px",
doDetect: false,
preventPreview: false,
fullPreview: false,
enableCss: false,
customCss: null
});