mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 20:22:53 +00:00
fixed eslint error into modules for Javascript files
This commit is contained in:
parent
8ad00025ad
commit
83ee0534f2
@ -6,7 +6,10 @@ module.exports = function(grunt) {
|
|||||||
options: {
|
options: {
|
||||||
configFile: ".eslintrc.json"
|
configFile: ".eslintrc.json"
|
||||||
},
|
},
|
||||||
target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js", "serveronly/*.js", "*.js"]
|
target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js",
|
||||||
|
"serveronly/*.js", "*.js", "!modules/default/alert/notificationFx.js",
|
||||||
|
"!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
stylelint: {
|
stylelint: {
|
||||||
simple: {
|
simple: {
|
||||||
|
@ -8,18 +8,18 @@
|
|||||||
|
|
||||||
var CalendarFetcher = require("./calendarfetcher.js");
|
var CalendarFetcher = require("./calendarfetcher.js");
|
||||||
|
|
||||||
var url = 'https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics';
|
var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics";
|
||||||
var fetchInterval = 60 * 60 * 1000;
|
var fetchInterval = 60 * 60 * 1000;
|
||||||
var maximumEntries = 10;
|
var maximumEntries = 10;
|
||||||
var maximumNumberOfDays = 365;
|
var maximumNumberOfDays = 365;
|
||||||
|
|
||||||
console.log('Create fetcher ...');
|
console.log("Create fetcher ...");
|
||||||
|
|
||||||
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
|
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
|
||||||
|
|
||||||
fetcher.onReceive(function(fetcher) {
|
fetcher.onReceive(function(fetcher) {
|
||||||
console.log(fetcher.events());
|
console.log(fetcher.events());
|
||||||
console.log('------------------------------------------------------------');
|
console.log("------------------------------------------------------------");
|
||||||
});
|
});
|
||||||
|
|
||||||
fetcher.onError(function(fetcher, error) {
|
fetcher.onError(function(fetcher, error) {
|
||||||
@ -29,5 +29,5 @@ fetcher.onError(function(fetcher, error) {
|
|||||||
|
|
||||||
fetcher.startFetch();
|
fetcher.startFetch();
|
||||||
|
|
||||||
console.log('Create fetcher done! ');
|
console.log("Create fetcher done! ");
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
Module.register("clock",{
|
Module.register("clock",{
|
||||||
// Module config defaults.
|
// Module config defaults.
|
||||||
defaults: {
|
defaults: {
|
||||||
displayType: 'digital', // options: digital, analog, both
|
displayType: "digital", // options: digital, analog, both
|
||||||
|
|
||||||
timeFormat: config.timeFormat,
|
timeFormat: config.timeFormat,
|
||||||
displaySeconds: true,
|
displaySeconds: true,
|
||||||
@ -18,11 +18,11 @@ Module.register("clock",{
|
|||||||
showDate: true,
|
showDate: true,
|
||||||
|
|
||||||
/* specific to the analog clock */
|
/* specific to the analog clock */
|
||||||
analogSize: '200px',
|
analogSize: "200px",
|
||||||
analogFace: 'simple', // options: 'none', 'simple', 'face-###' (where ### is 001 to 012 inclusive)
|
analogFace: "simple", // options: 'none', 'simple', 'face-###' (where ### is 001 to 012 inclusive)
|
||||||
analogPlacement: 'bottom', // options: 'top', 'bottom', 'left', 'right'
|
analogPlacement: "bottom", // options: 'top', 'bottom', 'left', 'right'
|
||||||
analogShowDate: 'top', // options: false, 'top', or 'bottom'
|
analogShowDate: "top", // options: false, 'top', or 'bottom'
|
||||||
secondsColor: '#888888',
|
secondsColor: "#888888",
|
||||||
timezone: null,
|
timezone: null,
|
||||||
},
|
},
|
||||||
// Define required scripts.
|
// Define required scripts.
|
||||||
@ -92,7 +92,7 @@ Module.register("clock",{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.config.showDate){
|
if(this.config.showDate){
|
||||||
dateWrapper.innerHTML = now.format("dddd, LL");
|
dateWrapper.innerHTML = now.format("dddd, LL");
|
||||||
}
|
}
|
||||||
timeWrapper.innerHTML = timeString;
|
timeWrapper.innerHTML = timeString;
|
||||||
secondsWrapper.innerHTML = now.format("ss");
|
secondsWrapper.innerHTML = now.format("ss");
|
||||||
@ -112,7 +112,7 @@ Module.register("clock",{
|
|||||||
* Create wrappers for ANALOG clock, only if specified in config
|
* Create wrappers for ANALOG clock, only if specified in config
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (this.config.displayType !== 'digital') {
|
if (this.config.displayType !== "digital") {
|
||||||
// If it isn't 'digital', then an 'analog' clock was also requested
|
// If it isn't 'digital', then an 'analog' clock was also requested
|
||||||
|
|
||||||
// Calculate the degree offset for each hand of the clock
|
// Calculate the degree offset for each hand of the clock
|
||||||
@ -131,10 +131,10 @@ Module.register("clock",{
|
|||||||
clockCircle.style.width = this.config.analogSize;
|
clockCircle.style.width = this.config.analogSize;
|
||||||
clockCircle.style.height = this.config.analogSize;
|
clockCircle.style.height = this.config.analogSize;
|
||||||
|
|
||||||
if (this.config.analogFace != '' && this.config.analogFace != 'simple' && this.config.analogFace != 'none') {
|
if (this.config.analogFace != "" && this.config.analogFace != "simple" && this.config.analogFace != "none") {
|
||||||
clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)";
|
clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)";
|
||||||
clockCircle.style.backgroundSize = "100%";
|
clockCircle.style.backgroundSize = "100%";
|
||||||
} else if (this.config.analogFace != 'none') {
|
} else if (this.config.analogFace != "none") {
|
||||||
clockCircle.style.border = "2px solid white";
|
clockCircle.style.border = "2px solid white";
|
||||||
}
|
}
|
||||||
var clockFace = document.createElement("div");
|
var clockFace = document.createElement("div");
|
||||||
@ -168,18 +168,18 @@ Module.register("clock",{
|
|||||||
* Combine wrappers, check for .displayType
|
* Combine wrappers, check for .displayType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (this.config.displayType === 'digital') {
|
if (this.config.displayType === "digital") {
|
||||||
// Display only a digital clock
|
// Display only a digital clock
|
||||||
wrapper.appendChild(dateWrapper);
|
wrapper.appendChild(dateWrapper);
|
||||||
wrapper.appendChild(timeWrapper);
|
wrapper.appendChild(timeWrapper);
|
||||||
} else if (this.config.displayType === 'analog') {
|
} else if (this.config.displayType === "analog") {
|
||||||
// Display only an analog clock
|
// Display only an analog clock
|
||||||
dateWrapper.style.textAlign = "center";
|
dateWrapper.style.textAlign = "center";
|
||||||
dateWrapper.style.paddingBottom = "15px";
|
dateWrapper.style.paddingBottom = "15px";
|
||||||
if (this.config.analogShowDate === 'top') {
|
if (this.config.analogShowDate === "top") {
|
||||||
wrapper.appendChild(dateWrapper);
|
wrapper.appendChild(dateWrapper);
|
||||||
wrapper.appendChild(clockCircle);
|
wrapper.appendChild(clockCircle);
|
||||||
} else if (this.config.analogShowDate === 'bottom') {
|
} else if (this.config.analogShowDate === "bottom") {
|
||||||
wrapper.appendChild(clockCircle);
|
wrapper.appendChild(clockCircle);
|
||||||
wrapper.appendChild(dateWrapper);
|
wrapper.appendChild(dateWrapper);
|
||||||
} else {
|
} else {
|
||||||
@ -199,11 +199,11 @@ Module.register("clock",{
|
|||||||
digitalWrapper.appendChild(dateWrapper);
|
digitalWrapper.appendChild(dateWrapper);
|
||||||
digitalWrapper.appendChild(timeWrapper);
|
digitalWrapper.appendChild(timeWrapper);
|
||||||
|
|
||||||
if (placement === 'left' || placement === 'right') {
|
if (placement === "left" || placement === "right") {
|
||||||
digitalWrapper.style.display = "inline-block";
|
digitalWrapper.style.display = "inline-block";
|
||||||
digitalWrapper.style.verticalAlign = "top";
|
digitalWrapper.style.verticalAlign = "top";
|
||||||
analogWrapper.style.display = "inline-block";
|
analogWrapper.style.display = "inline-block";
|
||||||
if (placement === 'left') {
|
if (placement === "left") {
|
||||||
analogWrapper.style.padding = "0 20px 0 0";
|
analogWrapper.style.padding = "0 20px 0 0";
|
||||||
wrapper.appendChild(analogWrapper);
|
wrapper.appendChild(analogWrapper);
|
||||||
wrapper.appendChild(digitalWrapper);
|
wrapper.appendChild(digitalWrapper);
|
||||||
@ -214,7 +214,7 @@ Module.register("clock",{
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
digitalWrapper.style.textAlign = "center";
|
digitalWrapper.style.textAlign = "center";
|
||||||
if (placement === 'top') {
|
if (placement === "top") {
|
||||||
analogWrapper.style.padding = "0 0 20px 0";
|
analogWrapper.style.padding = "0 0 20px 0";
|
||||||
wrapper.appendChild(analogWrapper);
|
wrapper.appendChild(analogWrapper);
|
||||||
wrapper.appendChild(digitalWrapper);
|
wrapper.appendChild(digitalWrapper);
|
||||||
|
@ -29,7 +29,7 @@ Module.register("compliments",{
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
updateInterval: 30000,
|
updateInterval: 30000,
|
||||||
remoteFile: null,
|
remoteFile: null,
|
||||||
fadeSpeed: 4000
|
fadeSpeed: 4000
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -47,11 +47,11 @@ Module.register("compliments",{
|
|||||||
|
|
||||||
this.lastComplimentIndex = -1;
|
this.lastComplimentIndex = -1;
|
||||||
|
|
||||||
if (this.config.remoteFile != null) {
|
if (this.config.remoteFile != null) {
|
||||||
this.complimentFile((response) => {
|
this.complimentFile((response) => {
|
||||||
this.config.compliments = JSON.parse(response);
|
this.config.compliments = JSON.parse(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule update timer.
|
// Schedule update timer.
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -114,17 +114,17 @@ Module.register("compliments",{
|
|||||||
/* complimentFile(callback)
|
/* complimentFile(callback)
|
||||||
* Retrieve a file from the local filesystem
|
* Retrieve a file from the local filesystem
|
||||||
*/
|
*/
|
||||||
complimentFile: function(callback) {
|
complimentFile: function(callback) {
|
||||||
var xobj = new XMLHttpRequest();
|
var xobj = new XMLHttpRequest();
|
||||||
xobj.overrideMimeType("application/json");
|
xobj.overrideMimeType("application/json");
|
||||||
xobj.open('GET', this.file(this.config.remoteFile), true);
|
xobj.open("GET", this.file(this.config.remoteFile), true);
|
||||||
xobj.onreadystatechange = function () {
|
xobj.onreadystatechange = function () {
|
||||||
if (xobj.readyState == 4 && xobj.status == "200") {
|
if (xobj.readyState == 4 && xobj.status == "200") {
|
||||||
callback(xobj.responseText);
|
callback(xobj.responseText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xobj.send(null);
|
xobj.send(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* complimentArray()
|
/* complimentArray()
|
||||||
* Retrieve a random compliment.
|
* Retrieve a random compliment.
|
||||||
|
@ -165,7 +165,7 @@ Module.register("currentweather",{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
wrapper.innerHTML = this.translate('LOADING');
|
wrapper.innerHTML = this.translate("LOADING");
|
||||||
wrapper.className = "dimmed light small";
|
wrapper.className = "dimmed light small";
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@ -322,20 +322,20 @@ Module.register("currentweather",{
|
|||||||
// So we need to generate the timestring manually.
|
// So we need to generate the timestring manually.
|
||||||
// See issue: https://github.com/MichMich/MagicMirror/issues/181
|
// See issue: https://github.com/MichMich/MagicMirror/issues/181
|
||||||
var sunriseSunsetDateObject = (sunrise < now && sunset > now) ? sunset : sunrise;
|
var sunriseSunsetDateObject = (sunrise < now && sunset > now) ? sunset : sunrise;
|
||||||
var timeString = moment(sunriseSunsetDateObject).format('HH:mm');
|
var timeString = moment(sunriseSunsetDateObject).format("HH:mm");
|
||||||
if (this.config.timeFormat !== 24) {
|
if (this.config.timeFormat !== 24) {
|
||||||
//var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
|
//var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
|
||||||
if (this.config.showPeriod) {
|
if (this.config.showPeriod) {
|
||||||
if (this.config.showPeriodUpper) {
|
if (this.config.showPeriodUpper) {
|
||||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
|
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
|
||||||
timeString = moment(sunriseSunsetDateObject).format('h:mm A');
|
timeString = moment(sunriseSunsetDateObject).format("h:mm A");
|
||||||
} else {
|
} else {
|
||||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
|
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
|
||||||
timeString = moment(sunriseSunsetDateObject).format('h:mm a');
|
timeString = moment(sunriseSunsetDateObject).format("h:mm a");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
|
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
|
||||||
timeString = moment(sunriseSunsetDateObject).format('h:mm');
|
timeString = moment(sunriseSunsetDateObject).format("h:mm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,39 +394,39 @@ Module.register("currentweather",{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
deg2Cardinal: function(deg) {
|
deg2Cardinal: function(deg) {
|
||||||
if (deg>11.25 && deg<=33.75){
|
if (deg>11.25 && deg<=33.75){
|
||||||
return "NNE";
|
return "NNE";
|
||||||
} else if (deg > 33.75 && deg <= 56.25) {
|
} else if (deg > 33.75 && deg <= 56.25) {
|
||||||
return "NE";
|
return "NE";
|
||||||
} else if (deg > 56.25 && deg <= 78.75) {
|
} else if (deg > 56.25 && deg <= 78.75) {
|
||||||
return "ENE";
|
return "ENE";
|
||||||
} else if (deg > 78.75 && deg <= 101.25) {
|
} else if (deg > 78.75 && deg <= 101.25) {
|
||||||
return "E";
|
return "E";
|
||||||
} else if (deg > 101.25 && deg <= 123.75) {
|
} else if (deg > 101.25 && deg <= 123.75) {
|
||||||
return "ESE";
|
return "ESE";
|
||||||
} else if (deg > 123.75 && deg <= 146.25) {
|
} else if (deg > 123.75 && deg <= 146.25) {
|
||||||
return "SE";
|
return "SE";
|
||||||
} else if (deg > 146.25 && deg <= 168.75) {
|
} else if (deg > 146.25 && deg <= 168.75) {
|
||||||
return "SSE";
|
return "SSE";
|
||||||
} else if (deg > 168.75 && deg <= 191.25) {
|
} else if (deg > 168.75 && deg <= 191.25) {
|
||||||
return "S";
|
return "S";
|
||||||
} else if (deg > 191.25 && deg <= 213.75) {
|
} else if (deg > 191.25 && deg <= 213.75) {
|
||||||
return "SSW";
|
return "SSW";
|
||||||
} else if (deg > 213.75 && deg <= 236.25) {
|
} else if (deg > 213.75 && deg <= 236.25) {
|
||||||
return "SW";
|
return "SW";
|
||||||
} else if (deg > 236.25 && deg <= 258.75) {
|
} else if (deg > 236.25 && deg <= 258.75) {
|
||||||
return "WSW";
|
return "WSW";
|
||||||
} else if (deg > 258.75 && deg <= 281.25) {
|
} else if (deg > 258.75 && deg <= 281.25) {
|
||||||
return "W";
|
return "W";
|
||||||
} else if (deg > 281.25 && deg <= 303.75) {
|
} else if (deg > 281.25 && deg <= 303.75) {
|
||||||
return "WNW";
|
return "WNW";
|
||||||
} else if (deg > 303.75 && deg <= 326.25) {
|
} else if (deg > 303.75 && deg <= 326.25) {
|
||||||
return "NW";
|
return "NW";
|
||||||
} else if (deg > 326.25 && deg <= 348.75) {
|
} else if (deg > 326.25 && deg <= 348.75) {
|
||||||
return "NNW";
|
return "NNW";
|
||||||
} else {
|
} else {
|
||||||
return "N";
|
return "N";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
|||||||
parser.on("item", function(item) {
|
parser.on("item", function(item) {
|
||||||
|
|
||||||
var title = item.title;
|
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 pubdate = item.pubdate || item.published || item.updated;
|
||||||
var url = item.url || item.link || '';
|
var url = item.url || item.link || "";
|
||||||
|
|
||||||
if (title && pubdate) {
|
if (title && pubdate) {
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
|||||||
scheduleTimer();
|
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);
|
request({uri: url, encoding: null, headers: headers}).pipe(iconv.decodeStream(encoding)).pipe(parser);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -25,8 +25,8 @@ Module.register("newsfeed",{
|
|||||||
updateInterval: 10 * 1000,
|
updateInterval: 10 * 1000,
|
||||||
animationSpeed: 2.5 * 1000,
|
animationSpeed: 2.5 * 1000,
|
||||||
maxNewsItems: 0, // 0 for unlimited
|
maxNewsItems: 0, // 0 for unlimited
|
||||||
removeStartTags: '',
|
removeStartTags: "",
|
||||||
removeEndTags: '',
|
removeEndTags: "",
|
||||||
startTags: [],
|
startTags: [],
|
||||||
endTags: []
|
endTags: []
|
||||||
|
|
||||||
@ -93,33 +93,41 @@ Module.register("newsfeed",{
|
|||||||
var sourceAndTimestamp = document.createElement("div");
|
var sourceAndTimestamp = document.createElement("div");
|
||||||
sourceAndTimestamp.className = "light small dimmed";
|
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 !== "") {
|
||||||
if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '' && this.config.showPublishDate) sourceAndTimestamp.innerHTML += ', ';
|
sourceAndTimestamp.innerHTML = this.newsItems[this.activeItem].sourceTitle;
|
||||||
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 !== "" && 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);
|
wrapper.appendChild(sourceAndTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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' || 'both') {
|
if (this.config.removeStartTags == "title" || "both") {
|
||||||
|
|
||||||
for (f=0; f<this.config.startTags.length;f++) {
|
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]) {
|
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);
|
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) {
|
if (this.config.showDescription) {
|
||||||
for (f=0; f<this.config.startTags.length;f++) {
|
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]) {
|
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);
|
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++) {
|
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]) {
|
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);
|
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.showDescription) {
|
if (this.config.showDescription) {
|
||||||
for (f=0; f<this.config.endTags.length;f++) {
|
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]) {
|
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);
|
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) {
|
for (var f in this.config.feeds) {
|
||||||
var feed = this.config.feeds[f];
|
var feed = this.config.feeds[f];
|
||||||
if (feed.url === feedUrl) {
|
if (feed.url === feedUrl) {
|
||||||
return feed.title || '';
|
return feed.title || "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/* scheduleUpdateInterval()
|
/* scheduleUpdateInterval()
|
||||||
|
@ -35,8 +35,8 @@ module.exports = NodeHelper.create({
|
|||||||
createFetcher: function(feed, config) {
|
createFetcher: function(feed, config) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var url = feed.url || '';
|
var url = feed.url || "";
|
||||||
var encoding = feed.encoding || 'UTF-8';
|
var encoding = feed.encoding || "UTF-8";
|
||||||
var reloadInterval = config.reloadInterval || 5 * 60 * 1000;
|
var reloadInterval = config.reloadInterval || 5 * 60 * 1000;
|
||||||
|
|
||||||
if (!validUrl.isUri(url)) {
|
if (!validUrl.isUri(url)) {
|
||||||
|
@ -22,7 +22,7 @@ module.exports = NodeHelper.create({
|
|||||||
|
|
||||||
var stat;
|
var stat;
|
||||||
try {
|
try {
|
||||||
stat = fs.statSync(path.join(moduleFolder, '.git'));
|
stat = fs.statSync(path.join(moduleFolder, ".git"));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// Error when directory .git doesn't exist
|
// Error when directory .git doesn't exist
|
||||||
// This module is not managed with git, skip
|
// This module is not managed with git, skip
|
||||||
|
@ -59,7 +59,7 @@ Module.register("updatenotification", {
|
|||||||
|
|
||||||
var subtext = document.createElement("div");
|
var subtext = document.createElement("div");
|
||||||
subtext.innerHTML = this.translate("UPDATE_INFO")
|
subtext.innerHTML = this.translate("UPDATE_INFO")
|
||||||
.replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1)? 'commit' : 'commits'))
|
.replace("COMMIT_COUNT", this.status.behind + " " + ((this.status.behind == 1)? "commit" : "commits"))
|
||||||
.replace("BRANCH_NAME", this.status.current);
|
.replace("BRANCH_NAME", this.status.current);
|
||||||
subtext.className = "xsmall dimmed";
|
subtext.className = "xsmall dimmed";
|
||||||
wrapper.appendChild(subtext);
|
wrapper.appendChild(subtext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user