Merge conflict.

This commit is contained in:
Michael Teeuw
2019-06-14 13:19:29 +02:00
70 changed files with 2261 additions and 2633 deletions

View File

@@ -35,13 +35,13 @@ Module.register("alert",{
};
},
show_notification: function(message) {
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
if (this.config.effect === "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
msg = "";
if (message.title) {
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
}
if (message.message){
if (msg != ""){
if (msg !== ""){
msg+= "<br />";
}
msg += "<span class='light bright small'>" + message.message + "</span>";
@@ -132,7 +132,7 @@ Module.register("alert",{
if (typeof payload.type === "undefined") { payload.type = "alert"; }
if (payload.type === "alert") {
this.show_alert(payload, sender);
} else if (payload.type = "notification") {
} else if (payload.type === "notification") {
this.show_notification(payload);
}
} else if (notification === "HIDE_ALERT") {
@@ -152,5 +152,4 @@ Module.register("alert",{
}
Log.info("Starting module: " + this.name);
}
});

View File

@@ -105,7 +105,7 @@ Module.register("calendar", {
calendar.auth = {
user: calendar.user,
pass: calendar.pass
}
};
}
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
@@ -191,7 +191,6 @@ Module.register("calendar", {
}
}
var eventWrapper = document.createElement("tr");
if (this.config.colored && !this.config.coloredSymbolOnly) {
@@ -224,7 +223,7 @@ Module.register("calendar", {
symbolWrapper.appendChild(symbol);
}
eventWrapper.appendChild(symbolWrapper);
}else if(this.config.timeFormat === "dateheaders"){
} else if(this.config.timeFormat === "dateheaders"){
var blankCell = document.createElement("td");
blankCell.innerHTML = "&nbsp;&nbsp;&nbsp;";
eventWrapper.appendChild(blankCell);
@@ -261,7 +260,7 @@ Module.register("calendar", {
titleWrapper.colSpan = "2";
titleWrapper.align = "left";
}else{
} else {
var timeClass = this.timeClassForUrl(event.url);
var timeWrapper = document.createElement("td");
@@ -274,7 +273,7 @@ Module.register("calendar", {
}
eventWrapper.appendChild(titleWrapper);
}else{
} else {
var timeWrapper = document.createElement("td");
eventWrapper.appendChild(titleWrapper);
@@ -499,7 +498,7 @@ Module.register("calendar", {
var midnight = moment(event.startDate, "x").clone().startOf("day").add(1, "day").format("x");
var count = 1;
while (event.endDate > midnight) {
var thisEvent = JSON.parse(JSON.stringify(event)) // clone object
var thisEvent = JSON.parse(JSON.stringify(event)); // clone object
thisEvent.today = thisEvent.startDate >= today && thisEvent.startDate < (today + 24 * 60 * 60 * 1000);
thisEvent.endDate = midnight;
thisEvent.title += " (" + count + "/" + maxCount + ")";
@@ -530,7 +529,6 @@ Module.register("calendar", {
return events.slice(0, this.config.maximumEntries);
},
listContainsEvent: function(eventList, event){
for(var evt of eventList){
if(evt.title === event.title && parseInt(evt.startDate) === parseInt(event.startDate)){
@@ -538,7 +536,6 @@ Module.register("calendar", {
}
}
return false;
},
/* createEventList(url)
@@ -718,7 +715,6 @@ Module.register("calendar", {
* Capitalize the first letter of a string
* Return capitalized string
*/
capFirst: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},

View File

@@ -37,9 +37,9 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if(auth.method === "bearer"){
opts.auth = {
bearer: auth.pass
}
};
}else{
} else {
opts.auth = {
user: auth.user,
pass: auth.pass
@@ -47,7 +47,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if(auth.method === "digest"){
opts.auth.sendImmediately = false;
}else{
} else {
opts.auth.sendImmediately = true;
}
}
@@ -107,7 +107,6 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
}
}
// calculate the duration f the event for use with recurring events.
var duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x"));
@@ -176,7 +175,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
var geo = event.geo || false;
var description = event.description || false;
if (typeof event.rrule != "undefined" && event.rrule != null && !isFacebookBirthday) {
if (typeof event.rrule !== undefined && event.rrule !== null && !isFacebookBirthday) {
var rule = event.rrule;
// can cause problems with e.g. birthdays before 1900
@@ -341,7 +340,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
} else {
return title.includes(filter);
}
}
};
/* public methods */
@@ -395,8 +394,6 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
this.events = function() {
return events;
};
};
module.exports = CalendarFetcher;

View File

@@ -214,7 +214,7 @@ vows.describe('node-ical').addBatch({
, 'event with rrule' :{
topic: function(events){
return _.select(_.values(events), function(x){
return x.summary == "foobarTV broadcast starts"
return x.summary === "foobarTV broadcast starts"
})[0];
}
, "Has an RRULE": function(topic){
@@ -272,7 +272,7 @@ vows.describe('node-ical').addBatch({
},
'grabbing custom properties': {
topic: function(topic) {
}
}
},

View File

@@ -79,12 +79,12 @@ Module.register("clock",{
var timeWrapper = document.createElement("div");
var secondsWrapper = document.createElement("sup");
var periodWrapper = document.createElement("span");
var weekWrapper = document.createElement("div")
var weekWrapper = document.createElement("div");
// Style Wrappers
dateWrapper.className = "date normal medium";
timeWrapper.className = "time bright large light";
secondsWrapper.className = "dimmed";
weekWrapper.className = "week dimmed medium"
weekWrapper.className = "week dimmed medium";
// Set content of wrappers.
// The moment().format("h") method has a bug on the Raspberry Pi.
@@ -150,7 +150,7 @@ Module.register("clock",{
clockCircle.style.width = 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.backgroundSize = "100%";
@@ -158,7 +158,7 @@ Module.register("clock",{
// clockCircle.style.border = "1px solid black";
clockCircle.style.border = "rgba(0, 0, 0, 0.1)"; //Updated fix for Issue 611 where non-black backgrounds are used
} else if (this.config.analogFace != "none") {
} else if (this.config.analogFace !== "none") {
clockCircle.style.border = "2px solid white";
}
var clockFace = document.createElement("div");

View File

@@ -54,7 +54,7 @@ Module.register("compliments", {
this.lastComplimentIndex = -1;
var self = this;
if (this.config.remoteFile != null) {
if (this.config.remoteFile !== null) {
this.complimentFile(function(response) {
self.config.compliments = JSON.parse(response);
self.updateDom();
@@ -134,7 +134,7 @@ Module.register("compliments", {
xobj.overrideMimeType("application/json");
xobj.open("GET", path, true);
xobj.onreadystatechange = function() {
if (xobj.readyState == 4 && xobj.status == "200") {
if (xobj.readyState === 4 && xobj.status === 200) {
callback(xobj.responseText);
}
};
@@ -165,7 +165,6 @@ Module.register("compliments", {
return wrapper;
},
// From data currentweather set weather type
setCurrentWeatherType: function(data) {
var weatherIconTable = {
@@ -191,10 +190,9 @@ Module.register("compliments", {
this.currentWeatherType = weatherIconTable[data.weather[0].icon];
},
// Override notification handler.
notificationReceived: function(notification, payload, sender) {
if (notification == "CURRENTWEATHER_DATA") {
if (notification === "CURRENTWEATHER_DATA") {
this.setCurrentWeatherType(payload.data);
}
},

View File

@@ -353,7 +353,7 @@ Module.register("currentweather",{
} else if(this.config.location) {
params += "q=" + this.config.location;
} else if (this.firstEvent && this.firstEvent.geo) {
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon;
} else if (this.firstEvent && this.firstEvent.location) {
params += "q=" + this.firstEvent.location;
} else {

View File

@@ -15,10 +15,10 @@ Module.register("helloworld",{
},
getTemplate: function () {
return "helloworld.njk"
return "helloworld.njk";
},
getTemplateData: function () {
return this.config
return this.config;
}
});

View File

@@ -81,11 +81,10 @@ var Fetcher = function(url, reloadInterval, encoding, logFeedWarnings) {
scheduleTimer();
});
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
"Pragma": "no-cache"}
"Pragma": "no-cache"};
request({uri: url, encoding: null, headers: headers})
.on("error", function(error) {

View File

@@ -191,7 +191,7 @@ Module.register("newsfeed",{
fullArticle.style.top = "0";
fullArticle.style.left = "0";
fullArticle.style.border = "none";
fullArticle.src = this.getActiveItemURL()
fullArticle.src = this.getActiveItemURL();
fullArticle.style.zIndex = 1;
wrapper.appendChild(fullArticle);
}
@@ -419,7 +419,7 @@ Module.register("newsfeed",{
date: this.newsItems[this.activeItem].pubdate,
desc: this.newsItems[this.activeItem].description,
url: this.getActiveItemURL()
})
});
} else {
Log.info(this.name + " - unknown notification, ignoring: " + notification);
}

View File

@@ -79,7 +79,7 @@ module.exports = NodeHelper.create({
scheduleNextFetch: function(delay) {
if (delay < 60 * 1000) {
delay = 60 * 1000
delay = 60 * 1000;
}
var self = this;

View File

@@ -8,7 +8,6 @@ Module.register("updatenotification", {
start: function () {
Log.log("Start updatenotification");
},
notificationReceived: function (notification, payload, sender) {
@@ -58,14 +57,14 @@ Module.register("updatenotification", {
icon.innerHTML = "&nbsp;";
message.appendChild(icon);
var updateInfoKeyName = this.status.behind == 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
var updateInfoKeyName = this.status.behind === 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
var subtextHtml = this.translate(updateInfoKeyName, {
COMMIT_COUNT: this.status.behind,
BRANCH_NAME: this.status.current
});
var text = document.createElement("span");
if (this.status.module == "default") {
if (this.status.module === "default") {
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
subtextHtml = this.diffLink(subtextHtml);
} else {

View File

@@ -24,7 +24,7 @@
{% endif %}
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
<span>
{% if current.nextSunAction() == "sunset" %}
{% if current.nextSunAction() === "sunset" %}
{{ current.sunset | formatTime }}
{% else %}
{{ current.sunrise | formatTime }}

View File

@@ -86,9 +86,9 @@ WeatherProvider.register("openweathermap", {
*/
generateWeatherObjectsFromForecast(forecasts) {
if (this.config.weatherEndpoint == "/forecast") {
if (this.config.weatherEndpoint === "/forecast") {
return this.fetchForecastHourly(forecasts);
} else if (this.config.weatherEndpoint == "/forecast/daily") {
} else if (this.config.weatherEndpoint === "/forecast/daily") {
return this.fetchForecastDaily(forecasts);
}
// if weatherEndpoint does not match forecast or forecast/daily, what should be returned?

View File

@@ -143,7 +143,7 @@ Module.register("weather",{
humidity: this.indoorHumidity,
temperature: this.indoorTemperature
}
}
};
},
// What to do when the weather provider has new information available?
@@ -217,7 +217,7 @@ Module.register("weather",{
}
}
} else if (type === "humidity") {
value += "%"
value += "%";
}
return value;

View File

@@ -9,7 +9,6 @@
* This class is the blueprint for a weather provider.
*/
/**
* Base BluePrint for the WeatherProvider
*/
@@ -23,15 +22,14 @@ var WeatherProvider = Class.extend({
weatherForecastArray: null,
fetchedLocationName: null,
// The following properties will be set automaticly.
// The following properties will be set automatically.
// You do not need to overwrite these properties.
config: null,
delegate: null,
providerIdentifier: null,
// Weather Provider Methods
// All the following methods can be overwrited, although most are good as they are.
// All the following methods can be overwritten, although most are good as they are.
// Called when a weather provider is initialized.
init: function(config) {
@@ -51,13 +49,13 @@ var WeatherProvider = Class.extend({
},
// This method should start the API request to fetch the current weather.
// This method should definetly be overwritten in the provider.
// This method should definitely be overwritten in the provider.
fetchCurrentWeather: function() {
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchCurrentWeather method.`);
},
// This method should start the API request to fetch the weather forecast.
// This method should definetly be overwritten in the provider.
// This method should definitely be overwritten in the provider.
fetchWeatherForecast: function() {
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchWeatherForecast method.`);
},
@@ -103,7 +101,7 @@ var WeatherProvider = Class.extend({
this.delegate.updateAvailable(this);
},
// A convinience function to make requests. It returns a promise.
// A convenience function to make requests. It returns a promise.
fetchData: function(url, method = "GET", data = null) {
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();
@@ -113,12 +111,12 @@ var WeatherProvider = Class.extend({
if (this.status === 200) {
resolve(JSON.parse(this.response));
} else {
reject(request)
reject(request);
}
}
};
request.send();
})
});
}
});

View File

@@ -19,9 +19,9 @@
}
.weatherforecast tr.colored .min-temp {
color: #BCDDFF;
color: #BCDDFF;
}
.weatherforecast tr.colored .max-temp {
color: #FF8E99;
color: #FF8E99;
}

View File

@@ -82,7 +82,7 @@ Module.register("weatherforecast",{
getTranslations: function() {
// The translations for the default modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionary.
// If you're trying to build yiur own module including translations, check out the documentation.
// If you're trying to build your own module including translations, check out the documentation.
return false;
},
@@ -240,7 +240,7 @@ Module.register("weatherforecast",{
/* updateWeather(compliments)
* Requests new data from openweather.org.
* Calls processWeather on succesfull response.
* Calls processWeather on successful response.
*/
updateWeather: function() {
if (this.config.appid === "") {
@@ -261,7 +261,7 @@ Module.register("weatherforecast",{
} else if (this.status === 401) {
self.updateDom(self.config.animationSpeed);
if (self.config.forecastEndpoint == "forecast/daily") {
if (self.config.forecastEndpoint === "forecast/daily") {
self.config.forecastEndpoint = "forecast";
Log.warn(self.name + ": Your AppID does not support long term forecasts. Switching to fallback endpoint.");
}
@@ -291,7 +291,7 @@ Module.register("weatherforecast",{
} else if(this.config.location) {
params += "q=" + this.config.location;
} else if (this.firstEvent && this.firstEvent.geo) {
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon;
} else if (this.firstEvent && this.firstEvent.location) {
params += "q=" + this.firstEvent.location;
} else {
@@ -315,7 +315,7 @@ Module.register("weatherforecast",{
*/
parserDataWeather: function(data) {
if (data.hasOwnProperty("main")) {
data["temp"] = {"min": data.main.temp_min, "max": data.main.temp_max}
data["temp"] = {"min": data.main.temp_min, "max": data.main.temp_max};
}
return data;
},
@@ -330,7 +330,7 @@ Module.register("weatherforecast",{
this.forecast = [];
var lastDay = null;
var forecastData = {}
var forecastData = {};
for (var i = 0, count = data.list.length; i < count; i++) {