diff --git a/.travis.yml b/.travis.yml index c78f084702..f2d343426e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ language: node_js node_js: - "6" - "5.1" - - "4" - - "0.12" before_script: - npm install grunt-cli -g -script: grunt \ No newline at end of file +script: grunt diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fdf2c65ae..b03a78c23c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.0.3] - 2016-07-12 +### Added +- Add max newsitems parameter to the newsfeed module. +- Translations for Simplified Chinese, Traditional Chinese and Japanese. +- Polish Translation +- Add an analog clock in addition to the digital one. + +### Fixed +- Edit Alert Module to display title & message if they are provided in the notification (Issue #300) +- Removed 'null' reference from updateModuleContent(). This fixes recent Edge and Internet Explorer browser displays (Issue #319) + +### Changed +- Added default string to calendar titleReplace. + ## [2.0.2] - 2016-06-05 ### Added - Norwegian Translations (nb and nn) diff --git a/js/main.js b/js/main.js index 2c2f952004..5df6d75539 100644 --- a/js/main.js +++ b/js/main.js @@ -144,7 +144,7 @@ var MM = (function() { var moduleWrapper = document.getElementById(module.identifier); var contentWrapper = moduleWrapper.getElementsByClassName("module-content")[0]; - contentWrapper.innerHTML = null; + contentWrapper.innerHTML = ""; contentWrapper.appendChild(content); }; diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index 084161acc0..cc25a31c5f 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -35,9 +35,20 @@ Module.register("alert",{ }, show_notification: function(message) { if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;} - message = "" + message.title + "
" + message.message + ""; + + msg = ""; + if (message.title) { + msg += "" + message.title + ""; + } + if (message.message){ + if (msg != ""){ + msg+= "
"; + } + msg += "" + message.message + ""; + } + new NotificationFx({ - message: message, + message: msg, layout: "growl", effect: this.config.effect, ttl: this.config.display_time @@ -67,7 +78,19 @@ Module.register("alert",{ this.hide_alert(sender); } - message = "" + params.title + "
" + params.message + ""; + //Display title and message only if they are provided in notification parameters + message =""; + if (params.title) { + message += "" + params.title + "" + } + if (params.message) { + if (message != ""){ + message += "
"; + } + + message += "" + params.message + ""; + } + //Store alert in this.alerts this.alerts[sender.name] = new NotificationFx({ message: image + message, diff --git a/modules/default/clock/README.md b/modules/default/clock/README.md index 8808825c9a..77eb3fde66 100644 --- a/modules/default/clock/README.md +++ b/modules/default/clock/README.md @@ -66,5 +66,40 @@ The following properties can be configured:
Default value: false + + displayType + Display a digital clock, analog clock, or both together.
+
Possible values: digital, analog, or both +
Default value: digital + + + + analogSize + Specific to the analog clock. Defines how large the analog display is.
+
Possible values: A positive number of pixels +
Default value: 200px + + + + analogFace + Specific to the analog clock. Specifies which clock face to use.
+
Possible values: simple for a simple border, none for no face or border, or face-### (where ### is currently a value between 001 and 012, inclusive) +
Default value: simple + + + + secondsColor + Specific to the analog clock. Specifies what color to make the 'seconds' hand.
+
Possible values: any HTML RGB Color +
Default value: #888888 + + + + analogPlacement + Specific to the analog clock. (requires displayType set to 'both') Specifies where the analog clock is in relation to the digital clock
+
Possible values: top, right, bottom, or left +
Default value: bottom + + diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 8593256776..9f4abecbdc 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -8,31 +8,51 @@ Module.register("clock",{ // Module config defaults. defaults: { + displayType: 'digital', // options: digital, analog, both + timeFormat: config.timeFormat, displaySeconds: true, showPeriod: true, showPeriodUpper: false, - clockBold: false + clockBold: false, + + /* specific to the analog clock */ + analogSize: '200px', + analogFace: 'simple', // options: 'none', 'simple', 'face-###' (where ### is 001 to 012 inclusive) + analogPlacement: 'bottom', // options: top, bottom, left, right + secondsColor: '#888888', }, // Define required scripts. getScripts: function() { return ["moment.js"]; }, + // Define styles. + getStyles: function() { + return ["clock_styles.css"]; + }, // Define start sequence. start: function() { Log.info("Starting module: " + this.name); + // Schedule update interval. var self = this; setInterval(function() { self.updateDom(); }, 1000); + // Set locale. moment.locale(config.language); + }, // Override dom generator. getDom: function() { - // Create wrappers. + var wrapper = document.createElement("div"); + + /************************************ + * Create wrappers for DIGITAL clock + */ + var dateWrapper = document.createElement("div"); var timeWrapper = document.createElement("div"); var secondsWrapper = document.createElement("sup"); @@ -72,15 +92,127 @@ Module.register("clock",{ } else { periodWrapper.innerHTML = moment().format("a"); } - // Combine wrappers. - wrapper.appendChild(dateWrapper); - wrapper.appendChild(timeWrapper); if (this.config.displaySeconds) { timeWrapper.appendChild(secondsWrapper); } if (this.config.showPeriod && this.config.timeFormat !== 24) { timeWrapper.appendChild(periodWrapper); } + if (this.config.displaySeconds) { + timeWrapper.appendChild(secondsWrapper); + } + if (this.config.showPeriod && this.config.timeFormat !== 24) { + timeWrapper.appendChild(periodWrapper); + } + + /**************************************************************** + * Create wrappers for ANALOG clock, only if specified in config + */ + + if (this.config.displayType !== 'digital') { + // If it isn't 'digital', then an 'analog' clock was also requested + + // Calculate the degree offset for each hand of the clock + var now = moment(), + second = now.seconds() * 6, + minute = now.minute() * 6 + second / 60, + hour = ((now.hours() % 12) / 12) * 360 + 90 + minute / 12; + + // Create wrappers + var wrapper = document.createElement("div"); + var clockCircle = document.createElement("div"); + clockCircle.className = "clockCircle"; + clockCircle.style.width = this.config.analogSize; + clockCircle.style.height = this.config.analogSize; + + if (this.config.analogFace != '' && this.config.analogFace != 'simple' && this.config.analogFace != 'none') { + clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)"; + clockCircle.style.backgroundSize = "100%"; + } else if (this.config.analogFace != 'none') { + clockCircle.style.border = "2px solid white"; + } + var clockFace = document.createElement("div"); + clockFace.className = "clockFace"; + + var clockHour = document.createElement("div"); + clockHour.id = "clockHour"; + clockHour.style.transform = "rotate(" + hour + "deg)"; + clockHour.className = "clockHour"; + var clockMinute = document.createElement("div"); + clockMinute.id = "clockMinute"; + clockMinute.style.transform = "rotate(" + minute + "deg)"; + clockMinute.className = "clockMinute"; + + // Combine analog wrappers + clockFace.appendChild(clockHour); + clockFace.appendChild(clockMinute); + + if (this.config.displaySeconds) { + var clockSecond = document.createElement("div"); + clockSecond.id = "clockSecond"; + clockSecond.style.transform = "rotate(" + second + "deg)"; + clockSecond.className = "clockSecond"; + clockSecond.style.backgroundColor = this.config.secondsColor; + clockFace.appendChild(clockSecond); + } + clockCircle.appendChild(clockFace); + } + + /******************************************* + * Combine wrappers, check for .displayType + */ + + if (this.config.displayType === 'digital') { + // Display only a digital clock + wrapper.appendChild(dateWrapper); + wrapper.appendChild(timeWrapper); + } else if (this.config.displayType === 'analog') { + // Display only an analog clock + dateWrapper.style.textAlign = "center"; + dateWrapper.style.paddingBottom = "15px"; + wrapper.appendChild(dateWrapper); + wrapper.appendChild(clockCircle); + } else { + // Both clocks have been configured, check position + var placement = this.config.analogPlacement; + + analogWrapper = document.createElement("div"); + analogWrapper.id = "analog"; + analogWrapper.style.cssFloat = "none"; + analogWrapper.appendChild(clockCircle); + digitalWrapper = document.createElement("div"); + digitalWrapper.id = "digital"; + digitalWrapper.style.cssFloat = "none"; + digitalWrapper.appendChild(dateWrapper); + digitalWrapper.appendChild(timeWrapper); + + if (placement === 'left' || placement === 'right') { + digitalWrapper.style.display = "inline-block"; + digitalWrapper.style.verticalAlign = "top"; + analogWrapper.style.display = "inline-block"; + if (placement === 'left') { + analogWrapper.style.padding = "0 20px 0 0"; + wrapper.appendChild(analogWrapper); + wrapper.appendChild(digitalWrapper); + } else { + analogWrapper.style.padding = "0 0 0 20px"; + wrapper.appendChild(digitalWrapper); + wrapper.appendChild(analogWrapper); + } + } else { + digitalWrapper.style.textAlign = "center"; + if (placement === 'top') { + analogWrapper.style.padding = "0 0 20px 0"; + wrapper.appendChild(analogWrapper); + wrapper.appendChild(digitalWrapper); + } else { + analogWrapper.style.padding = "20px 0 0 0"; + wrapper.appendChild(digitalWrapper); + wrapper.appendChild(analogWrapper); + } + } + } + // Return the wrapper to the dom. return wrapper; } diff --git a/modules/default/clock/clock_styles.css b/modules/default/clock/clock_styles.css new file mode 100644 index 0000000000..6020e57950 --- /dev/null +++ b/modules/default/clock/clock_styles.css @@ -0,0 +1,74 @@ +#analog { +} + +#digital { +} + +.clockCircle { + margin: 0 auto; + position: relative; + border-radius: 50%; + background-size: 100%; +} + +.clockFace { + width: 100%; + height: 100%; +} + +.clockFace:after { + position: absolute; + top: 50%; + left: 50%; + width: 6px; + height: 6px; + margin: -3px 0 0 -3px; + background: white; + border-radius: 3px; + content: ""; + display: block; +} + +.clockHour { + width: 0; + height: 0; + position: absolute; + top: 50%; + left: 50%; + margin: -2px 0 -2px -25%; /* numbers much match negative length & thickness */ + padding: 2px 0 2px 25%; /* indicator length & thickness */ + background: white; + -webkit-transform-origin: 100% 50%; + -ms-transform-origin: 100% 50%; + transform-origin: 100% 50%; + border-radius: 3px 0 0 3px; +} + +.clockMinute { + width: 0; + height: 0; + position: absolute; + top: 50%; + left: 50%; + margin: -35% -2px 0; /* numbers must match negative length & thickness */ + padding: 35% 2px 0; /* indicator length & thickness */ + background: white; + -webkit-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + transform-origin: 50% 100%; + border-radius: 3px 0 0 3px; +} + +.clockSecond { + width: 0; + height: 0; + position: absolute; + top: 50%; + left: 50%; + margin: -38% -1px 0 0; /* numbers must match negative length & thickness */ + padding: 38% 1px 0 0; /* indicator length & thickness */ + background: #888888; + -webkit-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + transform-origin: 50% 100%; +} diff --git a/modules/default/clock/faces/face-001.svg b/modules/default/clock/faces/face-001.svg new file mode 100644 index 0000000000..6d1c17f30f --- /dev/null +++ b/modules/default/clock/faces/face-001.svg @@ -0,0 +1 @@ +face-001 \ No newline at end of file diff --git a/modules/default/clock/faces/face-002.svg b/modules/default/clock/faces/face-002.svg new file mode 100644 index 0000000000..a56210c01d --- /dev/null +++ b/modules/default/clock/faces/face-002.svg @@ -0,0 +1 @@ +face-002 \ No newline at end of file diff --git a/modules/default/clock/faces/face-003.svg b/modules/default/clock/faces/face-003.svg new file mode 100644 index 0000000000..38191df6de --- /dev/null +++ b/modules/default/clock/faces/face-003.svg @@ -0,0 +1 @@ +face-003 \ No newline at end of file diff --git a/modules/default/clock/faces/face-004.svg b/modules/default/clock/faces/face-004.svg new file mode 100644 index 0000000000..f69781aa17 --- /dev/null +++ b/modules/default/clock/faces/face-004.svg @@ -0,0 +1 @@ +face-004 \ No newline at end of file diff --git a/modules/default/clock/faces/face-005.svg b/modules/default/clock/faces/face-005.svg new file mode 100644 index 0000000000..577c4f5326 --- /dev/null +++ b/modules/default/clock/faces/face-005.svg @@ -0,0 +1 @@ +faces \ No newline at end of file diff --git a/modules/default/clock/faces/face-006.svg b/modules/default/clock/faces/face-006.svg new file mode 100644 index 0000000000..665e9ccdce --- /dev/null +++ b/modules/default/clock/faces/face-006.svg @@ -0,0 +1 @@ +face-006 \ No newline at end of file diff --git a/modules/default/clock/faces/face-007.svg b/modules/default/clock/faces/face-007.svg new file mode 100644 index 0000000000..2dc41971c9 --- /dev/null +++ b/modules/default/clock/faces/face-007.svg @@ -0,0 +1 @@ +face-007 \ No newline at end of file diff --git a/modules/default/clock/faces/face-008.svg b/modules/default/clock/faces/face-008.svg new file mode 100644 index 0000000000..b5ea16ede9 --- /dev/null +++ b/modules/default/clock/faces/face-008.svg @@ -0,0 +1 @@ +face-008 \ No newline at end of file diff --git a/modules/default/clock/faces/face-009.svg b/modules/default/clock/faces/face-009.svg new file mode 100644 index 0000000000..a498d853f0 --- /dev/null +++ b/modules/default/clock/faces/face-009.svg @@ -0,0 +1 @@ +face-009 \ No newline at end of file diff --git a/modules/default/clock/faces/face-010.svg b/modules/default/clock/faces/face-010.svg new file mode 100644 index 0000000000..2367959813 --- /dev/null +++ b/modules/default/clock/faces/face-010.svg @@ -0,0 +1 @@ +face-010 \ No newline at end of file diff --git a/modules/default/clock/faces/face-011.svg b/modules/default/clock/faces/face-011.svg new file mode 100644 index 0000000000..493c75c2d3 --- /dev/null +++ b/modules/default/clock/faces/face-011.svg @@ -0,0 +1 @@ +face-011 \ No newline at end of file diff --git a/modules/default/clock/faces/face-012.svg b/modules/default/clock/faces/face-012.svg new file mode 100644 index 0000000000..a1a0fdd88a --- /dev/null +++ b/modules/default/clock/faces/face-012.svg @@ -0,0 +1 @@ +face-012 \ No newline at end of file diff --git a/modules/default/newsfeed/README.md b/modules/default/newsfeed/README.md index 47f73b010f..882ef94a85 100644 --- a/modules/default/newsfeed/README.md +++ b/modules/default/newsfeed/README.md @@ -101,7 +101,13 @@ The following properties can be configured:
Default value: 2000 (2.5 seconds) - + + maxNewsItems + Total amount of news items to cycle through. (0 for unlimited)
+
Possible values:0 - ... +
Default value: 0 + + diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 66e76d77c2..a96640859b 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -24,6 +24,7 @@ Module.register("newsfeed",{ reloadInterval: 5 * 60 * 1000, // every 5 minutes updateInterval: 10 * 1000, animationSpeed: 2.5 * 1000, + maxNewsItems: 0 // 0 for unlimited }, // Define required scripts. @@ -151,7 +152,9 @@ Module.register("newsfeed",{ var dateB = new Date(b.pubdate); return dateB - dateA; }); - + if(this.config.maxNewsItems > 0) { + newsItems = newsItems.slice(0, this.config.maxNewsItems); + } this.newsItems = newsItems; }, diff --git a/translations/ja.json b/translations/ja.json new file mode 100644 index 0000000000..40d5996a49 --- /dev/null +++ b/translations/ja.json @@ -0,0 +1,28 @@ +{ + /* GENERAL */ + "LOADING": "ローディング …", + + /* CALENDAR */ + "TODAY":"今日", + "TOMORROW":"明日", + "RUNNING":"で終わります", + "EMPTY":"直近のイベントはありません", + + /* WEATHER */ + "N":"北", + "NNE":"北北東", + "NE":"北東", + "ENE":"東北東", + "E":"東", + "ESE":"東南東", + "SE":"南東", + "SSE":"南南東", + "S":"南", + "SSW":"南南西", + "SW":"南西", + "WSW":"西南西", + "W":"西", + "WNW":"西北西", + "NW":"北西", + "NNW":"北北西" +} diff --git a/translations/pl.json b/translations/pl.json new file mode 100644 index 0000000000..bc6753aceb --- /dev/null +++ b/translations/pl.json @@ -0,0 +1,28 @@ +{ + /* GENERAL */ + "LOADING": "Ładowanie …", + + /* CALENDAR */ + "TODAY": "Dziś", + "TOMORROW": "Jutro", + "RUNNING": "Koniec za", + "EMPTY": "Brak wydarzeń.", + + /* WEATHER */ + "N": "N", + "NNE": "NNE", + "NE": "NE", + "ENE": "ENE", + "E": "E", + "ESE": "ESE", + "SE": "SE", + "SSE": "SSE", + "S": "S", + "SSW": "SSW", + "SW": "SW", + "WSW": "WSW", + "W": "W", + "WNW": "WNW", + "NW": "NW", + "NNW": "NNW" +} diff --git a/translations/translations.js b/translations/translations.js index ac80702ea2..1f541c45ec 100644 --- a/translations/translations.js +++ b/translations/translations.js @@ -17,4 +17,9 @@ var translations = { "pt" : "translations/pt.json", // Português "sv" : "translations/sv.json", // Svenska "it" : "translations/it.json", // Italian + "zh_cn" : "translations/zh_cn.json", // Simplified Chinese + "zh_tw" : "translations/zh_tw.json", // Traditional Chinese + "ja" : "translations/ja.json", // Japanese + "pl" : "translations/pl.json", // Polish + }; diff --git a/translations/zh_cn.json b/translations/zh_cn.json new file mode 100644 index 0000000000..b6d21d378a --- /dev/null +++ b/translations/zh_cn.json @@ -0,0 +1,28 @@ +{ + /* GENERAL */ + "LOADING": "正在加载 …", + + /* CALENDAR */ + "TODAY": "今天", + "TOMORROW": "明天", + "RUNNING": "结束日期", + "EMPTY": "没有更多的活动。", + + /* WEATHER */ + "N": "北风", + "NNE": "北偏东风", + "NE": "东北风", + "ENE": "东偏北风", + "E": "东风", + "ESE": "东偏南风", + "SE": "东南风", + "SSE": "南偏东风", + "S": "南风", + "SSW": "南偏西风", + "SW": "西南风", + "WSW": "西偏南风", + "W": "西风", + "WNW": "西偏北风", + "NW": "西北风", + "NNW": "北偏西风" +} diff --git a/translations/zh_tw.json b/translations/zh_tw.json new file mode 100644 index 0000000000..b6f78f1275 --- /dev/null +++ b/translations/zh_tw.json @@ -0,0 +1,28 @@ +{ + /* GENERAL */ + "LOADING": "正在加載 …", + + /* CALENDAR */ + "TODAY": "今天", + "TOMORROW": "明天", + "RUNNING": "結束日期", + "EMPTY": "沒有更多的活動。", + + /* WEATHER */ + "N": "北風", + "NNE": "北偏東風", + "NE": "東北風", + "ENE": "東偏北風", + "E": "東風", + "ESE": "東偏南風", + "SE": "東南風", + "SSE": "南偏東風", + "S": "南風", + "SSW": "南偏西風", + "SW": "西南風", + "WSW": "西偏南風", + "W": "西風", + "WNW": "西偏北風", + "NW": "西北風", + "NNW": "北偏西風" +}