Merge branch 'develop' of github.com:javiersigler/MagicMirror into task/improve_dockerfile

This commit is contained in:
Javier Sigler 2017-04-04 18:32:22 +02:00
commit bb8c0f1d9c
14 changed files with 107 additions and 31 deletions

View File

@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [2.1.2] - Unreleased
### Changed
### Added
- Add in option to wrap long calendar events to multiple lines using `wrapEvents` configuration option.
### Updated
- Added missing keys to Polish translation.
- Added missing key to German translation.
## [2.1.1] - 2017-04-01 ## [2.1.1] - 2017-04-01

View File

@ -6,12 +6,20 @@ module.exports = function(grunt) {
options: { options: {
configFile: ".eslintrc.json" configFile: ".eslintrc.json"
}, },
target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js", target: [
"serveronly/*.js", "*.js", "tests/*/*.js", "!modules/default/alert/notificationFx.js", "js/*.js",
"!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js", "modules/default/*.js",
"modules/default/*/*.js",
"serveronly/*.js",
"*.js",
"tests/**/*.js",
"!modules/default/alert/notificationFx.js",
"!modules/default/alert/modernizr.custom.js",
"!modules/default/alert/classie.js",
"config/*", "config/*",
"translations/translations.js", "vendor/vendor.js" "translations/translations.js",
"vendor/vendor.js",
"modules/node_modules/node_helper/index.js"
] ]
}, },
stylelint: { stylelint: {
@ -19,14 +27,26 @@ module.exports = function(grunt) {
options: { options: {
configFile: ".stylelintrc" configFile: ".stylelintrc"
}, },
src: ["css/main.css", "modules/default/calendar/calendar.css", "modules/default/clock/clock_styles.css", "modules/default/currentweather/currentweather.css", "modules/default/weatherforcast/weatherforcast.css"] src: [
"css/main.css",
"modules/default/calendar/calendar.css",
"modules/default/clock/clock_styles.css",
"modules/default/currentweather/currentweather.css",
"modules/default/weatherforcast/weatherforcast.css"
]
} }
}, },
jsonlint: { jsonlint: {
main: { main: {
src: ["package.json", ".eslintrc.json", ".stylelintrc", "translations/*.json", src: [
"modules/default/*/translations/*.json", "installers/pm2_MagicMirror.json", "package.json",
"vendor/package.js"], ".eslintrc.json",
".stylelintrc",
"translations/*.json",
"modules/default/*/translations/*.json",
"installers/pm2_MagicMirror.json",
"vendor/package.js"
],
options: { options: {
reporter: "jshint" reporter: "jshint"
} }
@ -58,11 +78,20 @@ module.exports = function(grunt) {
"MD038": false "MD038": false
} }
}, },
src: ["README.md", "CHANGELOG.md", "LICENSE.md", "modules/README.md", "modules/default/**/*.md", "!modules/default/calendar/vendor/ical.js/readme.md"] src: [
"README.md",
"CHANGELOG.md",
"LICENSE.md",
"modules/README.md",
"modules/default/**/*.md",
"!modules/default/calendar/vendor/ical.js/readme.md"
]
} }
}, },
yamllint: { yamllint: {
all: [".travis.yml"] all: [
".travis.yml"
]
} }
}); });
grunt.loadNpmTasks("grunt-eslint"); grunt.loadNpmTasks("grunt-eslint");

View File

