mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Added option to remove "more" tags in description
Many feed descriptions end with with a link tag to the actual article online (see http://www.deutschlandfunk.de/die-nachrichten.353.de.rss, for example). The mirror news description looks strange with this tag in the end. I have added an option to remove the tag from the description and updated the readme.md accordingly.
This commit is contained in:
parent
d1f5118bb5
commit
45cb770e41
@ -108,7 +108,20 @@ The following properties can be configured:
|
||||
<br><b>Default value:</b> <code>0</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>showMore</code></td>
|
||||
<td>Remove "more..." tags from the end of the item description.<br>
|
||||
<br><b>Possible values:</b><code>true</code> or <code>false</code>
|
||||
<br><b>Default value:</b> <code>false</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>moreTag</code></td>
|
||||
<td>Specify the exact wording of the "more..." tag.<br>
|
||||
<br><b>Possible values:</b> 'YOUR_MORE_TAG_HERE'
|
||||
<br><b>Default value:</b> <code>''</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -24,7 +24,9 @@ Module.register("newsfeed",{
|
||||
reloadInterval: 5 * 60 * 1000, // every 5 minutes
|
||||
updateInterval: 10 * 1000,
|
||||
animationSpeed: 2.5 * 1000,
|
||||
maxNewsItems: 0 // 0 for unlimited
|
||||
maxNewsItems: 0, // 0 for unlimited
|
||||
more: false,
|
||||
moreTag: 'more'
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
@ -101,6 +103,15 @@ Module.register("newsfeed",{
|
||||
title.innerHTML = this.newsItems[this.activeItem].title;
|
||||
wrapper.appendChild(title);
|
||||
|
||||
//Remove "more" tag from description of rss feeds
|
||||
|
||||
if (this.config.showMore) {
|
||||
if (this.newsItems[this.activeItem].description.slice(-this.config.moreTag.length)==this.config.moreTag) {
|
||||
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.moreTag.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.config.showDescription) {
|
||||
var description = document.createElement("div");
|
||||
description.className = "small light";
|
||||
|
Loading…
x
Reference in New Issue
Block a user