From 68b3f1a8e6c01a5c88b97e4ef346b42648815fcf Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:16:39 +0200 Subject: [PATCH 01/12] Add documentation. --- modules/calendar/README.md | 142 +++++++++++++++++++++++++++++++++++++ modules/clock/README.md | 49 +++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 modules/calendar/README.md create mode 100644 modules/clock/README.md diff --git a/modules/calendar/README.md b/modules/calendar/README.md new file mode 100644 index 00000000..6cf766bf --- /dev/null +++ b/modules/calendar/README.md @@ -0,0 +1,142 @@ +# Module: Calendar +The `calendar` module is one of the default modules of the MagicMirror. +This module displays events from a public .ical calendar. It can combine multiple calendars. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'calendar', + position: 'top_left', // This can be any of the regions. Best results in left or right regions. + config: { + // The config property is optional. + // If no config is set, an example calendar is shown. + // See 'Configuration options' for more information. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
maximumEntriesThe maximum number of events shown.
+
Possible values: 0 - 100 +
Default value: 10 +
displaySymbolDisplay a symbol in front of an entry.
+
Possible values: true or false +
Default value: true +
defaultSymbolThe default symbol.
+
Possible values: See Font Awsome website. +
Default value: calendar +
maxTitleLengthThe maximum title length.
+
Possible values: 10 - 50 +
Default value: 25 +
fetchIntervalHow often does the content needs to be fetched? (Milliseconds)
+
Possible values: 1000 - 86400000 +
Default value: 30000 (5 minutes) +
animationSpeedSpeed of the update animation. (Milliseconds)
+
Possible values:0 - 5000 +
Default value: 2000 (2 seconds) +
fadeFade the future events to black. (Gradient)
+
Possible values: true or false +
Default value: true +
fadePointWhere to start fade?
+
Possible values: 0 (top of the list) - 1 (bottom of list) +
Default value: 0.25 +
calendarsThe list of calendars.
+
Possible values: An array, see calendar configuration below. +
Default value: An example calendar. +
+ +### Calendar configuration + +The `calendar` property contains an array of the configured calendars. + +#### Default value: +````javascript +config: { + calendars: [ + { + url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics', + symbol: 'calendar', + }, + ], +} +```` + + +#### Calendar configuration options: + + + + + + + + + + + + + + + + + + +
OptionDescription
urlThe 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 Awsome website. +
\ No newline at end of file diff --git a/modules/clock/README.md b/modules/clock/README.md new file mode 100644 index 00000000..035660f4 --- /dev/null +++ b/modules/clock/README.md @@ -0,0 +1,49 @@ +# Module: Clock +The `clock` module is one of the default modules of the MagicMirror. +This module displays the current date and time. The information will be updated realtime. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'clock', + position: 'top_left', // This can be any of the regions. + config: { + // The config property is optional. + // See 'Configuration options' for more information. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + +
OptionDescription
timeFormatUse 12 of 24 hour format.
+
Possible values: +
Default value: +
displaySecondsDisplay seconds.
+
Possible values: true or false +
Default value: true +
From fdf80c4584f9bc208e2b29422f7edb3bbbd4e445 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:18:07 +0200 Subject: [PATCH 02/12] Fix missing info. --- modules/clock/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/clock/README.md b/modules/clock/README.md index 035660f4..c4179e60 100644 --- a/modules/clock/README.md +++ b/modules/clock/README.md @@ -34,8 +34,8 @@ The following properties can be configured: timeFormat Use 12 of 24 hour format.
-
Possible values: -
Default value: +
Possible values: 12 or 24 +
Default value:24 From e0072630f315002e4ded37a948e328f81632d3ef Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:18:39 +0200 Subject: [PATCH 03/12] Formatting --- modules/clock/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/clock/README.md b/modules/clock/README.md index c4179e60..ff91768a 100644 --- a/modules/clock/README.md +++ b/modules/clock/README.md @@ -34,15 +34,15 @@ The following properties can be configured: timeFormat Use 12 of 24 hour format.
-
Possible values: 12 or 24 -
Default value:24 +
Possible values: 12 or 24 +
Default value: 24 displaySeconds Display seconds.
-
Possible values: true or false -
Default value: true +
Possible values: true or false +
Default value: true From f387e28ed45db2b300168e5e887e6fdbe7d6ae1d Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:19:50 +0200 Subject: [PATCH 04/12] Formatting. --- modules/calendar/README.md | 8 ++++---- modules/clock/README.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/calendar/README.md b/modules/calendar/README.md index 6cf766bf..f12e949e 100644 --- a/modules/calendar/README.md +++ b/modules/calendar/README.md @@ -24,12 +24,12 @@ modules: [ The following properties can be configured: - +
- + @@ -117,12 +117,12 @@ config: { #### Calendar configuration options: -
OptionDescriptionDescription
+
- + diff --git a/modules/clock/README.md b/modules/clock/README.md index ff91768a..a7f45af0 100644 --- a/modules/clock/README.md +++ b/modules/clock/README.md @@ -22,12 +22,12 @@ modules: [ The following properties can be configured: -
OptionDescriptionDescription
+
- + From dde6d8e623f90dd81b7ab546063e660b8221c4c4 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:21:23 +0200 Subject: [PATCH 05/12] Link to documentation. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80bc19f9..2ad44aa3 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ Things that still have to be implemented or changed. ##Modules ### Default modules: -- **Clock** -- **Calendar** +- [**Clock**](modules/clock) +- [**Calendar**](modules/clock) - **Current Weather** - **Weather Forecast** - **News Feed** From 44c0f409a92d9d6e2719be1eaf50c5c13b715ab2 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 14:22:26 +0200 Subject: [PATCH 06/12] Fix link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ad44aa3..f82eb088 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Things that still have to be implemented or changed. ### Default modules: - [**Clock**](modules/clock) -- [**Calendar**](modules/clock) +- [**Calendar**](modules/calendar) - **Current Weather** - **Weather Forecast** - **News Feed** From 2cc05e18784f232e7e2c0d395b07e44be432bade Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 15:53:28 +0200 Subject: [PATCH 07/12] Explain titleReplace. --- modules/calendar/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/calendar/README.md b/modules/calendar/README.md index f12e949e..b425fc52 100644 --- a/modules/calendar/README.md +++ b/modules/calendar/README.md @@ -96,6 +96,16 @@ The following properties can be configured:
Default value: An example calendar. +
+ + +
OptionDescriptionDescription
titleReplaceAn object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title.
+
Example:
+ + + titleReplace: {'Birthday of ' : '', 'foo':'bar'} + +
From 33586f4bdf4641d08c652bae223a9342f747ca29 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 16:02:59 +0200 Subject: [PATCH 08/12] Compliments documentation. --- README.md | 2 +- modules/compliments/README.md | 87 +++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 modules/compliments/README.md diff --git a/README.md b/README.md index f82eb088..397349d8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Things that still have to be implemented or changed. - **Current Weather** - **Weather Forecast** - **News Feed** -- **Compliments** +- [**Compliments**](modules/compliments) - **Hello World** ### 3rd Party Modules: diff --git a/modules/compliments/README.md b/modules/compliments/README.md new file mode 100644 index 00000000..210f88ed --- /dev/null +++ b/modules/compliments/README.md @@ -0,0 +1,87 @@ +# Module: Compliments +The `compliments` module is one of the default modules of the MagicMirror. +This module displays a random compliment. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'compliments', + position: 'lower_third', // This can be any of the regions. + // Best results in one of the middle regions like: lower_third + config: { + // The config property is optional. + // If no config is set, an example calendar is shown. + // See 'Configuration options' for more information. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
updateIntervalHow often does the compliment have to change? (Milliseconds)
+
Possible values: 1000 - 86400000 +
Default value: 30000 (30 seconds) +
fadeSpeedSpeed of the update animation. (Milliseconds)
+
Possible values:0 - 5000 +
Default value: 4000 (4 seconds) +
complimentsThe list of compliments.
+
Possible values: An object with three arrays: morning, afternoon andevening. See compliment configuration below. +
Default value: See compliment configuration below. +
+ +### Compliment configuration + +The `compliments` property contains an object with three arrays: morning, afternoon andevening. Based on the time of the day, the compliments will be picked out of one of these arrays. The arrays contain one or multiple compliments. + +#### Default value: +````javascript +config: { + compliments: { + morning: [ + 'Good morning, handsome!', + 'Enjoy your day!', + 'How was your sleep?' + ], + afternoon: [ + 'Hello, beauty!', + 'You look sexy!', + 'Looking good today!' + ], + evening: [ + 'Wow, you look hot!', + 'You look nice!', + 'Hi, sexy!' + ] + } +} +```` \ No newline at end of file From 5237cf9eb18682a225eb61d3f1a9efa18346a5fe Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 16:03:12 +0200 Subject: [PATCH 09/12] Fix Typos --- modules/calendar/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/calendar/README.md b/modules/calendar/README.md index b425fc52..41d6242e 100644 --- a/modules/calendar/README.md +++ b/modules/calendar/README.md @@ -65,7 +65,7 @@ The following properties can be configured: fetchInterval How often does the content needs to be fetched? (Milliseconds)

Possible values: 1000 - 86400000 -
Default value: 30000 (5 minutes) +
Default value: 300000 (5 minutes) @@ -111,7 +111,7 @@ The following properties can be configured: ### Calendar configuration -The `calendar` property contains an array of the configured calendars. +The `calendars` property contains an array of the configured calendars. #### Default value: ````javascript From 671338425ae35a767cb36d3dac59842ee4ae0d98 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 16:43:59 +0200 Subject: [PATCH 10/12] Add module documentation. --- README.md | 8 +- modules/clock/README.md | 4 +- modules/currentweather/README.md | 145 ++++++++++++++++++++++++++++ modules/helloworld/README.md | 51 ++++++++++ modules/newsfeed/README.md | 76 +++++++++++++++ modules/weatherforecast/README.md | 153 ++++++++++++++++++++++++++++++ 6 files changed, 431 insertions(+), 6 deletions(-) create mode 100644 modules/currentweather/README.md create mode 100644 modules/helloworld/README.md create mode 100644 modules/newsfeed/README.md create mode 100644 modules/weatherforecast/README.md diff --git a/README.md b/README.md index 397349d8..e952ca02 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ Things that still have to be implemented or changed. ### Default modules: - [**Clock**](modules/clock) - [**Calendar**](modules/calendar) -- **Current Weather** -- **Weather Forecast** -- **News Feed** +- [**Current Weather**](modules/currentweather) +- [**Weather Forecast**](modules/weatherforecast) +- [**News Feed**](modules/newsfeed) - [**Compliments**](modules/compliments) -- **Hello World** +- [**Hello World**](modules/helloworld) ### 3rd Party Modules: diff --git a/modules/clock/README.md b/modules/clock/README.md index a7f45af0..c0674b28 100644 --- a/modules/clock/README.md +++ b/modules/clock/README.md @@ -33,9 +33,9 @@ The following properties can be configured: timeFormat - Use 12 of 24 hour format.
+ Use 12 or 24 hour format.

Possible values: 12 or 24 -
Default value: 24 +
Default value: uses value of config.timeFormat diff --git a/modules/currentweather/README.md b/modules/currentweather/README.md new file mode 100644 index 00000000..c3834674 --- /dev/null +++ b/modules/currentweather/README.md @@ -0,0 +1,145 @@ +# Module: Current Weather +The `currentweather` module is one of the default modules of the MagicMirror. +This module displays the current weather, including the windspeed, the sunset or sunrise time, the temperature and an icon to display the current conditions. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'currentweather', + position: 'top_right', // This can be any of the regions. + // Best results in left or right regions. + config: { + // See 'Configuration options' for more information. + location: 'Amsterdam,Netherlands', + appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
locationThe location used for weather information.
+
Example: Amsterdam,Netherlands +
Default value: New York +
appidThe OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account.
+
This value is REQUIRED +
unitsWhat units to use?
+
Possible values: default = Kelvin, metric = Celsius, imperial =Fahrenheit +
Default value: metric +
updateIntervalHow often does the content needs to be fetched? (Milliseconds)
+
Possible values: 1000 - 86400000 +
Default value: 300000 (10 minutes) +
animationSpeedSpeed of the update animation. (Milliseconds)
+
Possible values:0 - 5000 +
Default value: 2000 (2 seconds) +
timeFormatUse 12 or 24 hour format.
+
Possible values: 12 or 24 +
Default value: uses value of config.timeFormat +
langThe language of the days.
+
Possible values: en, nl, ru, etc ... +
Default value: uses value of config.language +
initialLoadDelayThe initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)
+
Possible values: 1000 - 5000 +
Default value: 0 +
retryDelayThe delay before retrying after a request failure. (Milliseconds)
+
Possible values: 1000 - 60000 +
Default value: 2500 +
apiVersionThe OpenWeatherMap API version to use.
+
Default value: 2.5 +
apiBaseThe OpenWeatherMap base URL.
+
Default value: 'http://api.openweathermap.org/data/' +
weatherEndpointThe OpenWeatherMap API endPoint.
+
Default value: 'weather' +
iconTableThe conversion table to convert the weather conditions to weather-icons.
+
Default value: iconTable: { + '01d':'wi-day-sunny', + '02d':'wi-day-cloudy', + '03d':'wi-cloudy', + '04d':'wi-cloudy-windy', + '09d':'wi-showers', + '10d':'wi-rain', + '11d':'wi-thunderstorm', + '13d':'wi-snow', + '50d':'wi-fog', + '01n':'wi-night-clear', + '02n':'wi-night-cloudy', + '03n':'wi-night-cloudy', + '04n':'wi-night-cloudy', + '09n':'wi-night-showers', + '10n':'wi-night-rain', + '11n':'wi-night-thunderstorm', + '13n':'wi-night-snow', + '50n':'wi-night-alt-cloudy-windy' + } +
\ No newline at end of file diff --git a/modules/helloworld/README.md b/modules/helloworld/README.md new file mode 100644 index 00000000..5e8be905 --- /dev/null +++ b/modules/helloworld/README.md @@ -0,0 +1,51 @@ +# Module: Hello World +The `helloworld` module is one of the default modules of the MagicMirror. It is a simple way to display a static text on the mirror. +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'helloworld', + position: 'bottom_bar', // This can be any of the regions. + config: { + // See 'Configuration options' for more information. + text: 'Hello world!', + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
textThe text to display.
+
Example: 'Hello world!' +
Default value: 'Hello world!' +
classesClasses to apply to the text.
+
Example: 'xsmall bold' +
Default value: 'normal medium' +
\ No newline at end of file diff --git a/modules/newsfeed/README.md b/modules/newsfeed/README.md new file mode 100644 index 00000000..ca28bb37 --- /dev/null +++ b/modules/newsfeed/README.md @@ -0,0 +1,76 @@ +# Module: News Feed +The `newsfeed ` module is one of the default modules of the MagicMirror. +This module displays news headlines based on an RSS feed. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'newsfeed', + position: 'bottom_bar', // This can be any of the regions. Best results in center regions. + config: { + // The config property is optional. + // If no config is set, an example calendar is shown. + // See 'Configuration options' for more information. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
feedUrlThe url of the feed used for the headlines.
+
Default value: 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml' +
showPublishDateDisplay the publish date of an headline.
+
Default value: true +
Default value: true or false +
reloadIntervalHow often does the content needs to be fetched? (Milliseconds)
+
Possible values: 1000 - 86400000 +
Default value: 300000 (5 minutes) +
updateIntervalHow often do you want to display a new headline? (Milliseconds)
+
Possible values:1000 - 60000 +
Default value: 7500 (7.5 seconds) +
animationSpeedSpeed of the update animation. (Milliseconds)
+
Possible values:0 - 5000 +
Default value: 2000 (2.5 seconds) +
+ diff --git a/modules/weatherforecast/README.md b/modules/weatherforecast/README.md new file mode 100644 index 00000000..07deca8d --- /dev/null +++ b/modules/weatherforecast/README.md @@ -0,0 +1,153 @@ +# Module: Weather Forecast +The `weatherforecast` module is one of the default modules of the MagicMirror. +This module displays the weather forecast for the coming week, including an an icon to display the current conditions, the minimum temperature and the maximum temperature. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'weatherforecast', + position: 'top_right', // This can be any of the regions. + // Best results in left or right regions. + config: { + // See 'Configuration options' for more information. + location: 'Amsterdam,Netherlands', + appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OptionDescription
locationThe location used for weather information.
+
Example: Amsterdam,Netherlands +
Default value: New York +
appidThe OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account.
+
This value is REQUIRED +
unitsWhat units to use?
+
Possible values: default = Kelvin, metric = Celsius, imperial =Fahrenheit +
Default value: metric +
updateIntervalHow often does the content needs to be fetched? (Milliseconds)
+
Possible values: 1000 - 86400000 +
Default value: 300000 (10 minutes) +
animationSpeedSpeed of the update animation. (Milliseconds)
+
Possible values:0 - 5000 +
Default value: 2000 (2 seconds) +
langThe language of the days.
+
Possible values: en, nl, ru, etc ... +
Default value: uses value of config.language +
fadeFade the future events to black. (Gradient)
+
Possible values: true or false +
Default value: true +
fadePointWhere to start fade?
+
Possible values: 0 (top of the list) - 1 (bottom of list) +
Default value: 0.25 +
initialLoadDelayThe initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)
+
Possible values: 1000 - 5000 +
Default value: 0 +
retryDelayThe delay before retrying after a request failure. (Milliseconds)
+
Possible values: 1000 - 60000 +
Default value: 2500 +
apiVersionThe OpenWeatherMap API version to use.
+
Default value: 2.5 +
apiBaseThe OpenWeatherMap base URL.
+
Default value: 'http://api.openweathermap.org/data/' +
weatherEndpointThe OpenWeatherMap API endPoint.
+
Default value: 'forecast/daily' +
iconTableThe conversion table to convert the weather conditions to weather-icons.
+
Default value: iconTable: { + '01d':'wi-day-sunny', + '02d':'wi-day-cloudy', + '03d':'wi-cloudy', + '04d':'wi-cloudy-windy', + '09d':'wi-showers', + '10d':'wi-rain', + '11d':'wi-thunderstorm', + '13d':'wi-snow', + '50d':'wi-fog', + '01n':'wi-night-clear', + '02n':'wi-night-cloudy', + '03n':'wi-night-cloudy', + '04n':'wi-night-cloudy', + '09n':'wi-night-showers', + '10n':'wi-night-rain', + '11n':'wi-night-thunderstorm', + '13n':'wi-night-snow', + '50n':'wi-night-alt-cloudy-windy' + } +
\ No newline at end of file From e4c54cc6550bce7a7fddc0753322673dfb42b26f Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 17:35:29 +0200 Subject: [PATCH 11/12] Add module subfolder support. --- .gitignore | 10 ++------- README.md | 14 ++++++------ index.html | 1 + js/electron.js | 16 +++++++++++--- js/loader.js | 14 +++++++++--- modules/{ => default}/calendar/README.md | 0 modules/{ => default}/calendar/calendar.css | 0 modules/{ => default}/calendar/calendar.js | 0 modules/{ => default}/calendar/node_helper.js | 0 modules/{ => default}/clock/README.md | 0 modules/{ => default}/clock/clock.js | 0 modules/{ => default}/compliments/README.md | 0 .../{ => default}/compliments/compliments.js | 0 .../{ => default}/currentweather/README.md | 0 .../currentweather/currentweather.css | 0 .../currentweather/currentweather.js | 0 modules/default/defaultmodules.js | 22 +++++++++++++++++++ modules/{ => default}/helloworld/README.md | 0 .../{ => default}/helloworld/helloworld.js | 0 modules/{ => default}/newsfeed/README.md | 0 modules/{ => default}/newsfeed/fetcher.js | 0 modules/{ => default}/newsfeed/newsfeed.js | 0 modules/{ => default}/newsfeed/newsfetcher.js | 0 modules/{ => default}/newsfeed/node_helper.js | 0 .../{ => default}/weatherforecast/README.md | 0 .../weatherforecast/weatherforecast.css | 0 .../weatherforecast/weatherforecast.js | 0 27 files changed, 56 insertions(+), 21 deletions(-) rename modules/{ => default}/calendar/README.md (100%) rename modules/{ => default}/calendar/calendar.css (100%) rename modules/{ => default}/calendar/calendar.js (100%) rename modules/{ => default}/calendar/node_helper.js (100%) rename modules/{ => default}/clock/README.md (100%) rename modules/{ => default}/clock/clock.js (100%) rename modules/{ => default}/compliments/README.md (100%) rename modules/{ => default}/compliments/compliments.js (100%) rename modules/{ => default}/currentweather/README.md (100%) rename modules/{ => default}/currentweather/currentweather.css (100%) rename modules/{ => default}/currentweather/currentweather.js (100%) create mode 100644 modules/default/defaultmodules.js rename modules/{ => default}/helloworld/README.md (100%) rename modules/{ => default}/helloworld/helloworld.js (100%) rename modules/{ => default}/newsfeed/README.md (100%) rename modules/{ => default}/newsfeed/fetcher.js (100%) rename modules/{ => default}/newsfeed/newsfeed.js (100%) rename modules/{ => default}/newsfeed/newsfetcher.js (100%) rename modules/{ => default}/newsfeed/node_helper.js (100%) rename modules/{ => default}/weatherforecast/README.md (100%) rename modules/{ => default}/weatherforecast/weatherforecast.css (100%) rename modules/{ => default}/weatherforecast/weatherforecast.js (100%) diff --git a/.gitignore b/.gitignore index fbe259c4..708870ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,5 @@ !/modules/node_helper !/modules/node_helper/** -/modules/* -!/modules/calendar -!/modules/clock -!/modules/compliments -!/modules/currentweather -!/modules/helloworld -!/modules/newsfeed -!/modules/weatherforecast +/modules/** +!/modules/default/** diff --git a/README.md b/README.md index e952ca02..3df3738a 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ Things that still have to be implemented or changed. ##Modules ### Default modules: -- [**Clock**](modules/clock) -- [**Calendar**](modules/calendar) -- [**Current Weather**](modules/currentweather) -- [**Weather Forecast**](modules/weatherforecast) -- [**News Feed**](modules/newsfeed) -- [**Compliments**](modules/compliments) -- [**Hello World**](modules/helloworld) +- [**Clock**](modules/default/clock) +- [**Calendar**](modules/default/calendar) +- [**Current Weather**](modules/default/currentweather) +- [**Weather Forecast**](modules/default/weatherforecast) +- [**News Feed**](modules/default/newsfeed) +- [**Compliments**](modules/default/compliments) +- [**Hello World**](modules/default/helloworld) ### 3rd Party Modules: diff --git a/index.html b/index.html index 70b73040..18eb65e9 100644 --- a/index.html +++ b/index.html @@ -31,6 +31,7 @@ + diff --git a/js/electron.js b/js/electron.js index fc05c10e..74192f6c 100755 --- a/js/electron.js +++ b/js/electron.js @@ -6,7 +6,7 @@ const fs = require('fs'); const Server = require(__dirname + '/server.js'); const spawn = require('child_process').spawn; const electron = require('electron'); - +const defaultModules = require(__dirname + '/../modules/default/defaultmodules.js'); // Config var config = {}; @@ -56,8 +56,18 @@ function loadConfig (callback) { } } -function loadModule(moduleName) { - var helperPath = __dirname + '/../modules/' + moduleName + '/node_helper.js'; +function loadModule(module) { + + var elements = module.split('/'); + var moduleName = elements[elements.length - 1]; + var moduleFolder = __dirname + '/../modules/' + module; + + if (defaultModules.indexOf(moduleName) !== -1) { + moduleFolder = __dirname + '/../modules/default/' + module; + } + + var helperPath = moduleFolder + '/node_helper.js'; + var loadModule = true; try { fs.accessSync(helperPath, fs.R_OK); diff --git a/js/loader.js b/js/loader.js index a35c013c..0c6f661c 100644 --- a/js/loader.js +++ b/js/loader.js @@ -79,12 +79,20 @@ var Loader = (function() { var moduleData = modules[m]; var module = moduleData.module; + var elements = module.split('/'); + var moduleName = elements[elements.length - 1]; + var moduleFolder = config.paths.modules + '/' + module; + + if (defaultModules.indexOf(moduleName) !== -1) { + moduleFolder = config.paths.modules + '/default/' + module; + } + moduleFiles.push({ index: m, identifier: 'module_' + m + '_' + module, - name: module, - path: config.paths.modules + '/' + module, - file: module + '.js', + name: moduleName, + path: moduleFolder + '/' , + file: moduleName + '.js', position: moduleData.position, header: moduleData.header, config: moduleData.config, diff --git a/modules/calendar/README.md b/modules/default/calendar/README.md similarity index 100% rename from modules/calendar/README.md rename to modules/default/calendar/README.md diff --git a/modules/calendar/calendar.css b/modules/default/calendar/calendar.css similarity index 100% rename from modules/calendar/calendar.css rename to modules/default/calendar/calendar.css diff --git a/modules/calendar/calendar.js b/modules/default/calendar/calendar.js similarity index 100% rename from modules/calendar/calendar.js rename to modules/default/calendar/calendar.js diff --git a/modules/calendar/node_helper.js b/modules/default/calendar/node_helper.js similarity index 100% rename from modules/calendar/node_helper.js rename to modules/default/calendar/node_helper.js diff --git a/modules/clock/README.md b/modules/default/clock/README.md similarity index 100% rename from modules/clock/README.md rename to modules/default/clock/README.md diff --git a/modules/clock/clock.js b/modules/default/clock/clock.js similarity index 100% rename from modules/clock/clock.js rename to modules/default/clock/clock.js diff --git a/modules/compliments/README.md b/modules/default/compliments/README.md similarity index 100% rename from modules/compliments/README.md rename to modules/default/compliments/README.md diff --git a/modules/compliments/compliments.js b/modules/default/compliments/compliments.js similarity index 100% rename from modules/compliments/compliments.js rename to modules/default/compliments/compliments.js diff --git a/modules/currentweather/README.md b/modules/default/currentweather/README.md similarity index 100% rename from modules/currentweather/README.md rename to modules/default/currentweather/README.md diff --git a/modules/currentweather/currentweather.css b/modules/default/currentweather/currentweather.css similarity index 100% rename from modules/currentweather/currentweather.css rename to modules/default/currentweather/currentweather.css diff --git a/modules/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js similarity index 100% rename from modules/currentweather/currentweather.js rename to modules/default/currentweather/currentweather.js diff --git a/modules/default/defaultmodules.js b/modules/default/defaultmodules.js new file mode 100644 index 00000000..a6b81c88 --- /dev/null +++ b/modules/default/defaultmodules.js @@ -0,0 +1,22 @@ +/* Magic Mirror + * Default Modules List + * + * By Michael Teeuw http://michaelteeuw.nl + * MIT Licensed. + */ + +// Modules listed below can be loaded without the 'default/' prefix. Omitting the default folder name. + +var defaultModules = [ + 'calendar', + 'clock', + 'compliments', + 'currentweather', + 'helloworld', + 'newsfeed', + 'weatherforecast' +]; + + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== 'undefined') {module.exports = defaultModules;} \ No newline at end of file diff --git a/modules/helloworld/README.md b/modules/default/helloworld/README.md similarity index 100% rename from modules/helloworld/README.md rename to modules/default/helloworld/README.md diff --git a/modules/helloworld/helloworld.js b/modules/default/helloworld/helloworld.js similarity index 100% rename from modules/helloworld/helloworld.js rename to modules/default/helloworld/helloworld.js diff --git a/modules/newsfeed/README.md b/modules/default/newsfeed/README.md similarity index 100% rename from modules/newsfeed/README.md rename to modules/default/newsfeed/README.md diff --git a/modules/newsfeed/fetcher.js b/modules/default/newsfeed/fetcher.js similarity index 100% rename from modules/newsfeed/fetcher.js rename to modules/default/newsfeed/fetcher.js diff --git a/modules/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js similarity index 100% rename from modules/newsfeed/newsfeed.js rename to modules/default/newsfeed/newsfeed.js diff --git a/modules/newsfeed/newsfetcher.js b/modules/default/newsfeed/newsfetcher.js similarity index 100% rename from modules/newsfeed/newsfetcher.js rename to modules/default/newsfeed/newsfetcher.js diff --git a/modules/newsfeed/node_helper.js b/modules/default/newsfeed/node_helper.js similarity index 100% rename from modules/newsfeed/node_helper.js rename to modules/default/newsfeed/node_helper.js diff --git a/modules/weatherforecast/README.md b/modules/default/weatherforecast/README.md similarity index 100% rename from modules/weatherforecast/README.md rename to modules/default/weatherforecast/README.md diff --git a/modules/weatherforecast/weatherforecast.css b/modules/default/weatherforecast/weatherforecast.css similarity index 100% rename from modules/weatherforecast/weatherforecast.css rename to modules/default/weatherforecast/weatherforecast.css diff --git a/modules/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js similarity index 100% rename from modules/weatherforecast/weatherforecast.js rename to modules/default/weatherforecast/weatherforecast.js From e448e87252c62418fa69d0438945a41f4f646a9a Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Fri, 1 Apr 2016 17:49:43 +0200 Subject: [PATCH 12/12] Prevent weird start effect. --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index cf81ca3f..4bc15d02 100644 --- a/js/main.js +++ b/js/main.js @@ -49,7 +49,7 @@ var MM = (function() { - updateDom(module, 500); + updateDom(module, 0); } }