mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
Final es6 notation stuff
This commit is contained in:
parent
87f952c87b
commit
f3bdddfaa9
@ -196,18 +196,18 @@ Module.register("newsfeed", {
|
|||||||
newsItems.forEach((item) => {
|
newsItems.forEach((item) => {
|
||||||
//Remove selected tags from the beginning of rss feed items (title or description)
|
//Remove selected tags from the beginning of rss feed items (title or description)
|
||||||
if (this.config.removeStartTags === "title" || this.config.removeStartTags === "both") {
|
if (this.config.removeStartTags === "title" || this.config.removeStartTags === "both") {
|
||||||
for (let f = 0; f < this.config.startTags.length; f++) {
|
for (let startTag of this.config.startTags) {
|
||||||
if (item.title.slice(0, this.config.startTags[f].length) === this.config.startTags[f]) {
|
if (item.title.slice(0, startTag.length) === startTag) {
|
||||||
item.title = item.title.slice(this.config.startTags[f].length, item.title.length);
|
item.title = item.title.slice(startTag.length, item.title.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.removeStartTags === "description" || this.config.removeStartTags === "both") {
|
if (this.config.removeStartTags === "description" || this.config.removeStartTags === "both") {
|
||||||
if (this.isShowingDescription) {
|
if (this.isShowingDescription) {
|
||||||
for (let f = 0; f < this.config.startTags.length; f++) {
|
for (let startTag of this.config.startTags) {
|
||||||
if (item.description.slice(0, this.config.startTags[f].length) === this.config.startTags[f]) {
|
if (item.description.slice(0, startTag.length) === startTag) {
|
||||||
item.description = item.description.slice(this.config.startTags[f].length, item.description.length);
|
item.description = item.description.slice(startTag.length, item.description.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,16 +216,16 @@ Module.register("newsfeed", {
|
|||||||
//Remove selected tags from the end of rss feed items (title or description)
|
//Remove selected tags from the end of rss feed items (title or description)
|
||||||
|
|
||||||
if (this.config.removeEndTags) {
|
if (this.config.removeEndTags) {
|
||||||
for (let f = 0; f < this.config.endTags.length; f++) {
|
for (let endTag of this.config.endTags) {
|
||||||
if (item.title.slice(-this.config.endTags[f].length) === this.config.endTags[f]) {
|
if (item.title.slice(-endTag.length) === endTag) {
|
||||||
item.title = item.title.slice(0, -this.config.endTags[f].length);
|
item.title = item.title.slice(0, -endTag.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isShowingDescription) {
|
if (this.isShowingDescription) {
|
||||||
for (let f = 0; f < this.config.endTags.length; f++) {
|
for (let endTag of this.config.endTags) {
|
||||||
if (item.description.slice(-this.config.endTags[f].length) === this.config.endTags[f]) {
|
if (item.description.slice(-endTag.length) === endTag) {
|
||||||
item.description = item.description.slice(0, -this.config.endTags[f].length);
|
item.description = item.description.slice(0, -endTag.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,22 +283,20 @@ Module.register("newsfeed", {
|
|||||||
* Schedule visual update.
|
* Schedule visual update.
|
||||||
*/
|
*/
|
||||||
scheduleUpdateInterval: function () {
|
scheduleUpdateInterval: function () {
|
||||||
var self = this;
|
this.updateDom(this.config.animationSpeed);
|
||||||
|
|
||||||
self.updateDom(self.config.animationSpeed);
|
|
||||||
|
|
||||||
// Broadcast NewsFeed if needed
|
// Broadcast NewsFeed if needed
|
||||||
if (self.config.broadcastNewsFeeds) {
|
if (this.config.broadcastNewsFeeds) {
|
||||||
self.sendNotification("NEWS_FEED", { items: self.newsItems });
|
this.sendNotification("NEWS_FEED", { items: this.newsItems });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.timer = setInterval(function () {
|
this.timer = setInterval(() => {
|
||||||
self.activeItem++;
|
this.activeItem++;
|
||||||
self.updateDom(self.config.animationSpeed);
|
this.updateDom(this.config.animationSpeed);
|
||||||
|
|
||||||
// Broadcast NewsFeed if needed
|
// Broadcast NewsFeed if needed
|
||||||
if (self.config.broadcastNewsFeeds) {
|
if (this.config.broadcastNewsFeeds) {
|
||||||
self.sendNotification("NEWS_FEED", { items: self.newsItems });
|
this.sendNotification("NEWS_FEED", { items: this.newsItems });
|
||||||
}
|
}
|
||||||
}, this.config.updateInterval);
|
}, this.config.updateInterval);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user