Merge pull request #448 from MichMich/develop

Release 2.0.5
This commit is contained in:
Michael Teeuw 2016-09-20 16:41:12 +02:00 committed by GitHub
commit b8167f89e5
26 changed files with 345 additions and 171 deletions

View File

@ -1,6 +1,5 @@
vendor/
!/vendor/vendor.js
/modules/**
!/modules/default/**
!/modules/node_helper
!/modules/node_helper/**

View File

@ -5,55 +5,45 @@ Thanks for contributing to MagicMirror²!
We hold our code to standard, and these standards are documented below.
First, before you run the linters, you will need to install them all **and** install the development dependencies:
If you wish to run both linters, use `grunt` without any arguments.
```bash
(sudo) npm install -g jscs stylelint html-validator-cli
npm install
```
### JavaScript: Run ESLint
### JavaScript: Run JSCS
We use [ESLint](http://eslint.org) on our JavaScript files.
We use [JSCS](http://jscs.info) on our JavaScript files.
Our ESLint configuration is in our .eslintrc.json and .eslintignore files.
Our JSCS configuration is in our .jscsrc file.
To run JSCS, use `npm run jscs`.
To run ESLint, use `grunt eslint`.
### CSS: Run StyleLint
We use [StyleLint](http://stylelint.io) to lint our CSS. Our configuration is in our .stylelintrc file.
To run StyleLint, use `npm run stylelint`.
To run StyleLint, use `grunt stylelint`.
### HTML: Run HTML Validator
We use [NU Validator](https://validator.w3.org/nu) to validate our HTML. The configuration is in the command in the package.json file.
To run HTML Validator, use `npm run htmlvalidator`.
## Submitting Issues
### Submitting Issues
Please only submit reproducible issues.
If you're not sure if it's a real bug or if it's just you, please open a topic on the forum: https://forum.magicmirror.builders/category/15/bug-hunt - Problems installing or configuring your MagicMirror? Check out: https://forum.magicmirror.builders/category/10/troubleshooting
If you're not sure if it's a real bug or if it's just you, please open a topic on the forum: [https://forum.magicmirror.builders/category/15/bug-hunt](https://forum.magicmirror.builders/category/15/bug-hunt)
Problems installing or configuring your MagicMirror? Check out: [https://forum.magicmirror.builders/category/10/troubleshooting](https://forum.magicmirror.builders/category/10/troubleshooting)
When submitting a new issue, please supply the following information:
**Platform** [ Raspberry Pi 2/3, Windows, Mac OS X, Linux, Etc ... ]:
**Platform**: Place your platform here... give us your web browser/Electron version *and* your hardware (Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX).
**Node Version** [ 0.12.13 or later ]:
**Node Version**: Make sure it's version 0.12.13 or later.
**MagicMirror Version** [ V1 / V2-Beta ]:
**MagicMirror Version**: Now that the versions have split, tell us if you are using the PHP version (v1) or the newer JavaScript version (v2).
**Description:** Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.
**Description**: Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.
**Steps to Reproduce:** List the step by step process to reproduce the issue.
**Steps to Reproduce**: List the step by step process to reproduce the issue.
**Expected Results:** Describe what you expected to see.
**Expected Results**: Describe what you expected to see.
**Actual Results:** Describe what you actually saw.
**Actual Results**: Describe what you actually saw.
**Configuration:** What does the used config.js file look like? (Don't forget to remove any sensitive information.)
**Configuration**: What does the used config.js file look like? Don't forget to remove any sensitive information!
**Additional Notes:** Provide any other relevant notes not previously mentioned (optional)
**Additional Notes**: Provide any other relevant notes not previously mentioned. This is optional.

View File

@ -1,21 +1,24 @@
Please only submit reproducible issues.
If you're not sure if it's a real bug or if it's just you, please open a topic on the forum: https://forum.magicmirror.builders/category/15/bug-hunt - Problems installing or configuring your MagicMirror? Check out: https://forum.magicmirror.builders/category/10/troubleshooting
If you're not sure if it's a real bug or if it's just you, please open a topic on the forum: [https://forum.magicmirror.builders/category/15/bug-hunt](https://forum.magicmirror.builders/category/15/bug-hunt)
Problems installing or configuring your MagicMirror? Check out: [https://forum.magicmirror.builders/category/10/troubleshooting](https://forum.magicmirror.builders/category/10/troubleshooting)
**Platform** [ Raspberry Pi 2/3, Windows, Mac OS X, Linux, Etc ... ]:
When submitting a new issue, please supply the following information:
**Node Version** [ 0.12.13 or later ]:
**Platform**: Place your platform here... give us your web browser/Electron version *and* your hardware (Raspberry Pi 2/3, Windows, Mac, Linux, System V UNIX).
**MagicMirror Version** [ V1 / V2-Beta ]:
**Node Version**: Make sure it's version 0.12.13 or later.
**Description:** Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.
**MagicMirror Version**: Now that the versions have split, tell us if you are using the PHP version (v1) or the newer JavaScript version (v2).
**Steps to Reproduce:** List the step by step process to reproduce the issue.
**Description**: Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.
**Expected Results:** Describe what you expected to see.
**Steps to Reproduce**: List the step by step process to reproduce the issue.
**Actual Results:** Describe what you actually saw.
**Expected Results**: Describe what you expected to see.
**Configuration:** What does the used config.js file look like? (Don't forget to remove any sensitive information.)
**Actual Results**: Describe what you actually saw.
**Additional Notes:** Provide any other relevant notes not previously mentioned (optional)
**Configuration**: What does the used config.js file look like? Don't forget to remove any sensitive information!
**Additional Notes**: Provide any other relevant notes not previously mentioned. This is optional.

View File

@ -1,9 +1,7 @@
> Please send your PR's the develop branch.
> Don't forget to add the change to changelog.md.
> Please send your pull requests the develop branch.
> Don't forget to add the change to CHANGELOG.md.
* Does the pull request solve a **related** issue? [yes | no]
* Does the pull request solve a **related** issue?
* If so, can you reference the issue?
* What does the pull request accomplish? (please list)
* What does the pull request accomplish? Use a list if needed.
* If it includes major visual changes please add screenshots.

View File

@ -1,4 +1,5 @@
{
"extends": "stylelint-config-standard",
"font-family-name-quotes": "double-where-recommended"
"font-family-name-quotes": "double-where-recommended",
"block-no-empty": false
}

View File

@ -2,11 +2,30 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.0.5] - 2016-09-20
### Added
- Added ability to remove tags from the beginning or end of newsfeed items in 'newsfeed.js'.
- Added ability to define "the day after tomorrow" for calendar events (Definition for German and Dutch already included).
- Added CII Badge (we are compliant with the CII Best Practices)
- Add support for doing http basic auth when loading calendars
- Add the abilty to turn off and on the date display in the Clock Module
### Fixed
- Fix typo in installer.
- Add message to unsupported Pi error to mention that Pi Zeros must use server only mode, as ARMv6 is unsupported. Closes #374.
- Fix API url for weather API.
### Updated
- Force fullscreen when kioskmode is active.
- Update the .github templates and information with more modern information.
- Update the Gruntfile with a more functional StyleLint implementation.
## [2.0.4] - 2016-08-07
### Added
- Brazilian Portuguese Translation.
- Option to enable Kios mode.
- Option to enable Kiosk mode.
- Added ability to start the app with Dev Tools.
- Added ability to turn off the date display in `clock.js` when in analog mode.
- Greek Translation
@ -71,4 +90,4 @@ It includes (but is not limited to) the following features:
## [1.0.0] - 2014-02-16
### Initial release of MagicMirror.
This was part of the blogpost: http://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the
This was part of the blogpost: [http://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the](http://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the)

View File

@ -8,21 +8,60 @@ module.exports = function(grunt) {
},
target: ["js/*.js", "modules/default/*.js", "serveronly/*.js", "*.js"]
},
postcss: {
lint: {
stylelint: {
simple: {
options: {
processors: [
require("stylelint")({"extends": "stylelint-config-standard", "font-family-name-quotes": "double-where-recommended"}),
require("postcss-reporter")({ clearMessages: true })
]
configFile: ".stylelintrc"
},
dist: {
src: "**/**/**/**/**/**/**/**.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: {
main: {
src: ["package.json", ".eslintrc.json", ".stylelint"],
options: {
reporter: "jshint"
}
}
},
markdownlint: {
all: {
options: {
config: {
"default": true,
"line-length": false,
"blanks-around-headers": false,
"no-duplicate-header": false,
"no-inline-html": false,
"MD010": false,
"MD001": false,
"MD031": false,
"MD040": false,
"MD002": false,
"MD029": false,
"MD041": false,
"MD032": false,
"MD036": false,
"MD037": false,
"MD009": false,
"MD018": false,
"MD012": false,
"MD026": false,
"MD036": false,
"MD038": false
}
},
src: ["README.md", "CHANGELOG.md", "LICENSE.md", "modules/README.md", "modules/default/**/*.md", "!modules/default/calendar/vendor/ical.js/readme.md"]
}
},
yamllint: {
all: [".travis.yml"]
}
});
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-postcss");
grunt.registerTask("default", ["eslint", "postcss:lint"]);
grunt.loadNpmTasks("grunt-stylelint");
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-yamllint");
grunt.loadNpmTasks("grunt-markdownlint");
grunt.registerTask("default", ["eslint", "stylelint", "jsonlint", "markdownlint", "yamllint"]);
};

