From 044dbd4a65ab384287421eda19d8a550dbd625f0 Mon Sep 17 00:00:00 2001 From: ubertao Date: Sat, 8 Sep 2018 23:05:19 +0800 Subject: [PATCH 01/10] Add gzip support to calendar fetcher. --- modules/default/calendar/calendarfetcher.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index ccd1f6c8..60ee8fc7 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -29,7 +29,8 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri var opts = { headers: { "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)" - } + }, + gzip: true }; if (auth) { From 4aace5b95a1553e6cfe185fd1f7c2919f93b656e Mon Sep 17 00:00:00 2001 From: ubertao Date: Sat, 8 Sep 2018 23:44:12 +0800 Subject: [PATCH 02/10] update changelog with gzip calendar fix --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c242e50..47ccd52c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). --- +## [2.4.2] + +### Fixed + +- Fix gzip encoded calendar loading issue #1400. ## [2.4.1] - 2018-07-04 From 28f1498ec3697d6fb4569dd23a64ac4fff3b69ef Mon Sep 17 00:00:00 2001 From: ubertao Date: Wed, 12 Sep 2018 08:17:10 +0800 Subject: [PATCH 03/10] update CHANGELOG.md adding gzip fix for calendar module --- CHANGELOG.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1765ba0..b12a493e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,6 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). --- -## [2.4.2] - -### Fixed - -- Fix gzip encoded calendar loading issue #1400. - ## [2.5.0] - Unreleased *This release is scheduled to be released on 2018-10-01.* @@ -26,6 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Support for showing end of events through config parameters showEnd and dateEndFormat ### Fixed +- Fixed gzip encoded calendar loading issue #1400. - Mixup between german and spanish translation for newsfeed. - Fixed close dates to be absolute, if no configured in the config.js - module Calendar - Fixed the UpdateNotification module message about new commits in the repository, so they can be correctly localized in singular and plural form. From 168904a159f732ed8a0dfa8f654d1426b11e2536 Mon Sep 17 00:00:00 2001 From: ubertao Date: Wed, 12 Sep 2018 09:31:46 +0800 Subject: [PATCH 04/10] Update zh-cn translation to 2.5.0 --- translations/zh-cn.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/translations/zh-cn.json b/translations/zh-cn.json index b879edb4..10d43283 100644 --- a/translations/zh-cn.json +++ b/translations/zh-cn.json @@ -5,7 +5,9 @@ "TOMORROW": "明天", "DAYAFTERTOMORROW": "后天", "RUNNING": "结束日期", - "EMPTY": "没有更多的活动。", + "EMPTY": "无日程安排。", + + "WEEK": "第{weekNumber}周", "N": "北风", "NNE": "北偏东风", @@ -24,8 +26,10 @@ "NW": "西北风", "NNW": "北偏西风", - "UPDATE_NOTIFICATION": "MagicMirror² 有新的更新", - "UPDATE_NOTIFICATION_MODULE": "模块 {MODULE_NAME} 可更新", - "UPDATE_INFO_SINGLE": "当前已安装版本为 {COMMIT_COUNT} commit 落后于分支 {BRANCH_NAME} ", - "UPDATE_INFO_MULTIPLE": "当前已安装版本为 {COMMIT_COUNT} commits 落后于分支 {BRANCH_NAME} " + "UPDATE_NOTIFICATION": "MagicMirror²有新的版本。", + "UPDATE_NOTIFICATION_MODULE": "{MODULE_NAME}模块可更新。", + "UPDATE_INFO_SINGLE": "当前已安装版本比{BRANCH_NAME}分支落后{COMMIT_COUNT}次代码更新。", + "UPDATE_INFO_MULTIPLE": "当前已安装版本比{BRANCH_NAME}分支落后{COMMIT_COUNT}次代码更新。", + + "FEELS": "体感" } From 4b6208fd9cb3acca54b75c721332511981d4766a Mon Sep 17 00:00:00 2001 From: ubertao Date: Wed, 12 Sep 2018 09:35:58 +0800 Subject: [PATCH 05/10] Update CHANGELOG.md for zh-cn translation updates. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 571b97d8..87fc4d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). *This release is scheduled to be released on 2018-10-01.* ### Added +- Simplified Chinese translation for "Feels" - Polish translate for "Feels" - French translate for "Feels" - Translations for newsfeed module @@ -31,6 +32,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Updated +- Updated Simplified Chinese translation - Swedish translations - Hungarian translations for the updatenotification module - Updated Norsk bokmål translation From 6034891fed9d27ac8c572660b489805d933fdfc4 Mon Sep 17 00:00:00 2001 From: ubertao Date: Mon, 17 Sep 2018 00:51:37 +0800 Subject: [PATCH 06/10] Support multi-line compliments. --- modules/default/compliments/compliments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 74aef034..af3d6e34 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -160,7 +160,7 @@ Module.register("compliments", { var compliment = document.createTextNode(complimentText); var wrapper = document.createElement("div"); wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright"; - wrapper.appendChild(compliment); + wrapper.innerHTML = complimentText.replace(/\n/g, '
'); return wrapper; }, From 40725aa2a23c67719a347aa4b554069cbd436e29 Mon Sep 17 00:00:00 2001 From: ubertao Date: Mon, 17 Sep 2018 00:54:01 +0800 Subject: [PATCH 07/10] Update CHANGELOG.md with multi-line compliments support. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a976bec7..4afc38b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). *This release is scheduled to be released on 2018-10-01.* ### Added +- Support multi-line compliments - Simplified Chinese translation for "Feels" - Polish translate for "Feels" - French translate for "Feels" From cad7debc5be6054a06e8e168b7e6b6fa0df0832d Mon Sep 17 00:00:00 2001 From: ubertao Date: Thu, 20 Sep 2018 08:49:17 +0800 Subject: [PATCH 08/10] Replace innerHTML() with createElement() and appendChild() for security. --- modules/default/compliments/compliments.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index af3d6e34..43ef0e9e 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -157,10 +157,15 @@ Module.register("compliments", { getDom: function() { var complimentText = this.randomCompliment(); - var compliment = document.createTextNode(complimentText); var wrapper = document.createElement("div"); wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright"; - wrapper.innerHTML = complimentText.replace(/\n/g, '
'); + complimentText.split("\n").forEach(function(line, index) { + if (index > 0) { + wrapper.appendChild(document.createElement("br")); + } + wrapper.appendChild(document.createTextNode(line)); + + }); return wrapper; }, From d76c924ad11649959941b430c31fc0c35758a602 Mon Sep 17 00:00:00 2001 From: ubertao Date: Thu, 20 Sep 2018 09:09:06 +0800 Subject: [PATCH 09/10] Update compliments README.md for multi-line support. --- modules/default/compliments/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/default/compliments/README.md b/modules/default/compliments/README.md index 8f796888..7220cd29 100644 --- a/modules/default/compliments/README.md +++ b/modules/default/compliments/README.md @@ -107,6 +107,13 @@ config: { } ```` +#### Multi-line compliments: +Use `\n` to split compliment text into multiple lines, e.g. `First line.\nSecond line.` will be shown as: +``` +First line. +Second line. +``` + ### External Compliment File You may specify an external file that contains the three compliment arrays. This is particularly useful if you have a large number of compliments and do not wish to crowd your `config.js` file with a large array of compliments. From ba428c6cfe11f2a588edc9adbc673dbff342b104 Mon Sep 17 00:00:00 2001 From: ubertao Date: Mon, 24 Sep 2018 23:01:17 +0800 Subject: [PATCH 10/10] Use 'white-space: pre-line' for multi-line compliment. --- css/main.css | 4 ++++ modules/default/compliments/compliments.js | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/css/main.css b/css/main.css index db1fb428..84f8c4d2 100644 --- a/css/main.css +++ b/css/main.css @@ -128,6 +128,10 @@ sup { text-overflow: ellipsis; } +.pre-line { + white-space: pre-line; +} + /** * Region Definitions. */ diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 43ef0e9e..bfa85879 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -157,15 +157,10 @@ Module.register("compliments", { getDom: function() { var complimentText = this.randomCompliment(); + var compliment = document.createTextNode(complimentText); var wrapper = document.createElement("div"); - wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright"; - complimentText.split("\n").forEach(function(line, index) { - if (index > 0) { - wrapper.appendChild(document.createElement("br")); - } - wrapper.appendChild(document.createTextNode(line)); - - }); + wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line"; + wrapper.appendChild(compliment); return wrapper; },