From 09ba1e2470b1be709d185ef4e45898460c8d1fc0 Mon Sep 17 00:00:00 2001 From: Jeremias Arnstadt Date: Sat, 28 Jan 2017 18:01:37 +0100 Subject: [PATCH 1/6] added possibility to color max and min temprature --- modules/default/weatherforecast/weatherforecast.css | 8 ++++++++ modules/default/weatherforecast/weatherforecast.js | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/modules/default/weatherforecast/weatherforecast.css b/modules/default/weatherforecast/weatherforecast.css index 62c9767f..85d65685 100644 --- a/modules/default/weatherforecast/weatherforecast.css +++ b/modules/default/weatherforecast/weatherforecast.css @@ -17,3 +17,11 @@ padding-left: 20px; padding-right: 0; } + +.weatherforecast tr.colored .min-temp { + color: #BCDDFF; +} + +.weatherforecast tr.colored .max-temp { + color: #FF8E99; +} diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 9bd15ba8..32daec30 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -23,6 +23,7 @@ Module.register("weatherforecast",{ lang: config.language, fade: true, fadePoint: 0.25, // Start on 1/4th of the list. + colored: false, initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy. retryDelay: 2500, @@ -120,6 +121,9 @@ Module.register("weatherforecast",{ var forecast = this.forecast[f]; var row = document.createElement("tr"); + if (this.config.colored) { + row.className = "colored"; + } table.appendChild(row); var dayCell = document.createElement("td"); From ce3ee909bf45d6e044cd7671191b62ecfc756ff5 Mon Sep 17 00:00:00 2001 From: Jeremias Arnstadt Date: Sat, 28 Jan 2017 18:21:02 +0100 Subject: [PATCH 2/6] added possibility to give each calendar another color --- modules/default/calendar/calendar.js | 32 +++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index b636b30b..d74d1f96 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -27,6 +27,7 @@ Module.register("calendar", { getRelative: 6, fadePoint: 0.25, // Start on 1/4th of the list. hidePrivate: false, + colored: false, calendars: [ { symbol: "calendar", @@ -114,6 +115,11 @@ Module.register("calendar", { var event = events[e]; var eventWrapper = document.createElement("tr"); + + if (this.config.colored) { + eventWrapper.style.cssText = 'color:' + this.colorForUrl(event.url); + } + eventWrapper.className = "normal"; if (this.config.displaySymbol) { @@ -142,7 +148,13 @@ Module.register("calendar", { } titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle; - titleWrapper.className = "title bright"; + + if (!this.config.colored) { + titleWrapper.className = "title bright"; + } else { + titleWrapper.className = "title"; + } + eventWrapper.appendChild(titleWrapper); var timeWrapper = document.createElement("td"); @@ -323,6 +335,24 @@ Module.register("calendar", { return this.config.defaultSymbol; }, + + /* colorForUrl(url) + * Retrieves the color for a specific url. + * + * argument url sting - Url to look for. + * + * return string - The Color + */ + colorForUrl: function (url) { + for (var c in this.config.calendars) { + var calendar = this.config.calendars[c]; + if (calendar.url === url && typeof calendar.color === "string") { + return calendar.color; + } + } + + return '#fff'; + }, /* countTitleForUrl(url) * Retrieves the name for a specific url. * From 4214293b76ca79458a1bac8482a2a8566f5295a3 Mon Sep 17 00:00:00 2001 From: Jeremias Arnstadt Date: Sat, 28 Jan 2017 18:32:06 +0100 Subject: [PATCH 3/6] updated README of weatherforecast and calendar module for color options --- modules/default/calendar/README.md | 8 ++++++++ modules/default/weatherforecast/README.md | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index c5745152..c4c330b8 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -174,10 +174,12 @@ The following properties can be configured: ### Calendar configuration The `calendars` property contains an array of the configured calendars. +The `colored` property gives the option for an individual color for each calendar. #### Default value: ````javascript config: { + colored: false, calendars: [ { url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics', @@ -210,6 +212,12 @@ config: {
Possible values: See Font Awesome website. + + color + The font color of an event from this calendar. This property should be set if the config is set to colored: true.
+
Possible values: HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)). + + repeatingCountTitle The count title for yearly repating events in this calendar.
diff --git a/modules/default/weatherforecast/README.md b/modules/default/weatherforecast/README.md index 2842af54..6b5e3930 100644 --- a/modules/default/weatherforecast/README.md +++ b/modules/default/weatherforecast/README.md @@ -191,5 +191,11 @@ The following properties can be configured: } + + colored + If set 'colored' to true the min-temp get a blue tone and the max-temp get a red tone.
+
Default value: false + + From 5c0b04bfc8ae70da9d5e9cf0c3c9a1f493ed3c37 Mon Sep 17 00:00:00 2001 From: Jeremias Arnstadt Date: Sun, 29 Jan 2017 00:59:38 +0100 Subject: [PATCH 4/6] fixed linting issues --- modules/default/calendar/calendar.js | 26 +++++++++---------- .../weatherforecast/weatherforecast.js | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 1ca137ca..5ea57e07 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -27,7 +27,7 @@ Module.register("calendar", { getRelative: 6, fadePoint: 0.25, // Start on 1/4th of the list. hidePrivate: false, - colored: false, + colored: false, calendars: [ { symbol: "calendar", @@ -116,9 +116,9 @@ Module.register("calendar", { var eventWrapper = document.createElement("tr"); - if (this.config.colored) { - eventWrapper.style.cssText = 'color:' + this.colorForUrl(event.url); - } + if (this.config.colored) { + eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url); + } eventWrapper.className = "normal"; @@ -149,11 +149,11 @@ Module.register("calendar", { titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle; - if (!this.config.colored) { - titleWrapper.className = "title bright"; - } else { - titleWrapper.className = "title"; - } + if (!this.config.colored) { + titleWrapper.className = "title bright"; + } else { + titleWrapper.className = "title"; + } eventWrapper.appendChild(titleWrapper); @@ -285,8 +285,8 @@ Module.register("calendar", { var event = calendar[e]; if(this.config.hidePrivate) { if(event.class === "PRIVATE") { - // do not add the current event, skip it - continue; + // do not add the current event, skip it + continue; } } event.url = c; @@ -336,7 +336,7 @@ Module.register("calendar", { return this.config.defaultSymbol; }, - /* colorForUrl(url) + /* colorForUrl(url) * Retrieves the color for a specific url. * * argument url sting - Url to look for. @@ -351,7 +351,7 @@ Module.register("calendar", { } } - return '#fff'; + return "#fff"; }, /* countTitleForUrl(url) * Retrieves the name for a specific url. diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 211e5082..b269a44a 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -23,7 +23,7 @@ Module.register("weatherforecast",{ lang: config.language, fade: true, fadePoint: 0.25, // Start on 1/4th of the list. - colored: false, + colored: false, initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy. retryDelay: 2500, @@ -121,9 +121,9 @@ Module.register("weatherforecast",{ var forecast = this.forecast[f]; var row = document.createElement("tr"); - if (this.config.colored) { - row.className = "colored"; - } + if (this.config.colored) { + row.className = "colored"; + } table.appendChild(row); var dayCell = document.createElement("td"); From e249092f91d162a5beb215b894042f8c6427f9e8 Mon Sep 17 00:00:00 2001 From: Jeremias Arnstadt Date: Sun, 29 Jan 2017 11:17:00 +0100 Subject: [PATCH 5/6] used mardown in calendar README --- modules/default/calendar/README.md | 55 ++++++------------------------ 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index a40d78d1..d671c741 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -65,48 +65,13 @@ config: { #### Calendar configuration options: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionDescription
urlThe url of the calendar .ical. This property is required.
-
Possible values: Any public accessble .ical calendar. -
symbolThe symbol to show in front of an event. This property is optional.
-
Possible values: See Font Awesome website. -
colorThe font color of an event from this calendar. This property should be set if the config is set to colored: true.
-
Possible values: HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)). -
repeatingCountTitleThe count title for yearly repating events in this calendar.
-
Example:
- 'Birthday' -
userThe username for HTTP Basic authentication.
passThe password for HTTP Basic authentication.
+ +-| Option | Description + -| --------------------- | ----------- + -| `url` | The url of the calendar .ical. This property is required.

**Possible values:** Any public accessble .ical calendar. + -| `symbol` | The symbol to show in front of an event. This property is optional.

**Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website. + -| `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true.

**Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)). + -| `repeatingCountTitle` | The count title for yearly repating events in this calendar.

**Example:** `'Birthday'` + -| `user` | The username for HTTP Basic authentication. + -| `pass` | The password for HTTP Basic authentication. + From ed12deae2547962a13c8a892d7ef146536d69b2c Mon Sep 17 00:00:00 2001 From: artifactdev Date: Mon, 30 Jan 2017 13:17:44 +0100 Subject: [PATCH 6/6] Update CHANGELOG.md Added color options for calendar and weather forecast to changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 706299cd..c7fea933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Icelandic Translation. - Add use a script to prevent when is run by SSH session set DISPLAY enviroment. - Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE. +- Option to give each calendar a different color +- Option for colored min-temp and max-temp ### Fixed - Update .gitignore to not ignore default modules folder.