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": { "ecmaFeatures": {
"globalReturn": true "globalReturn": true
} }
} },
"rules": {
"no-undef": "off",
"no-unused-vars": "off"
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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