mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
More == -> === and != -> !== fixes
This commit is contained in:
parent
98a84c031e
commit
5c08bde0fa
@ -29,8 +29,8 @@
|
|||||||
// Copy the properties over onto the new prototype
|
// Copy the properties over onto the new prototype
|
||||||
for (var name in prop) {
|
for (var name in prop) {
|
||||||
// Check if we're overwriting an existing function
|
// Check if we're overwriting an existing function
|
||||||
prototype[name] = typeof prop[name] == "function" &&
|
prototype[name] = typeof prop[name] === "function" &&
|
||||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) {
|
typeof _super[name] === "function" && fnTest.test(prop[name]) ? (function (name, fn) {
|
||||||
return function () {
|
return function () {
|
||||||
var tmp = this._super;
|
var tmp = this._super;
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ var MM = (function() {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
// Add polyfill for Object.assign.
|
// Add polyfill for Object.assign.
|
||||||
if (typeof Object.assign != "function") {
|
if (typeof Object.assign !== "function") {
|
||||||
(function() {
|
(function() {
|
||||||
Object.assign = function(target) {
|
Object.assign = function(target) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -164,7 +164,7 @@ var Module = Class.extend({
|
|||||||
* @returns Nunjucks Environment
|
* @returns Nunjucks Environment
|
||||||
*/
|
*/
|
||||||
nunjucksEnvironment: function() {
|
nunjucksEnvironment: function() {
|
||||||
if (this._nunjucksEnvironment != null) {
|
if (this._nunjucksEnvironment !== null) {
|
||||||
return this._nunjucksEnvironment;
|
return this._nunjucksEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ Module.register("alert",{
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
show_notification: function(message) {
|
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 = "";
|
msg = "";
|
||||||
if (message.title) {
|
if (message.title) {
|
||||||
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
|
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
|
||||||
}
|
}
|
||||||
if (message.message){
|
if (message.message){
|
||||||
if (msg != ""){
|
if (msg !== ""){
|
||||||
msg+= "<br />";
|
msg+= "<br />";
|
||||||
}
|
}
|
||||||
msg += "<span class='light bright small'>" + message.message + "</span>";
|
msg += "<span class='light bright small'>" + message.message + "</span>";
|
||||||
|
@ -224,7 +224,7 @@ Module.register("calendar", {
|
|||||||
symbolWrapper.appendChild(symbol);
|
symbolWrapper.appendChild(symbol);
|
||||||
}
|
}
|
||||||
eventWrapper.appendChild(symbolWrapper);
|
eventWrapper.appendChild(symbolWrapper);
|
||||||
}else if(this.config.timeFormat === "dateheaders"){
|
} else if(this.config.timeFormat === "dateheaders"){
|
||||||
var blankCell = document.createElement("td");
|
var blankCell = document.createElement("td");
|
||||||
blankCell.innerHTML = " ";
|
blankCell.innerHTML = " ";
|
||||||
eventWrapper.appendChild(blankCell);
|
eventWrapper.appendChild(blankCell);
|
||||||
@ -261,7 +261,7 @@ Module.register("calendar", {
|
|||||||
titleWrapper.colSpan = "2";
|
titleWrapper.colSpan = "2";
|
||||||
titleWrapper.align = "left";
|
titleWrapper.align = "left";
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
var timeClass = this.timeClassForUrl(event.url);
|
var timeClass = this.timeClassForUrl(event.url);
|
||||||
var timeWrapper = document.createElement("td");
|
var timeWrapper = document.createElement("td");
|
||||||
@ -274,7 +274,7 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventWrapper.appendChild(titleWrapper);
|
eventWrapper.appendChild(titleWrapper);
|
||||||
}else{
|
} else {
|
||||||
var timeWrapper = document.createElement("td");
|
var timeWrapper = document.createElement("td");
|
||||||
|
|
||||||
eventWrapper.appendChild(titleWrapper);
|
eventWrapper.appendChild(titleWrapper);
|
||||||
@ -530,7 +530,6 @@ Module.register("calendar", {
|
|||||||
return events.slice(0, this.config.maximumEntries);
|
return events.slice(0, this.config.maximumEntries);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
listContainsEvent: function(eventList, event){
|
listContainsEvent: function(eventList, event){
|
||||||
for(var evt of eventList){
|
for(var evt of eventList){
|
||||||
if(evt.title === event.title && parseInt(evt.startDate) === parseInt(event.startDate)){
|
if(evt.title === event.title && parseInt(evt.startDate) === parseInt(event.startDate)){
|
||||||
@ -538,7 +537,6 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* createEventList(url)
|
/* createEventList(url)
|
||||||
@ -718,7 +716,6 @@ Module.register("calendar", {
|
|||||||
* Capitalize the first letter of a string
|
* Capitalize the first letter of a string
|
||||||
* Return capitalized string
|
* Return capitalized string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
capFirst: function (string) {
|
capFirst: function (string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
},
|
},
|
||||||
|
@ -39,7 +39,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
bearer: auth.pass
|
bearer: auth.pass
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
opts.auth = {
|
opts.auth = {
|
||||||
user: auth.user,
|
user: auth.user,
|
||||||
pass: auth.pass
|
pass: auth.pass
|
||||||
@ -47,7 +47,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
|
|
||||||
if(auth.method === "digest"){
|
if(auth.method === "digest"){
|
||||||
opts.auth.sendImmediately = false;
|
opts.auth.sendImmediately = false;
|
||||||
}else{
|
} else {
|
||||||
opts.auth.sendImmediately = true;
|
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.
|
// calculate the duration f the event for use with recurring events.
|
||||||
var duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x"));
|
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 geo = event.geo || false;
|
||||||
var description = event.description || 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;
|
var rule = event.rrule;
|
||||||
|
|
||||||
// can cause problems with e.g. birthdays before 1900
|
// can cause problems with e.g. birthdays before 1900
|
||||||
@ -341,7 +340,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
} else {
|
} else {
|
||||||
return title.includes(filter);
|
return title.includes(filter);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
|
|
||||||
@ -395,8 +394,6 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
this.events = function() {
|
this.events = function() {
|
||||||
return events;
|
return events;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = CalendarFetcher;
|
module.exports = CalendarFetcher;
|
||||||
|
@ -214,7 +214,7 @@ vows.describe('node-ical').addBatch({
|
|||||||
, 'event with rrule' :{
|
, 'event with rrule' :{
|
||||||
topic: function(events){
|
topic: function(events){
|
||||||
return _.select(_.values(events), function(x){
|
return _.select(_.values(events), function(x){
|
||||||
return x.summary == "foobarTV broadcast starts"
|
return x.summary === "foobarTV broadcast starts"
|
||||||
})[0];
|
})[0];
|
||||||
}
|
}
|
||||||
, "Has an RRULE": function(topic){
|
, "Has an RRULE": function(topic){
|
||||||
|
@ -136,7 +136,7 @@ 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%";
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ Module.register("clock",{
|
|||||||
// clockCircle.style.border = "1px solid black";
|
// 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
|
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";
|
clockCircle.style.border = "2px solid white";
|
||||||
}
|
}
|
||||||
var clockFace = document.createElement("div");
|
var clockFace = document.createElement("div");
|
||||||
|
@ -54,7 +54,7 @@ Module.register("compliments", {
|
|||||||
this.lastComplimentIndex = -1;
|
this.lastComplimentIndex = -1;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
if (this.config.remoteFile != null) {
|
if (this.config.remoteFile !== null) {
|
||||||
this.complimentFile(function(response) {
|
this.complimentFile(function(response) {
|
||||||
self.config.compliments = JSON.parse(response);
|
self.config.compliments = JSON.parse(response);
|
||||||
self.updateDom();
|
self.updateDom();
|
||||||
@ -134,7 +134,7 @@ Module.register("compliments", {
|
|||||||
xobj.overrideMimeType("application/json");
|
xobj.overrideMimeType("application/json");
|
||||||
xobj.open("GET", path, true);
|
xobj.open("GET", path, 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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -194,7 +194,7 @@ Module.register("compliments", {
|
|||||||
|
|
||||||
// Override notification handler.
|
// Override notification handler.
|
||||||
notificationReceived: function(notification, payload, sender) {
|
notificationReceived: function(notification, payload, sender) {
|
||||||
if (notification == "CURRENTWEATHER_DATA") {
|
if (notification === "CURRENTWEATHER_DATA") {
|
||||||
this.setCurrentWeatherType(payload.data);
|
this.setCurrentWeatherType(payload.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -8,7 +8,6 @@ Module.register("updatenotification", {
|
|||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
Log.log("Start updatenotification");
|
Log.log("Start updatenotification");
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
notificationReceived: function (notification, payload, sender) {
|
notificationReceived: function (notification, payload, sender) {
|
||||||
@ -58,14 +57,14 @@ Module.register("updatenotification", {
|
|||||||
icon.innerHTML = " ";
|
icon.innerHTML = " ";
|
||||||
message.appendChild(icon);
|
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, {
|
var subtextHtml = this.translate(updateInfoKeyName, {
|
||||||
COMMIT_COUNT: this.status.behind,
|
COMMIT_COUNT: this.status.behind,
|
||||||
BRANCH_NAME: this.status.current
|
BRANCH_NAME: this.status.current
|
||||||
});
|
});
|
||||||
|
|
||||||
var text = document.createElement("span");
|
var text = document.createElement("span");
|
||||||
if (this.status.module == "default") {
|
if (this.status.module === "default") {
|
||||||
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
|
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
|
||||||
subtextHtml = this.diffLink(subtextHtml);
|
subtextHtml = this.diffLink(subtextHtml);
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
|
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
|
||||||
<span>
|
<span>
|
||||||
{% if current.nextSunAction() == "sunset" %}
|
{% if current.nextSunAction() === "sunset" %}
|
||||||
{{ current.sunset | formatTime }}
|
{{ current.sunset | formatTime }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ current.sunrise | formatTime }}
|
{{ current.sunrise | formatTime }}
|
||||||
|
@ -86,9 +86,9 @@ WeatherProvider.register("openweathermap", {
|
|||||||
*/
|
*/
|
||||||
generateWeatherObjectsFromForecast(forecasts) {
|
generateWeatherObjectsFromForecast(forecasts) {
|
||||||
|
|
||||||
if (this.config.weatherEndpoint == "/forecast") {
|
if (this.config.weatherEndpoint === "/forecast") {
|
||||||
return this.fetchForecastHourly(forecasts);
|
return this.fetchForecastHourly(forecasts);
|
||||||
} else if (this.config.weatherEndpoint == "/forecast/daily") {
|
} else if (this.config.weatherEndpoint === "/forecast/daily") {
|
||||||
return this.fetchForecastDaily(forecasts);
|
return this.fetchForecastDaily(forecasts);
|
||||||
}
|
}
|
||||||
// if weatherEndpoint does not match forecast or forecast/daily, what should be returned?
|
// if weatherEndpoint does not match forecast or forecast/daily, what should be returned?
|
||||||
|
@ -261,7 +261,7 @@ Module.register("weatherforecast",{
|
|||||||
} else if (this.status === 401) {
|
} else if (this.status === 401) {
|
||||||
self.updateDom(self.config.animationSpeed);
|
self.updateDom(self.config.animationSpeed);
|
||||||
|
|
||||||
if (self.config.forecastEndpoint == "forecast/daily") {
|
if (self.config.forecastEndpoint === "forecast/daily") {
|
||||||
self.config.forecastEndpoint = "forecast";
|
self.config.forecastEndpoint = "forecast";
|
||||||
Log.warn(self.name + ": Your AppID does not support long term forecasts. Switching to fallback endpoint.");
|
Log.warn(self.name + ": Your AppID does not support long term forecasts. Switching to fallback endpoint.");
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ describe("All font files from roboto.css should be downloadable", function() {
|
|||||||
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
|
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
|
||||||
var regex = /\burl\(['"]([^'"]+)['"]\)/g;
|
var regex = /\burl\(['"]([^'"]+)['"]\)/g;
|
||||||
var match = regex.exec(fileContent);
|
var match = regex.exec(fileContent);
|
||||||
while (match != null) {
|
while (match !== null) {
|
||||||
// Push 1st match group onto fontFiles stack
|
// Push 1st match group onto fontFiles stack
|
||||||
fontFiles.push(match[1]);
|
fontFiles.push(match[1]);
|
||||||
// Find the next one
|
// Find the next one
|
||||||
|
Loading…
x
Reference in New Issue
Block a user