View File

@ -3,7 +3,7 @@
<p align="center">
<a href="https://david-dm.org/MichMich/MagicMirror"><img src="https://david-dm.org/MichMich/MagicMirror.svg" alt="Dependency Status"></a>
<a href="https://david-dm.org/MichMich/MagicMirror#info=devDependencies"><img src="https://david-dm.org/MichMich/MagicMirror/dev-status.svg" alt="devDependency Status"></a>
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-v5.10.1-brightgreen.svg" alt="Node Version"></a>
<a href="https://bestpractices.coreinfrastructure.org/projects/347"><img src="https://bestpractices.coreinfrastructure.org/projects/347/badge"></a>
<a href="http://choosealicense.com/licenses/mit"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="https://travis-ci.org/MichMich/MagicMirror"><img src="https://travis-ci.org/MichMich/MagicMirror.svg" alt="Travis"></a>
<a href="https://snyk.io/test/github/MichMich/MagicMirror"><img src="https://snyk.io/test/github/MichMich/MagicMirror/badge.svg" alt="Known Vulnerabilities" data-canonical-src="https://snyk.io/test/github/MichMich/MagicMirror" style="max-width:100%;"></a>
@ -24,17 +24,17 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec
## Usage
#### Raspberry Pi Support
### Raspberry Pi Support
Electron, the app wrapper around MagicMirror², only supports the Raspberry Pi 2 & 3. The Raspberry Pi 1 is currently **not** supported. If you want to run this on a Raspberry Pi 1, use the [server only](#server-only) feature and setup a fullscreen browser yourself.
#### Automatic Installer (Raspberry Pi Only!)
### Automatic Installer (Raspberry Pi Only!)
Execute the following command on your Raspberry Pi to install MagicMirror²:
````
curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh | bash
````
#### Manual Installation
### Manual Installation
1. Download and install the latest Node.js version.
2. Clone the repository and check out the beta branch: `git clone https://github.com/MichMich/MagicMirror`
@ -45,23 +45,23 @@ curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installer
**Note:** if you want to debug on Raspberry Pi you can use `npm start dev` which will start the MagicMirror app with Dev Tools enabled.
#### Server Only
### Server Only
In some cases, you want to start the application without an actual app window. In this case, execute the following command from the MagicMirror folder: `node serveronly`. This will start the server, after which you can open the application in your browser of choice.
#### Raspberry Configuration & Auto Start.
### Raspberry Configuration & Auto Start.
The following wiki links are helpful in the configuration of your MagicMirror² operating system:
- [Configuring the Raspberry Pi](https://github.com/MichMich/MagicMirror/wiki/Configuring-the-Raspberry-Pi)
- [Auto Starting MagicMirror](https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror)
#### Updating you MagicMirror²
### Updating your MagicMirror²
If you want to update your MagicMirror² to the latest version, use your terminal to go to your Magic Mirror folder and type the following command:
````
```bash
git pull
````
```
If you changed nothing more than the config or the modules, this should work without any problems.
Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible.

View File

@ -28,6 +28,7 @@ ARM=$(uname -m)
if [ "$ARM" != "armv7l" ]; then
echo -e "\e[91mSorry, your Raspberry Pi is not supported."
echo -e "\e[91mPlease run MagicMirror on a Raspberry Pi 2 or 3."
echo -e "\e[91mIf this is a Pi Zero, you are in the same boat as the original Raspberry Pi. You must run in server only mode."
exit;
fi
@ -68,7 +69,7 @@ else
NODE_INSTALL=true
fi
# Install or upgare node if nessecery.
# Install or upgrade node if necessary.
if $NODE_INSTALL; then
echo -e "\e[96mInstalling Node.js ...\e[90m"

View File

@ -1,3 +1,5 @@
/* jshint esversion: 6 */
"use strict";
const Server = require(__dirname + "/server.js");
@ -32,13 +34,26 @@ function createWindow() {
mainWindow.webContents.openDevTools();
}
// Emitted when the window is closed.
// Set responders for window events.
mainWindow.on("closed", function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
if (config.kioskmode) {
mainWindow.on("blur", function() {
mainWindow.focus();
});
mainWindow.on("leave-full-screen", function() {
mainWindow.setFullScreen(true);
});
mainWindow.on("resize", function() {
setTimeout(function() {
mainWindow.reload();
}, 1000);
});
}
}
// This method will be called when Electron has finished
@ -50,11 +65,7 @@ app.on("ready", function() {
// Quit when all windows are closed.
app.on("window-all-closed", function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== "darwin") {
app.quit();
}
createWindow();
});
app.on("activate", function() {

View File

@ -4,7 +4,7 @@ This document describes the way to develop your own MagicMirror² modules.
## Module structure
All modules are loaded in de `modules` folder. The default modules are grouped together in the `modules/default` folder. Your module should be placed in a subfolder of `modules`. Note that any file or folder your create in the `modules` folder will be ignored by git, allowing you to upgrade the MagicMirror² without the loss of your files.
All modules are loaded in the `modules` folder. The default modules are grouped together in the `modules/default` folder. Your module should be placed in a subfolder of `modules`. Note that any file or folder your create in the `modules` folder will be ignored by git, allowing you to upgrade the MagicMirror² without the loss of your files.
A module can be placed in one single folder. Or multiple modules can be grouped in a subfoler. Note that name of the module must be unique. Even when a module with a similar name is placed in a different folder, they can't be loaded at the same time.

View File

@ -173,7 +173,7 @@ config: {
<tr>
<td><code> symbol </code></td>
<td>The symbol to show in front of an event. This property is optional.<br>
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awsome</a> website.
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awesome</a> website.
</td>
</tr>
<tr>
@ -183,5 +183,13 @@ config: {
<code>'Birthday'</code>
</td>
</tr>
<tr>
<td><code> user </code></td>
<td>The username for HTTP Basic authentication.</td>
</tr>
<tr>
<td><code> pass </code></td>
<td>The password for HTTP Basic authentication.</td>
</tr>
</tbody>
</table>

View File

@ -64,7 +64,7 @@ Module.register("calendar",{
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://");
this.addCalendar(calendar.url);
this.addCalendar(calendar.url, calendar.user, calendar.pass);
}
this.calendarData = {};
@ -150,6 +150,16 @@ Module.register("calendar",{
timeWrapper.innerHTML = this.translate("TODAY");
} else if (event.startDate - now < one_day && event.startDate - now > 0) {
timeWrapper.innerHTML = this.translate("TOMORROW");
} else if (event.startDate - now < 2*one_day && event.startDate - now > 0) {
/*Provide ability to show "the day after tomorrow" instead of "in a day"
*if "DAYAFTERTOMORROW" is configured in a language's translation .json file,
*,which can be found in MagicMirror/translations/
*/
if (this.translate('DAYAFTERTOMORROW') !== 'DAYAFTERTOMORROW') {
timeWrapper.innerHTML = this.translate("DAYAFTERTOMORROW");
} else {
timeWrapper.innerHTML = moment(event.startDate, "x").fromNow();
}
} else {
/* Check to see if the user displays absolute or relative dates with their events
* Also check to see if an event is happening within an 'urgency' time frameElement
@ -275,12 +285,14 @@ Module.register("calendar",{
*
* argument url sting - Url to add.
*/
addCalendar: function(url) {
addCalendar: function(url, user, pass) {
this.sendSocketNotification("ADD_CALENDAR", {
url: url,
maximumEntries: this.config.maximumEntries,
maximumNumberOfDays: this.config.maximumNumberOfDays,
fetchInterval: this.config.fetchInterval
fetchInterval: this.config.fetchInterval,
user: user,
pass: pass
});
},

View File

@ -8,7 +8,7 @@
var ical = require("./vendor/ical.js");
var moment = require("moment");
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays) {
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays, user, pass) {
var self = this;
var reloadTimer = null;
@ -29,7 +29,16 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
headers: {
'User-Agent': 'Mozilla/5.0 (Node.js 6.0.0) MagicMirror/v2 (https://github.com/MichMich/MagicMirror/)'
}
};
if (user && pass) {
opts.auth = {
user: user,
pass: pass,
sendImmediately: true
}
}
ical.fromURL(url, opts, function(err, data) {
if (err) {
fetchFailedCallback(self, err);

View File

@ -25,7 +25,7 @@ module.exports = NodeHelper.create({
socketNotificationReceived: function(notification, payload) {
if (notification === "ADD_CALENDAR") {
//console.log('ADD_CALENDAR: ');
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays);
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays, payload.user, payload.pass);
}
},
@ -37,7 +37,7 @@ module.exports = NodeHelper.create({
* attribute reloadInterval number - Reload interval in milliseconds.
*/
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays) {
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays, user, pass) {
var self = this;
if (!validUrl.isUri(url)) {
@ -48,7 +48,7 @@ module.exports = NodeHelper.create({
var fetcher;
if (typeof self.fetchers[url] === "undefined") {
console.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays, user, pass);
fetcher.onReceive(function(fetcher) {
//console.log('Broadcast events.');

View File

@ -66,6 +66,13 @@ The following properties can be configured:
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>showDate</code></td>
<td>Turn off or on the Date section.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>displayType</code></td>
<td>Display a digital clock, analog clock, or both together.<br>

View File

@ -15,6 +15,7 @@ Module.register("clock",{
showPeriod: true,
showPeriodUpper: false,
clockBold: false,
showDate: true,
/* specific to the analog clock */
analogSize: '200px',
@ -85,7 +86,9 @@ Module.register("clock",{
timeString = moment().format("h:mm");
}
}
if(this.config.showDate){
dateWrapper.innerHTML = moment().format("dddd, LL");
}
timeWrapper.innerHTML = timeString;
secondsWrapper.innerHTML = moment().format("ss");
if (this.config.showPeriodUpper) {

View File

@ -1,9 +1,3 @@
#analog {
}
#digital {
}
.clockCircle {
margin: 0 auto;
position: relative;
@ -16,7 +10,7 @@
height: 100%;
}
.clockFace:after {
.clockFace::after {
position: absolute;
top: 50%;
left: 50%;
@ -67,7 +61,7 @@
left: 50%;
margin: -38% -1px 0 0; /* numbers must match negative length & thickness */
padding: 38% 1px 0 0; /* indicator length & thickness */
background: #888888;
background: #888;
-webkit-transform-origin: 50% 100%;
-ms-transform-origin: 50% 100%;
transform-origin: 50% 100%;

View File

@ -164,7 +164,7 @@ Module.register("currentweather",{
* Calls processWeather on succesfull response.
*/
updateWeather: function() {
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.weatherEndpoint + '/' + this.getParams();
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.weatherEndpoint + this.getParams();
var self = this;
var retry = true;

View File

@ -98,7 +98,7 @@ The following properties can be configured:
<td><code>animationSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>2000</code> (2.5 seconds)
<br><b>Default value:</b> <code>2000</code> (2 seconds)
</td>
</tr>
<tr>
@ -108,7 +108,37 @@ The following properties can be configured:
<br><b>Default value:</b> <code>0</code>
</td>
</tr>
removeStartTags: false,
removeEndTags: false,
startTags: [],
endTags: []
<tr>
<td><code>removeStartTags</code></td>
<td>Some newsfeeds feature tags at the <B>beginning</B> of their titles or descriptions, such as <em>[VIDEO]</em>.
This setting allows for the removal of specified tags from the beginning of an item's description and/or title.<br>
<br><b>Possible values:</b><code>'title'</code>, <code>'description'</code>, <code>'both'</code>
</td>
</tr>
<tr>
<td><code>startTags</code></td>
<td>List the tags you would like to have removed at the beginning of the feed item<br>
<br><b>Possible values:</b> <code>['TAG']</code> or <code>['TAG1','TAG2',...]</code>
</td>
</tr>
<tr>
<td><code>removeEndTags</code></td>
<td>Remove specified tags from the <B>end</B> of an item's description and/or title.<br>
<br><b>Possible values:</b><code>'title'</code>, <code>'description'</code>, <code>'both'</code>
</td>
</tr>
<tr>
<td><code>endTags</code></td>
<td>List the tags you would like to have removed at the end of the feed item<br>
<br><b>Possible values:</b> <code>['TAG']</code> or <code>['TAG1','TAG2',...]</code>
</td>
</tr>
</tbody>
</table>

View File

@ -24,7 +24,12 @@ Module.register("newsfeed",{
reloadInterval: 5 * 60 * 1000, // every 5 minutes
updateInterval: 10 * 1000,
animationSpeed: 2.5 * 1000,
maxNewsItems: 0 // 0 for unlimited
maxNewsItems: 0, // 0 for unlimited
removeStartTags: '',
removeEndTags: '',
startTags: [],
endTags: []
},
// Define required scripts.
@ -96,6 +101,49 @@ Module.register("newsfeed",{
wrapper.appendChild(sourceAndTimestamp);
}
//Remove selected tags from the beginning of rss feed items (title or description)
if (this.config.removeStartTags == 'title' || 'both') {
for (f=0; f<this.config.startTags.length;f++) {
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].title.length);
}
}
}
if (this.config.removeStartTags == 'description' || 'both') {
if (this.config.showDescription) {
for (f=0; f<this.config.startTags.length;f++) {
if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].description.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].description.length);
}
}
}
}
//Remove selected tags from the end of rss feed items (title or description)
if (this.config.removeEndTags) {
for (f=0; f<this.config.endTags.length;f++) {
if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length);
}
}
if (this.config.showDescription) {
for (f=0; f<this.config.endTags.length;f++) {
if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.endTags[f].length);
}
}
}
}
var title = document.createElement("div");
title.className = "bright medium light";
title.innerHTML = this.newsItems[this.activeItem].title;
@ -215,5 +263,7 @@ Module.register("newsfeed",{
*/
capitalizeFirstLetter: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
},
});

View File

@ -102,7 +102,7 @@ Module.register("weatherforecast",{
}
if (!this.loaded) {
wrapper.innerHTML = this.translate('LOADING');
wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "dimmed light small";
return wrapper;
}
@ -161,7 +161,7 @@ Module.register("weatherforecast",{
* Calls processWeather on succesfull response.
*/
updateWeather: function() {
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.forecastEndpoint + '/' + this.getParams();
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.forecastEndpoint + this.getParams();
var self = this;
var retry = true;

View File

@ -5,9 +5,6 @@
"main": "js/electron.js",
"scripts": {
"start": "electron js/electron.js",
"jscs": "jscs **/**/**/**/*.js",
"stylelint": "stylelint css/main.css fonts/roboto.css",
"htmlvalidator": "html-validator --file=index.html",
"test": "snyk test",
"snyk-protect": "snyk protect",
"prepublish": "npm run snyk-protect"
@ -30,26 +27,27 @@
},
"homepage": "https://github.com/MichMich/MagicMirror#readme",
"devDependencies": {
"electron-prebuilt": "latest",
"grunt": "latest",
"grunt-eslint": "latest",
"grunt-postcss": "latest",
"postcss-reporter": "latest",
"stylelint": "latest",
"grunt-jsonlint": "latest",
"grunt-markdownlint": "^1.0.4",
"grunt-stylelint": "latest",
"grunt-yamllint": "latest",
"stylelint-config-standard": "latest",
"time-grunt": "latest"
},
"dependencies": {
"electron-prebuilt": "latest",
"express": "^4.14.0",
"feedme": "latest",
"iconv-lite": "latest",
"moment": "latest",
"request": "^2.74.0",
"rrule": "latest",
"snyk": "^1.14.1",
"socket.io": "^1.4.6",
"valid-url": "latest",
"walk": "latest"
"walk": "latest",
"snyk": "^1.14.1"
},
"snyk": true
}

View File

@ -5,6 +5,7 @@
/* CALENDAR */
"TODAY": "Heute",
"TOMORROW": "Morgen",
"DAYAFTERTOMORROW": "&Uuml;bermorgen",
"RUNNING": "noch",
"EMPTY": "Keine Termine.",

View File

@ -5,6 +5,7 @@
/* CALENDAR */
"TODAY": "Vandaag",
"TOMORROW": "Morgen",
"DAYAFTERTOMORROW": "Overmorgen",
"RUNNING": "Eindigt over",
"EMPTY": "Geen geplande afspraken.",