Merge branch 'develop' into master

This commit is contained in:
Michael Teeuw 2017-01-12 19:46:34 +01:00 committed by GitHub
commit 8ae946c2c5
12 changed files with 193 additions and 13 deletions

View File

@ -3,18 +3,22 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.1.1] - Unreleased
- Make mouse events pass through the region fullscreen_above to modules below.
### Changed
- Installer: Use init config.js from config.js.sample.
### Added
- Add loaded function to modules, providing an async callback.
- Afrikaans translation.
- Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures)
- Add use pm2 for manager process into Installer RaspberryPi script
- Russian Translation
- Afrikaans Translation
### Fixed
- Update .gitignore to not ignore default modules folder.
- Remove white flash on boot up.
- Added `update` in Raspberry Pi installation script.
## [2.1.0] - 2016-12-31

View File

@ -19,7 +19,7 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec
- [Configuration](#configuration)
- [Modules](#modules)
- [Known Issues](#known-issues)
- [community](#community)
- [Community](#community)
- [Contributing Guidelines](#contributing-guidelines)
## Usage

View File

@ -135,6 +135,11 @@ sup {
left: -60px;
right: -60px;
bottom: -60px;
pointer-events: none;
}
.region.fullscreen * {
pointer-events: auto;
}
.region.right {

2
installers/mm.sh Executable file
View File

@ -0,0 +1,2 @@
cd ~/MagicMirror
DISPLAY=:0 npm start

View File

@ -0,0 +1,7 @@
{
apps : [{
name : "MagicMirror",
script : "/home/pi/MagicMirror/installer/mm.sh",
watch : ["/home/pi/MagicMirror/config/config.js"]
}]
}

View File

@ -36,6 +36,10 @@ fi
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function command_exists () { type "$1" &> /dev/null ;}
# Update before first apt-get
echo -e "\e[96mUpdating packages ...\e[90m"
sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation ...\e[90m"
# Installing helper tools
echo -e "\e[96mInstalling helper tools ...\e[90m"
sudo apt-get install curl wget git build-essential unzip || exit
@ -144,6 +148,16 @@ else
echo -e "\e[93mplymouth is not installed.\e[0m";
fi
# Use pm2 control like a service MagicMirror
read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice
if [[ $choice =~ ^[Yy]$ ]]
then
sudo npm install -g pm2
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
pm2 save
fi
echo " "
echo -e "\e[92mWe're ready! Run \e[1m\e[97mDISPLAY=:0 npm start\e[0m\e[92m from the ~/MagicMirror directory to start your MagicMirror.\e[0m"
echo " "

View File

@ -0,0 +1,4 @@
{
"sysTitle": "MagicMirror Уведомление",
"welcome": "Добро пожаловать, старт был успешным!""
}

View File

@ -1,9 +1,10 @@
# 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.
This module displays news headlines based on an RSS feed. Scrolling through news headlines happens time-based (````updateInterval````), but can also be controlled by sending news feed specific notifications to the module.
## Using the module
### Configuration
To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
@ -30,6 +31,51 @@ modules: [
]
````
### Notifications
#### Interacting with the module
MagicMirror's [notification mechanism](https://github.com/MichMich/MagicMirror/tree/master/modules#thissendnotificationnotification-payload) allows to send notifications to the ````newsfeed```` module. The following notifications are supported:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Notification Identifier</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>ARTICLE_NEXT</code></td>
<td>Shows the next news title (hiding the summary or previously fully displayed article)</td>
</tr>
<tr>
<td><code>ARTICLE_PREVIOUS</code></td>
<td>Shows the previous news title (hiding the summary or previously fully displayed article)</td>
</tr>
<tr>
<td><code>ARTICLE_MORE_DETAILS</code></td>
<td><p>When received the *first time*, shows the corresponding description of the currently displayed news title.<br />The module expects that the module's configuration option ````showDescription```` is set to ````false```` (default value).</p>
When received a *second consecutive time*, shows the full news article in an IFRAME.<br />
This requires that the news page can be embedded in an IFRAME, e.g. doesn't have the HTTP response header [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) set to e.g. ````DENY````.</td>
</tr>
<tr>
<td><code>ARTICLE_LESS_DETAILS</code></td>
<td>Hides the summary or full news article and only displays the news title of the currently viewed news item.</td>
</tr>
</tbody>
</table>
Note the payload of the sent notification event is ignored.
#### Example
The following example shows how the next news article title can be displayed on the MagicMirror.
````javascript
this.sendNotification('ARTICLE_NEXT');
````
#### ````newsfeed```` specific notification emitting modules
The third party [MMM-Gestures](https://github.com/thobach/MMM-Gestures) module supports above notifications when moving your hand up, down, left or right in front of a gesture sensor attached to the MagicMirror. See module's readme for more details.
## Configuration options
The following properties can be configured:

View File

@ -89,7 +89,8 @@ Module.register("newsfeed",{
if (this.newsItems.length > 0) {
if (this.config.showSourceTitle || this.config.showPublishDate) {
// this.config.showFullArticle is a run-time configuration, triggered by optional notifications
if (!this.config.showFullArticle && (this.config.showSourceTitle || this.config.showPublishDate)) {
var sourceAndTimestamp = document.createElement("div");
sourceAndTimestamp.className = "light small dimmed";
@ -152,10 +153,12 @@ Module.register("newsfeed",{
}
var title = document.createElement("div");
title.className = "bright medium light";
title.innerHTML = this.newsItems[this.activeItem].title;
wrapper.appendChild(title);
if(!this.config.showFullArticle){
var title = document.createElement("div");
title.className = "bright medium light";
title.innerHTML = this.newsItems[this.activeItem].title;
wrapper.appendChild(title);
}
if (this.config.showDescription) {
var description = document.createElement("div");
@ -164,6 +167,21 @@ Module.register("newsfeed",{
wrapper.appendChild(description);
}
if (this.config.showFullArticle) {
var fullArticle = document.createElement("iframe");
fullArticle.className = "";
fullArticle.style.width = "100%";
fullArticle.style.top = "0";
fullArticle.style.left = "0";
fullArticle.style.position = "fixed";
fullArticle.height = window.innerHeight;
fullArticle.style.border = "none";
fullArticle.src = this.newsItems[this.activeItem].url;
wrapper.appendChild(fullArticle);
}
} else {
wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "small dimmed";
@ -256,7 +274,7 @@ Module.register("newsfeed",{
self.updateDom(self.config.animationSpeed);
setInterval(function() {
timer = setInterval(function() {
self.activeItem++;
self.updateDom(self.config.animationSpeed);
}, this.config.updateInterval);
@ -273,5 +291,50 @@ Module.register("newsfeed",{
return string.charAt(0).toUpperCase() + string.slice(1);
},
resetDescrOrFullArticleAndTimer: function() {
this.config.showDescription = false;
this.config.showFullArticle = false;
if(!timer){
this.scheduleUpdateInterval();
}
},
notificationReceived: function(notification, payload, sender) {
Log.info(this.name + " - received notification: " + notification);
if(notification == "ARTICLE_NEXT"){
var before = this.activeItem;
this.activeItem++;
if (this.activeItem >= this.newsItems.length) {
this.activeItem = 0;
}
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
this.updateDom(100);
} else if(notification == "ARTICLE_PREVIOUS"){
var before = this.activeItem;
this.activeItem--;
if (this.activeItem < 0) {
this.activeItem = this.newsItems.length - 1;
}
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
this.updateDom(100);
}
// if "more details" is received the first time: show article summary, on second time show full article
else if(notification == "ARTICLE_MORE_DETAILS"){
this.config.showDescription = !this.config.showDescription;
this.config.showFullArticle = !this.config.showDescription;
clearInterval(timer);
timer = null;
Log.info(this.name + " - showing " + this.config.showDescription ? "article description" : "full article");
this.updateDom(100);
} else if(notification == "ARTICLE_LESS_DETAILS"){
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - showing only article titles again");
this.updateDom(100);
} else {
Log.info(this.name + " - unknown notification, ignoring: " + notification);
}
},
});

View File

@ -24,10 +24,10 @@
"W": "W",
"WNW": "WNW",
"NW": "NW",
"NNW": "NNW"
"NNW": "NNW",
/* UPDATE INFO */
"UPDATE_NOTIFICATION": "Dostępna jest aktualizacja MagicMirror².",
"UPDATE_NOTIFICATION_MODULE": "Dostępna jest aktualizacja modułu MODULE_NAME.",
"UPDATE_INFO": "The current installation is COMMIT_COUNT behind on the BRANCH_NAME branch."
"UPDATE_INFO": "Zainstalowana wersja odbiega o COMMIT_COUNT commitów od gałęzi BRANCH_NAME."
}

34
translations/ru.json Normal file
View File

@ -0,0 +1,34 @@
{
/* GENERAL */
"LOADING": "Загрузка &hellip;",
/* CALENDAR */
"TODAY": "Сегодня",
"TOMORROW": "Завтра",
"DAYAFTERTOMORROW": "Послезавтра",
"RUNNING": "Заканчивается через",
"EMPTY": "Нет предстоящих событий",
/* WEATHER */
"N": "С",
"NNE": "ССВ",
"NE": "СВ",
"ENE": "ВСВ",
"E": "В",
"ESE": "ВЮВ",
"SE": "ЮВ",
"SSE": "ЮЮВ",
"S": "Ю",
"SSW": "ЮЮЗ",
"SW": "ЮЗ",
"WSW": "ЗЮЗ",
"W": "З",
"WNW": "ЗСЗ",
"NW": "СЗ",
"NNW": "ССЗ",
/* UPDATE INFO */
"UPDATE_NOTIFICATION": "Есть обновление для MagicMirror².",
"UPDATE_NOTIFICATION_MODULE": "Есть обновление для MODULE_NAME модуля.",
"UPDATE_INFO": "Данная инсталляция позади BRANCH_NAME ветки на COMMIT_COUNT коммитов."
}

View File

@ -26,5 +26,6 @@ var translations = {
"gr" : "translations/gr.json", // Greek
"da" : "translations/da.json", // Danish
"tr" : "translations/tr.json", // Turkish
"ru" : "translations/ru.json", // Russian
"af" : "translations/af.json", // Afrikaans
};