mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #1173 from vvzvlad/vvzvlad_local
add variable morning afternoon times
This commit is contained in:
commit
8343db44db
@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Add new settings in compliments module: setting time intervals for morning and afternoon
|
||||||
- Add system notification `MODULE_DOM_CREATED` for notifying each module when their Dom has been fully loaded.
|
- Add system notification `MODULE_DOM_CREATED` for notifying each module when their Dom has been fully loaded.
|
||||||
- Add types for module.
|
- Add types for module.
|
||||||
- Implement Danger.js to notify contributors when CHANGELOG.md is missing in PR.
|
- Implement Danger.js to notify contributors when CHANGELOG.md is missing in PR.
|
||||||
|
@ -32,6 +32,12 @@ The following properties can be configured:
|
|||||||
| `compliments` | The list of compliments. <br><br> **Possible values:** An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. See _compliment configuration_ below. <br> **Default value:** See _compliment configuration_ below.
|
| `compliments` | The list of compliments. <br><br> **Possible values:** An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. See _compliment configuration_ below. <br> **Default value:** See _compliment configuration_ below.
|
||||||
| `remoteFile` | External file from which to load the compliments <br><br> **Possible values:** Path to a JSON file containing compliments, configured as per the value of the _compliments configuration_ (see below). An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. - `compliments.json` <br> **Default value:** `null` (Do not load from file)
|
| `remoteFile` | External file from which to load the compliments <br><br> **Possible values:** Path to a JSON file containing compliments, configured as per the value of the _compliments configuration_ (see below). An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. - `compliments.json` <br> **Default value:** `null` (Do not load from file)
|
||||||
| `classes` | Override the CSS classes of the div showing the compliments <br><br> **Default value:** `thin xlarge bright`
|
| `classes` | Override the CSS classes of the div showing the compliments <br><br> **Default value:** `thin xlarge bright`
|
||||||
|
| `morningStartTime` | Time in hours (in 24 format), after which the mode of "morning" will begin <br> **Possible values:** `0` - `24` <br><br> **Default value:** `3`
|
||||||
|
| `morningEndTime` | Time in hours (in 24 format), after which the mode of "morning" will end <br> **Possible values:** `0` - `24` <br><br> **Default value:** `12`
|
||||||
|
| `afternoonStartTime` | Time in hours (in 24 format), after which the mode "afternoon" will begin <br> **Possible values:** `0` - `24` <br><br> **Default value:** `12`
|
||||||
|
| `afternoonEndTime` | Time in hours (in 24 format), after which the mode "afternoon" will end <br> **Possible values:** `0` - `24` <br><br> **Default value:** `17`
|
||||||
|
|
||||||
|
All the rest of the time that does not fall into the morningStartTime-morningEndTime and afternoonStartTime-afternoonEndTime ranges is considered "evening".
|
||||||
|
|
||||||
### Compliment configuration
|
### Compliment configuration
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@ Module.register("compliments", {
|
|||||||
},
|
},
|
||||||
updateInterval: 30000,
|
updateInterval: 30000,
|
||||||
remoteFile: null,
|
remoteFile: null,
|
||||||
fadeSpeed: 4000
|
fadeSpeed: 4000,
|
||||||
|
morningStartTime: 3,
|
||||||
|
morningEndTime: 12,
|
||||||
|
afternoonStartTime: 12,
|
||||||
|
afternoonEndTime: 17
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set currentweather from module
|
// Set currentweather from module
|
||||||
@ -99,9 +103,9 @@ Module.register("compliments", {
|
|||||||
var hour = moment().hour();
|
var hour = moment().hour();
|
||||||
var compliments;
|
var compliments;
|
||||||
|
|
||||||
if (hour >= 3 && hour < 12 && this.config.compliments.hasOwnProperty("morning")) {
|
if (hour >= this.config.morningStartTime && hour < this.config.morningEndTime && this.config.compliments.hasOwnProperty("morning")) {
|
||||||
compliments = this.config.compliments.morning.slice(0);
|
compliments = this.config.compliments.morning.slice(0);
|
||||||
} else if (hour >= 12 && hour < 17 && this.config.compliments.hasOwnProperty("afternoon")) {
|
} else if (hour >= this.config.afternoonStartTime && hour < this.config.afternoonEndTime && this.config.compliments.hasOwnProperty("afternoon")) {
|
||||||
compliments = this.config.compliments.afternoon.slice(0);
|
compliments = this.config.compliments.afternoon.slice(0);
|
||||||
} else if(this.config.compliments.hasOwnProperty("evening")) {
|
} else if(this.config.compliments.hasOwnProperty("evening")) {
|
||||||
compliments = this.config.compliments.evening.slice(0);
|
compliments = this.config.compliments.evening.slice(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user