Merge pull request #696 from kpaaro/develop

Compliments module can use remoteFile without default daytime arrays defined
This commit is contained in:
Michael Teeuw 2017-02-08 19:35:09 +01:00 committed by GitHub
commit ccbc5c9d17
3 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed ### Changed
- Add `anytime` group for Compliments module. - Add `anytime` group for Compliments module.
- Compliments module can use remoteFile without default daytime arrays defined
- Installer: Use init config.js from config.js.sample. - Installer: Use init config.js from config.js.sample.
- Switched out `rrule` package for `rrule-alt` and fixes in `ical.js` in order to fix calendar issues. ([#565](https://github.com/MichMich/MagicMirror/issues/565)) - Switched out `rrule` package for `rrule-alt` and fixes in `ical.js` in order to fix calendar issues. ([#565](https://github.com/MichMich/MagicMirror/issues/565))
- Make mouse events pass through the region fullscreen_above to modules below. - Make mouse events pass through the region fullscreen_above to modules below.
@ -43,8 +44,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add `chai-as-promised` npm module to devDependencies - Add `chai-as-promised` npm module to devDependencies
- Basic set of tests for clock module - Basic set of tests for clock module
- Run e2e test in Travis - Run e2e test in Travis
- Estonian Translation.
- Add test for compliments module for parts of day - Add test for compliments module for parts of day
### Fixed ### Fixed
- Update .gitignore to not ignore default modules folder. - Update .gitignore to not ignore default modules folder.
- Remove white flash on boot up. - Remove white flash on boot up.

View File

@ -6,8 +6,7 @@
* By Michael Teeuw http://michaelteeuw.nl * By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
Module.register("compliments", {
Module.register("compliments",{
// Module config defaults. // Module config defaults.
defaults: { defaults: {
@ -97,7 +96,7 @@ Module.register("compliments",{
*/ */
complimentArray: function() { complimentArray: function() {
var hour = moment().hour(); var hour = moment().hour();
var compliments = null; var compliments = null;
if (hour >= 3 && hour < 12) { if (hour >= 3 && hour < 12) {
compliments = this.config.compliments.morning; compliments = this.config.compliments.morning;
@ -107,7 +106,11 @@ Module.register("compliments",{
compliments = this.config.compliments.evening; compliments = this.config.compliments.evening;
} }
if ( this.currentWeatherType in this.config.compliments) { if (typeof compliments === "undefined") {
compliments = new Array();
}
if (this.currentWeatherType in this.config.compliments) {
compliments.push.apply(compliments, this.config.compliments[this.currentWeatherType]); compliments.push.apply(compliments, this.config.compliments[this.currentWeatherType]);
} }
@ -124,7 +127,7 @@ Module.register("compliments",{
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);
} }

View File

@ -8,7 +8,7 @@
"EMPTY": "Pole tulevasi sündmuseid.", "EMPTY": "Pole tulevasi sündmuseid.",
"N": "Põhi", "N": "Põhi",
"NNE": "PõhiKirre", "NNE": "Põhikirre",
"NE": "Kirre", "NE": "Kirre",
"ENE": "Idakirre", "ENE": "Idakirre",
"E": "Ida", "E": "Ida",