Fix lots of warnings

This commit is contained in:
rejas 2020-04-21 07:36:18 +02:00
parent 941d5d7cd9
commit d08bd4e866
13 changed files with 26 additions and 32 deletions

View File

@ -12,5 +12,9 @@
"ecmaFeatures": {
"globalReturn": true
}
}
},
"rules": {
"no-undef": "off",
"no-unused-vars": "off"
}
}

View File

@ -22,8 +22,8 @@
initializing = false;
// Make a copy of all prototype properties, to prevent reference issues.
for (var name in prototype) {
prototype[name] = cloneObject(prototype[name]);
for (var p in prototype) {
prototype[p] = cloneObject(prototype[p]);
}
// Copy the properties over onto the new prototype

View File

@ -1,7 +1,7 @@
/* exported defaults */
/* Magic Mirror
* Config Defauls
* Config Defaults
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.

View File

@ -1,4 +1,3 @@
/* global console */
/* exported Log */
/* Magic Mirror

View File

@ -1,4 +1,3 @@
/* global Log, Class, Loader, Class , MM */
/* exported Module */
/* Magic Mirror

View File

@ -1,4 +1,5 @@
/* exported Translator */
/* Magic Mirror
* Translator (l10n)
*
@ -129,10 +130,10 @@ var Translator = (function() {
if(Object.prototype.toString.call(template) !== "[object String]") {
return template;
}
if(variables.fallback && !template.match(new RegExp("\{.+\}"))) {
if(variables.fallback && !template.match(new RegExp("{.+}"))) {
template = variables.fallback;
}
return template.replace(new RegExp("\{([^\}]+)\}", "g"), function(_unused, varName){
return template.replace(new RegExp("{([^}]+)}", "g"), function(_unused, varName){
return variables[varName] || "{"+varName+"}";
});
}

View File

@ -1,4 +1,5 @@
/* exported Utils */
/* Magic Mirror
* Utils
*

View File

@ -254,6 +254,8 @@ Module.register("calendar", {
titleWrapper.className = "title " + titleClass;
}
var timeWrapper;
if(this.config.timeFormat === "dateheaders"){
if (event.fullDayEvent) {
@ -261,10 +263,8 @@ Module.register("calendar", {
titleWrapper.align = "left";
} else {
var timeClass = this.timeClassForUrl(event.url);
var timeWrapper = document.createElement("td");
timeWrapper.className = "time light " + timeClass;
timeWrapper = document.createElement("td");
timeWrapper.className = "time light " + this.timeClassForUrl(event.url);
timeWrapper.align = "left";
timeWrapper.style.paddingLeft = "2px";
timeWrapper.innerHTML = moment(event.startDate, "x").format("LT");
@ -274,7 +274,7 @@ Module.register("calendar", {
eventWrapper.appendChild(titleWrapper);
} else {
var timeWrapper = document.createElement("td");
timeWrapper = document.createElement("td");
eventWrapper.appendChild(titleWrapper);
//console.log(event.today);
@ -370,8 +370,7 @@ Module.register("calendar", {
}
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
//console.log(event);
var timeClass = this.timeClassForUrl(event.url);
timeWrapper.className = "time light " + timeClass;
timeWrapper.className = "time light " + this.timeClassForUrl(event.url);
eventWrapper.appendChild(timeWrapper);
}
@ -424,15 +423,12 @@ Module.register("calendar", {
switch (timeFormat) {
case 12: {
return { longDateFormat: {LT: "h:mm A"} };
break;
}
case 24: {
return { longDateFormat: {LT: "HH:mm"} };
break;
}
default: {
return { longDateFormat: {LT: moment.localeData().longDateFormat("LT")} };
break;
}
}
},
@ -735,7 +731,7 @@ Module.register("calendar", {
var regParts = needle.match(/^\/(.+)\/([gim]*)$/);
if (regParts) {
// the parsed pattern is a regexp.
needle = new RegExp(regParts[1], regParts[2]);
needle = new RegExp(regParts[1], regParts[2]);
}
title = title.replace(needle, replacement);

View File

@ -202,7 +202,6 @@ Module.register("clock",{
// If it isn't 'digital', then an 'analog' clock was also requested
// Calculate the degree offset for each hand of the clock
var now = moment();
if (this.config.timezone) {
now.tz(this.config.timezone);
}

View File

@ -23,7 +23,6 @@ Module.register("currentweather",{
showWindDirection: true,
showWindDirectionAsArrow: false,
useBeaufort: true,
appendLocationNameToHeader: false,
useKMPHwind: false,
lang: config.language,
decimalSymbol: ".",
@ -150,15 +149,15 @@ Module.register("currentweather",{
var humidity = document.createElement("span");
humidity.innerHTML = this.humidity;
var spacer = document.createElement("sup");
spacer.innerHTML = " ";
var supspacer = document.createElement("sup");
supspacer.innerHTML = " ";
var humidityIcon = document.createElement("sup");
humidityIcon.className = "wi wi-humidity humidityIcon";
humidityIcon.innerHTML = " ";
small.appendChild(humidity);
small.appendChild(spacer);
small.appendChild(supspacer);
small.appendChild(humidityIcon);
}
@ -414,8 +413,7 @@ Module.register("currentweather",{
case "imperial": tempInF = this.temperature;
break;
case "default":
var tc = this.temperature - 273.15;
tempInF = 1.8 * tc + 32;
tempInF = 1.8 * (this.temperature - 273.15) + 32;
break;
}
@ -431,8 +429,7 @@ Module.register("currentweather",{
case "imperial": this.feelsLike = windChillInF.toFixed(0);
break;
case "default":
var tc = windChillInC + 273.15;
this.feelsLike = tc.toFixed(0);
this.feelsLike = (windChillInC + 273.15).toFixed(0);
break;
}

View File

@ -367,8 +367,8 @@ Module.register("newsfeed",{
},
notificationReceived: function(notification, payload, sender) {
var before = this.activeItem;
if(notification === "ARTICLE_NEXT"){
var before = this.activeItem;
this.activeItem++;
if (this.activeItem >= this.newsItems.length) {
this.activeItem = 0;
@ -377,7 +377,6 @@ Module.register("newsfeed",{
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
this.updateDom(100);
} else if(notification === "ARTICLE_PREVIOUS"){
var before = this.activeItem;
this.activeItem--;
if (this.activeItem < 0) {
this.activeItem = this.newsItems.length - 1;

View File

@ -10,7 +10,6 @@
Module.register("weather",{
// Default module config.
defaults: {
updateInterval: 10 * 60 * 1000,
weatherProvider: "openweathermap",
roundTemp: false,
type: "current", //current, forecast

View File

@ -348,7 +348,7 @@ Module.register("weatherforecast",{
}
if (day !== lastDay) {
var forecastData = {
forecastData = {
day: day,
icon: this.config.iconTable[forecast.weather[0].icon],
maxTemp: this.roundValue(forecast.temp.max),