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
- 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.
- 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.
@ -43,8 +44,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add `chai-as-promised` npm module to devDependencies
- Basic set of tests for clock module
- Run e2e test in Travis
- Estonian Translation.
- Add test for compliments module for parts of day
### Fixed
- Update .gitignore to not ignore default modules folder.
- Remove white flash on boot up.

View File

@ -6,8 +6,7 @@
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*/
Module.register("compliments",{
Module.register("compliments", {
// Module config defaults.
defaults: {
@ -97,7 +96,7 @@ Module.register("compliments",{
*/
complimentArray: function() {
var hour = moment().hour();
var compliments = null;
var compliments = null;
if (hour >= 3 && hour < 12) {
compliments = this.config.compliments.morning;
@ -107,7 +106,11 @@ Module.register("compliments",{
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]);
}
@ -124,7 +127,7 @@ Module.register("compliments",{
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open("GET", this.file(this.config.remoteFile), true);
xobj.onreadystatechange = function () {
xobj.onreadystatechange = function() {
if (xobj.readyState == 4 && xobj.status == "200") {
callback(xobj.responseText);
}
@ -190,4 +193,4 @@ Module.register("compliments",{
}
},
});
});

View File

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