@ -6,7 +6,11 @@
var config = { var config = {
port: 8080, port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses. ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
language: "en", language: "en",
timeFormat: 24, timeFormat: 24,

View File

@ -65,7 +65,7 @@ if command_exists node; then
fi fi
else else
echo -e "\e[92mNo Node.js upgrade nessecery.\e[0m" echo -e "\e[92mNo Node.js upgrade necessary.\e[0m"
fi fi
else else

View File

@ -31,6 +31,7 @@ The following properties can be configured:
| `displaySymbol` | Display a symbol in front of an entry. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true` | `displaySymbol` | Display a symbol in front of an entry. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `defaultSymbol` | The default symbol. <br><br> **Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website. <br> **Default value:** `calendar` | `defaultSymbol` | The default symbol. <br><br> **Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website. <br> **Default value:** `calendar`
| `maxTitleLength` | The maximum title length. <br><br> **Possible values:** `10` - `50` <br> **Default value:** `25` | `maxTitleLength` | The maximum title length. <br><br> **Possible values:** `10` - `50` <br> **Default value:** `25`
| `wrapEvents` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `fetchInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes) | `fetchInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2000` (2 seconds) | `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2000` (2 seconds)
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true` | `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`

View File

@ -2,6 +2,7 @@
padding-left: 0; padding-left: 0;
padding-right: 10px; padding-right: 10px;
font-size: 80%; font-size: 80%;
vertical-align: top;
} }
.calendar .symbol span { .calendar .symbol span {
@ -19,4 +20,5 @@
.calendar .time { .calendar .time {
padding-left: 30px; padding-left: 30px;
text-align: right; text-align: right;
vertical-align: top;
} }

View File

@ -18,6 +18,7 @@ Module.register("calendar", {
displayRepeatingCountTitle: false, displayRepeatingCountTitle: false,
defaultRepeatingCountTitle: "", defaultRepeatingCountTitle: "",
maxTitleLength: 25, maxTitleLength: 25,
wrapEvents: false, // wrap events to multiple lines breaking at maxTitleLength
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
animationSpeed: 2000, animationSpeed: 2000,
fade: true, fade: true,
@ -414,15 +415,38 @@ Module.register("calendar", {
* *
* argument string string - The string to shorten. * argument string string - The string to shorten.
* argument maxLength number - The max length of the string. * argument maxLength number - The max length of the string.
* argument wrapEvents - Wrap the text after the line has reached maxLength
* *
* return string - The shortened string. * return string - The shortened string.
*/ */
shorten: function (string, maxLength) { shorten: function (string, maxLength, wrapEvents) {
if (string.length > maxLength) { if (wrapEvents) {
return string.slice(0, maxLength) + "&hellip;"; var temp = "";
} var currentLine = "";
var words = string.split(" ");
return string; for (var i = 0; i < words.length; i++) {
var word = words[i];
if (currentLine.length + word.length < 25 - 1) { // max - 1 to account for a space
currentLine += (word + " ");
} else {
if (currentLine.length > 0) {
temp += (currentLine + "<br>" + word + " ");
} else {
temp += (word + "<br>");
}
currentLine = "";
}
}
return temp + currentLine;
} else {
if (string.length > maxLength) {
return string.slice(0, maxLength) + "&hellip;";
} else {
return string;
}
}
}, },
/* capFirst(string) /* capFirst(string)
@ -437,7 +461,7 @@ Module.register("calendar", {
/* titleTransform(title) /* titleTransform(title)
* Transforms the title of an event for usage. * Transforms the title of an event for usage.
* Replaces parts of the text as defined in config.titleReplace. * Replaces parts of the text as defined in config.titleReplace.
* Shortens title based on config.maxTitleLength * Shortens title based on config.maxTitleLength and config.wrapEvents
* *
* argument title string - The title to transform. * argument title string - The title to transform.
* *
@ -456,7 +480,7 @@ Module.register("calendar", {
title = title.replace(needle, replacement); title = title.replace(needle, replacement);
} }
title = this.shorten(title, this.config.maxTitleLength); title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents);
return title; return title;
}, },

View File

@ -20,7 +20,7 @@ NodeHelper = Class.extend({
}, },
start: function() { start: function() {
console.log("Staring module helper: " + this.name); console.log("Starting module helper: " + this.name);
}, },
/* socketNotificationReceived(notification, payload) /* socketNotificationReceived(notification, payload)
@ -45,7 +45,7 @@ NodeHelper = Class.extend({
/* setPath(path) /* setPath(path)
* Set the module path. * Set the module path.
* *
* argument name string - Module name. * argument path string - Module path.
*/ */
setPath: function(path) { setPath: function(path) {
this.path = path; this.path = path;
@ -98,9 +98,10 @@ NodeHelper = Class.extend({
// register catch all. // register catch all.
socket.on("*", function(notification, payload) { socket.on("*", function(notification, payload) {
if (notification !== "*") if (notification !== "*") {
//console.log('received message in namespace: ' + namespace); //console.log('received message in namespace: ' + namespace);
self.socketNotificationReceived(notification, payload); self.socketNotificationReceived(notification, payload);
}
}); });
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "magicmirror", "name": "magicmirror",
"version": "2.1.1", "version": "2.1.2-dev",
"description": "The open source modular smart mirror platform.", "description": "The open source modular smart mirror platform.",
"main": "js/electron.js", "main": "js/electron.js",
"scripts": { "scripts": {

View File

@ -24,8 +24,8 @@ var config = {
// Using exotic content. This is why dont accept go to JSON configuration file // Using exotic content. This is why dont accept go to JSON configuration file
(function() { (function() {
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
"bottom_bar", "fullscreen_above", "fullscreen_below"]; "bottom_bar", "fullscreen_above", "fullscreen_below"];
var modules = Array(); var modules = Array();
for (idx in positions) { for (idx in positions) {
modules.push({ modules.push({

View File

@ -63,8 +63,8 @@ describe("'global.root_path' set in js/app.js", function() {
}); });
it("should expect the global.version equals package.json file", function() { it("should expect the global.version equals package.json file", function() {
version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version; versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
expect(this.sandbox.global.version).to.equal(version_package); expect(this.sandbox.global.version).to.equal(versionPackage);
}); });
}); });

View File

@ -7,6 +7,8 @@
"RUNNING": "noch", "RUNNING": "noch",
"EMPTY": "Keine Termine.", "EMPTY": "Keine Termine.",
"WEEK": "Woche",
"N": "N", "N": "N",
"NNE": "NNO", "NNE": "NNO",
"NE": "NO", "NE": "NO",

View File

@ -3,9 +3,12 @@
"TODAY": "Dziś", "TODAY": "Dziś",
"TOMORROW": "Jutro", "TOMORROW": "Jutro",
"DAYAFTERTOMORROW": "Pojutrze",
"RUNNING": "Koniec za", "RUNNING": "Koniec za",
"EMPTY": "Brak wydarzeń.", "EMPTY": "Brak wydarzeń.",
"WEEK": "Tydzień",
"N": "N", "N": "N",
"NNE": "NNE", "NNE": "NNE",
"NE": "NE", "NE": "NE",