From c0ab2ac297cad7b612fa87903289755bf5ca9dc9 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Wed, 13 Mar 2019 12:01:49 +0100 Subject: [PATCH 1/2] Support timer in notifications too --- CHANGELOG.md | 1 + modules/default/alert/README.md | 9 +++++---- modules/default/alert/alert.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dad485a..0cd2e5c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added option to split multiple day events in calendar to separate numbered events - Slovakian translation - Alerts now can contain Font Awesome icons +- Notifications display time can be set in request ### Updated - Bumped the Electron dependency to v3.0.13 to support the most recent Raspbian. [#1500](https://github.com/MichMich/MagicMirror/issues/1500) diff --git a/modules/default/alert/README.md b/modules/default/alert/README.md index e193e4ba..4c6e4333 100644 --- a/modules/default/alert/README.md +++ b/modules/default/alert/README.md @@ -43,10 +43,11 @@ self.sendNotification("SHOW_ALERT", {}); ``` ### Notification params -| Option | Description -| --------- | ----------- -| `title` | The title of the notification.

**Possible values:** `text` or `html` -| `message` | The message of the notification.

**Possible values:** `text` or `html` +| Option | Description +| ------------------ | ----------- +| `title` | The title of the notification.

**Possible values:** `text` or `html` +| `message` | The message of the notification.

**Possible values:** `text` or `html` +| `timer` (optional) | How long the notification should stay visible in ms.
If absent, the default `display_time` is used.
**Possible values:** `int` `float` ### Alert params diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index 9c0d91a7..0f47bc3f 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -51,7 +51,7 @@ Module.register("alert",{ message: msg, layout: "growl", effect: this.config.effect, - ttl: this.config.display_time + ttl: message.timer !== undefined ? message.timer : this.config.display_time }).show(); }, show_alert: function(params, sender) { From 3880c8dc2c4bb4a8de748d005fd73f39736cf015 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Wed, 13 Mar 2019 12:52:30 +0100 Subject: [PATCH 2/2] Restyle notification colors --- CHANGELOG.md | 1 + modules/default/alert/ns-default.css | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cd2e5c6..3af53301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fix null dereference in moduleNeedsUpdate when the module isn't visible - Calendar: Fixed event end times by setting default calendarEndTime to "LT" (Local time format). [#1479] - Calendar: Fixed missing calendar fetchers after server process restarts [#1589](https://github.com/MichMich/MagicMirror/issues/1589) +- Notification: fixed background color (was white text on white background) ### New weather module - Fixed weather forecast table display [#1499](https://github.com/MichMich/MagicMirror/issues/1499). diff --git a/modules/default/alert/ns-default.css b/modules/default/alert/ns-default.css index db3ba3a3..73b8740d 100644 --- a/modules/default/alert/ns-default.css +++ b/modules/default/alert/ns-default.css @@ -1,7 +1,7 @@ /* Based on work by http://tympanus.net/codrops/licensing/ */ .ns-box { - background: #fff; + background-color: rgba(0, 0, 0, 0.93); padding: 17px; line-height: 1.4; margin-bottom: 10px; @@ -12,7 +12,10 @@ display: table; word-wrap: break-word; max-width: 100%; + border-width: 1px; border-radius: 5px; + border-style: solid; + border-color: #666; } .ns-alert {