Skip to content

Commit

Permalink
Merge pull request #6 from fewieden/develop
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
fewieden authored Apr 27, 2017
2 parents 00a130c + c0d4cdc commit 8bd01d2
Show file tree
Hide file tree
Showing 21 changed files with 719 additions and 311 deletions.
27 changes: 27 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
engines:
stylelint:
enabled: true
duplication:
enabled: true
config:
languages:
- javascript
eslint:
enabled: true
channel: "eslint-3"
checks:
import/no-unresolved:
enabled: false
fixme:
enabled: true
markdownlint:
enabled: true
ratings:
paths:
- "**.js"
- "**.css"
- "**.md"
exclude_paths: [
"node_modules/**/*",
"Bytes.js"
]
10 changes: 10 additions & 0 deletions .doclets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dir: .
packageJson: package.json
articles:
- Overview: README.md
- Developer: DEVELOPER.md
- Changelog: CHANGELOG.md
- License: LICENSE
branches:
- master
- develop
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[{*.json, *.yml}]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bytes.js
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "airbnb-base",
"rules": {
"comma-dangle": 0,
"indent": [2, 4],
"max-len": [2, 120, { "ignoreStrings": true }],
"radix": [2, "as-needed"],
"no-console": 0
},
"settings": {
"import/core-modules": [ "node_helper" ]
},
"env": {
"browser": true,
"node": true,
"es6": true
}
}
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Contribution Guidelines

Thanks for contributing to this module!

Please create pull requests to the branch `develop`.

To hold one code style and standard there are several linters and tools in this project set. Make sure you fullfill the requirements.
Also there will be automatically analysis performed once you created the pull request.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Platform (Hardware/OS):

Node version:

MagicMirror version:

Module version:

Description of the issue:
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Please create pull requests to the branch `develop`.

* Does the pull request solve an issue (add a reference)?
* What are the features of this pr?
* Add screenshots for visual changes.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.log
npm-debug.log*

node_modules/

.idea/

docs/
2 changes: 2 additions & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all
rules "~MD013", "~MD026", "~MD033"
6 changes: 6 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": 4
}
}
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "stable"
- "7"
- "6"
- "5"
script:
- npm run lint
cache:
directories:
- node_modules
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MMM-voice Changelog

## [1.0.1]

### Added

* Code linter
* Documentation
* [Doclets.io](https://doclets.io/fewieden/MMM-voice/master) integration
* Contributing guidelines
* Issue template
* Pull request template
* Gitignore

### Changed

* Dependency manipulation exchanged to fork

## [1.0.0]

Initial version
41 changes: 26 additions & 15 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
This document describes the way to support your own MagicMirror² module with voice control.

## Mode

Use an unique mode, which is not already taken from one of the other modules in this [list](https://github.com/fewieden/MMM-voice/wiki/Supported-Modules).

## COMMANDS

Try to avoid short words like `ON`, `TO`, etc. as far as possible

## Register your commands

As soon as you receive the notification `ALL_MODULES_STARTED` from the core system, register your voice commands by sending the following notification
* notification: `REGISTER_VOICE_MODULE`
* payload: Object with `mode` (string) and `sentence` (array) properties

### Example
````javascript
* notification: `REGISTER_VOICE_MODULE`
* payload: Object with `mode` (string) and `sentence` (array) properties

### Example commands registration

```javascript
notificationReceived: function (notification, payload, sender) {
if(notification === "ALL_MODULES_STARTED"){
this.sendNotification("REGISTER_VOICE_MODULE", {
Expand All @@ -28,15 +33,18 @@ notificationReceived: function (notification, payload, sender) {
});
}
}
````
```

## Handle recognized data

When the user is in the mode of your module, you will receive the following notification
* notification: `VOICE_YOURMODE`
* payload: String with all detected words.

### Example
````javascript
* notification: `VOICE_YOURMODE`
* payload: String with all detected words.

### Example commands recognition

```javascript
notificationReceived: function (notification, payload, sender) {
...
if(notification === "VOICE_FOOTBALL" && sender.name === "MMM-voice"){
Expand All @@ -51,21 +59,24 @@ checkCommands: function(data){
}
...
}
````
```

## React on mode change

When the mode of MMM-voice gets changed it will send a broadcast `VOICE_MODE_CHANGED`
* notification: `VOICE_MODE_CHANGED`
* payload: Object with `old` (string) and `new` (string) mode as properties

* notification: `VOICE_MODE_CHANGED`
* payload: Object with `old` (string) and `new` (string) mode as properties

This gets handy e.g. to revert your manipulations on the DOM.

### Example
````javascript
### Example mode change

```javascript
notificationReceived: function (notification, payload, sender) {
...
if(notification === "VOICE_MODE_CHANGED" && sender.name === "MMM-voice" && payload.old === "FOOTBALL"){
// do your magic
}
}
````
```
15 changes: 10 additions & 5 deletions MMM-voice.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@-webkit-keyframes MMM-voice-pulse {
0% {color: #999999;}
50% {color: #000000;}
100% {color: #999999;}
0% { color: #999; }
50% { color: #000; }
100% { color: #999; }
}

.MMM-voice .pulse {
-webkit-animation: MMM-voice-pulse 1s infinite;
animation: MMM-voice-pulse 1s infinite;
}

.MMM-voice .icon {
Expand All @@ -14,6 +15,7 @@

.MMM-voice-blur {
-webkit-filter: blur(2px) brightness(50%);
filter: blur(2px) brightness(50%);
}

.MMM-voice .modal {
Expand All @@ -22,8 +24,11 @@
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

.MMM-voice .modal ul {
margin: 0px;
}
margin: 0;
}
Loading

0 comments on commit 8bd01d2

Please sign in to comment.