mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
fixed eslint error into modules for Javascript files
This commit is contained in:
@@ -44,9 +44,9 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
||||
parser.on("item", function(item) {
|
||||
|
||||
var title = item.title;
|
||||
var description = item.description || item.summary || item.content || '';
|
||||
var description = item.description || item.summary || item.content || "";
|
||||
var pubdate = item.pubdate || item.published || item.updated;
|
||||
var url = item.url || item.link || '';
|
||||
var url = item.url || item.link || "";
|
||||
|
||||
if (title && pubdate) {
|
||||
|
||||
@@ -81,7 +81,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
||||
scheduleTimer();
|
||||
});
|
||||
|
||||
var headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A'};
|
||||
var headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A"};
|
||||
request({uri: url, encoding: null, headers: headers}).pipe(iconv.decodeStream(encoding)).pipe(parser);
|
||||
|
||||
};
|
||||
|
@@ -25,8 +25,8 @@ Module.register("newsfeed",{
|
||||
updateInterval: 10 * 1000,
|
||||
animationSpeed: 2.5 * 1000,
|
||||
maxNewsItems: 0, // 0 for unlimited
|
||||
removeStartTags: '',
|
||||
removeEndTags: '',
|
||||
removeStartTags: "",
|
||||
removeEndTags: "",
|
||||
startTags: [],
|
||||
endTags: []
|
||||
|
||||
@@ -93,33 +93,41 @@ Module.register("newsfeed",{
|
||||
var sourceAndTimestamp = document.createElement("div");
|
||||
sourceAndTimestamp.className = "light small dimmed";
|
||||
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '') sourceAndTimestamp.innerHTML = this.newsItems[this.activeItem].sourceTitle;
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '' && this.config.showPublishDate) sourceAndTimestamp.innerHTML += ', ';
|
||||
if (this.config.showPublishDate) sourceAndTimestamp.innerHTML += moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow();
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '' || this.config.showPublishDate) sourceAndTimestamp.innerHTML += ':';
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "") {
|
||||
sourceAndTimestamp.innerHTML = this.newsItems[this.activeItem].sourceTitle;
|
||||
}
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "" && this.config.showPublishDate) {
|
||||
sourceAndTimestamp.innerHTML += ", ";
|
||||
}
|
||||
if (this.config.showPublishDate) {
|
||||
sourceAndTimestamp.innerHTML += moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow();
|
||||
}
|
||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "" || this.config.showPublishDate) {
|
||||
sourceAndTimestamp.innerHTML += ":";
|
||||
}
|
||||
|
||||
wrapper.appendChild(sourceAndTimestamp);
|
||||
}
|
||||
|
||||
//Remove selected tags from the beginning of rss feed items (title or description)
|
||||
|
||||
if (this.config.removeStartTags == 'title' || 'both') {
|
||||
if (this.config.removeStartTags == "title" || "both") {
|
||||
|
||||
for (f=0; f<this.config.startTags.length;f++) {
|
||||
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
|
||||
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].title.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.config.removeStartTags == 'description' || 'both') {
|
||||
if (this.config.removeStartTags == "description" || "both") {
|
||||
|
||||
if (this.config.showDescription) {
|
||||
for (f=0; f<this.config.startTags.length;f++) {
|
||||
if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
|
||||
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].description.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].description.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,14 +139,14 @@ Module.register("newsfeed",{
|
||||
for (f=0; f<this.config.endTags.length;f++) {
|
||||
if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
|
||||
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.config.showDescription) {
|
||||
for (f=0; f<this.config.endTags.length;f++) {
|
||||
if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
|
||||
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.endTags[f].length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,10 +242,10 @@ Module.register("newsfeed",{
|
||||
for (var f in this.config.feeds) {
|
||||
var feed = this.config.feeds[f];
|
||||
if (feed.url === feedUrl) {
|
||||
return feed.title || '';
|
||||
return feed.title || "";
|
||||
}
|
||||
}
|
||||
return '';
|
||||
return "";
|
||||
},
|
||||
|
||||
/* scheduleUpdateInterval()
|
||||
|
@@ -35,8 +35,8 @@ module.exports = NodeHelper.create({
|
||||
createFetcher: function(feed, config) {
|
||||
var self = this;
|
||||
|
||||
var url = feed.url || '';
|
||||
var encoding = feed.encoding || 'UTF-8';
|
||||
var url = feed.url || "";
|
||||
var encoding = feed.encoding || "UTF-8";
|
||||
var reloadInterval = config.reloadInterval || 5 * 60 * 1000;
|
||||
|
||||
if (!validUrl.isUri(url)) {
|
||||
|
Reference in New Issue
Block a user