From f4751a2ff2df06ea23625af1a384a3f64744e808 Mon Sep 17 00:00:00 2001 From: Plosxh Date: Mon, 19 Dec 2016 09:26:07 +0100 Subject: [PATCH 01/12] Create fr.json --- translations/fr.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 translations/fr.json diff --git a/translations/fr.json b/translations/fr.json new file mode 100644 index 0000000..d48032f --- /dev/null +++ b/translations/fr.json @@ -0,0 +1,4 @@ +{ + "LOADING": "Chargement...", + "ALARM_CLOCK": "Réveil" +} From 96f350babfcdd3531c1d760d7f7a5a67f9816180 Mon Sep 17 00:00:00 2001 From: mjtice Date: Fri, 10 Mar 2017 16:26:01 -0700 Subject: [PATCH 02/12] Add fade-in functionality --- MMM-AlarmClock.js | 31 ++++++++++++++++++++++++++++++- README.md | 3 +++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index a1fadb6..01117e6 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -17,7 +17,10 @@ Module.register('MMM-AlarmClock', { touch: false, volume: 1.0, format: 'ddd, h:mmA', - timer: 60 * 1000 // one minute + timer: 60 * 1000, // one minute + fade: false, + fade_timer: 60 * 1000, // 60 seconds + fade_step: .005, // .5% }, getStyles() { @@ -73,6 +76,28 @@ Module.register('MMM-AlarmClock', { } }, + fadeAlarm() { + var max_volume = this.config.volume; + var volume = 0; + var that = this; + var volume_step = this.config.fade_step; + var counter = 0; + var myTimer = setInterval(() => { + document.getElementById('alarm_player').volume = volume; + volume = volume + volume_step; + console.log(volume); + counter = counter + 1000; + if (volume >= max_volume) { + document.getElementById(that.identifier).volume = max_volume; + clearInterval(myTimer); + } + if (counter >= that.config.fade_timer) { + document.getElementById('alarm_player').volume = max_volume; + clearInterval(myTimer); + } + }, 1000); + }, + setNextAlarm() { this.next = null; for (let i = 0; i < this.config.alarms.length; i += 1) { @@ -141,6 +166,7 @@ Module.register('MMM-AlarmClock', { wrapper.appendChild(text); } else if (this.alarmFired) { const sound = document.createElement('audio'); + sound.setAttribute('id', 'alarm_player'); if (this.config.sound.match(/^https?:\/\//)) { sound.src = this.config.sound; } else { @@ -149,6 +175,9 @@ Module.register('MMM-AlarmClock', { sound.volume = this.config.volume; sound.setAttribute('autoplay', true); sound.setAttribute('loop', true); + if (this.config.fade == true) { + this.fadeAlarm(sound); + } wrapper.appendChild(sound); } else { const alarm = document.createElement('div'); diff --git a/README.md b/README.md index aba9f30..8045df3 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ Alarm Clock Module for MagicMirror2 | `touch` | `false` | If you are using a touch screen device you need to press a button to disable an alarm.. | | `format` | `'ddd, h:mmA'` | In which format the alarm in the header should be displayed. [All Options](http://momentjs.com/docs/#/displaying/format/) | | `timer` | `60000` (1 min) | How long the alarm should ring for non touch screen or without interaction on touch screen devices. | +| `fade` | `false` | Set to enable a gradual fade-in of the alarm sound. +| `fade_timer` | `60 * 1000` (1 min) | How long to fade into the alarm before `volume` is set. +| `fade_step` | `.005` (.5%) | Increase the volume this percent amount each second until `fade_timer` is reached. ## Alarm Sounds From 08563903cd084f80ababf1ebd1cb9a3841a87ef0 Mon Sep 17 00:00:00 2001 From: slametps Date: Tue, 28 Mar 2017 22:06:40 +0700 Subject: [PATCH 03/12] added Indonesian translation added Indonesian translation --- MMM-AlarmClock.js | 3 ++- translations/id.json | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 translations/id.json diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index a1fadb6..402a7ea 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -31,7 +31,8 @@ Module.register('MMM-AlarmClock', { getTranslations() { return { en: 'translations/en.json', - de: 'translations/de.json' + de: 'translations/de.json', + id: 'translations/id.json' }; }, diff --git a/translations/id.json b/translations/id.json new file mode 100644 index 0000000..b733a05 --- /dev/null +++ b/translations/id.json @@ -0,0 +1,4 @@ +{ + "LOADING": "Memuat...", + "ALARM_CLOCK": "Jam Alarm" +} \ No newline at end of file From 8fb6f8d6163284fa84a21c1ae2ffde1c3085498c Mon Sep 17 00:00:00 2001 From: slametps Date: Sun, 9 Apr 2017 14:27:26 +0700 Subject: [PATCH 04/12] remove align-right from header (will make proper text-aligned based on module position) remove align-right from header (will make proper text-aligned based on module position) --- MMM-AlarmClock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 402a7ea..38e1c03 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -124,7 +124,7 @@ Module.register('MMM-AlarmClock', { getDom() { const wrapper = document.createElement('div'); const header = document.createElement('header'); - header.classList.add('align-left'); + //header.classList.add('align-left'); const logo = document.createElement('i'); logo.classList.add('fa', 'fa-bell-o', 'logo'); From 0a530eb9851e0fb886c61b0c41a1441cddb29afb Mon Sep 17 00:00:00 2001 From: slametps Date: Sun, 9 Apr 2017 14:30:46 +0700 Subject: [PATCH 05/12] remove align-right from header (will make proper text-aligned based on remove align-right from header (will make proper text-aligned based on module position) --- MMM-AlarmClock.js | 1 - 1 file changed, 1 deletion(-) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 38e1c03..13a056d 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -124,7 +124,6 @@ Module.register('MMM-AlarmClock', { getDom() { const wrapper = document.createElement('div'); const header = document.createElement('header'); - //header.classList.add('align-left'); const logo = document.createElement('i'); logo.classList.add('fa', 'fa-bell-o', 'logo'); From deeb7474cc99426eb0b72de37f4138520a3cad34 Mon Sep 17 00:00:00 2001 From: mjtice Date: Wed, 12 Apr 2017 16:22:21 -0600 Subject: [PATCH 06/12] removed "this" redeclaration. Changed element id name to use module namespace. Removed superfluous logging. Fixed identifier mismatch. Removed superfluous parameter passed to function --- MMM-AlarmClock.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 01117e6..5c5937d 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -79,20 +79,18 @@ Module.register('MMM-AlarmClock', { fadeAlarm() { var max_volume = this.config.volume; var volume = 0; - var that = this; var volume_step = this.config.fade_step; var counter = 0; var myTimer = setInterval(() => { - document.getElementById('alarm_player').volume = volume; + document.getElementById('MMM-AlarmClock-Player').volume = volume; volume = volume + volume_step; - console.log(volume); counter = counter + 1000; if (volume >= max_volume) { - document.getElementById(that.identifier).volume = max_volume; + document.getElementById('MMM-AlarmClock-Player').volume = max_volume; clearInterval(myTimer); } - if (counter >= that.config.fade_timer) { - document.getElementById('alarm_player').volume = max_volume; + if (counter >= this.config.fade_timer) { + document.getElementById('MMM-AlarmClock-Player').volume = max_volume; clearInterval(myTimer); } }, 1000); @@ -166,7 +164,7 @@ Module.register('MMM-AlarmClock', { wrapper.appendChild(text); } else if (this.alarmFired) { const sound = document.createElement('audio'); - sound.setAttribute('id', 'alarm_player'); + sound.setAttribute('id', 'MMM-AlarmClock-Player'); if (this.config.sound.match(/^https?:\/\//)) { sound.src = this.config.sound; } else { @@ -176,7 +174,7 @@ Module.register('MMM-AlarmClock', { sound.setAttribute('autoplay', true); sound.setAttribute('loop', true); if (this.config.fade == true) { - this.fadeAlarm(sound); + this.fadeAlarm(); } wrapper.appendChild(sound); } else { From 0eef75ed4eb4735fd5146aff3198b6b481782a4d Mon Sep 17 00:00:00 2001 From: fewieden Date: Thu, 20 Apr 2017 17:46:16 +0200 Subject: [PATCH 07/12] undo unrelated changes --- MMM-AlarmClock.js | 1 + 1 file changed, 1 insertion(+) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 13a056d..402a7ea 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -124,6 +124,7 @@ Module.register('MMM-AlarmClock', { getDom() { const wrapper = document.createElement('div'); const header = document.createElement('header'); + header.classList.add('align-left'); const logo = document.createElement('i'); logo.classList.add('fa', 'fa-bell-o', 'logo'); From 8eb18508c4c878b70cbcf3e66a94663a508f3550 Mon Sep 17 00:00:00 2001 From: fewieden Date: Thu, 20 Apr 2017 18:22:08 +0200 Subject: [PATCH 08/12] add path to french translations --- MMM-AlarmClock.js | 1 + 1 file changed, 1 insertion(+) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 402a7ea..f4961f8 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -32,6 +32,7 @@ Module.register('MMM-AlarmClock', { return { en: 'translations/en.json', de: 'translations/de.json', + fr: 'translations/fr.json', id: 'translations/id.json' }; }, From 7be38a4e2019f35973b9ccdc3ba8fcdf08a93d4a Mon Sep 17 00:00:00 2001 From: fewieden Date: Fri, 21 Apr 2017 11:02:11 +0200 Subject: [PATCH 09/12] fix travis checks --- MMM-AlarmClock.js | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 5c5937d..608a0c7 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -19,8 +19,8 @@ Module.register('MMM-AlarmClock', { format: 'ddd, h:mmA', timer: 60 * 1000, // one minute fade: false, - fade_timer: 60 * 1000, // 60 seconds - fade_step: .005, // .5% + fadeTimer: 60 * 1000, // 60 seconds + fadeStep: 0.005 // 0.5% }, getStyles() { @@ -77,20 +77,16 @@ Module.register('MMM-AlarmClock', { }, fadeAlarm() { - var max_volume = this.config.volume; - var volume = 0; - var volume_step = this.config.fade_step; - var counter = 0; - var myTimer = setInterval(() => { + const maxVolume = this.config.volume; + const volumeStep = this.config.fadeStep; + let volume = 0; + let counter = 0; + let myTimer = setInterval(() => { document.getElementById('MMM-AlarmClock-Player').volume = volume; - volume = volume + volume_step; - counter = counter + 1000; - if (volume >= max_volume) { - document.getElementById('MMM-AlarmClock-Player').volume = max_volume; - clearInterval(myTimer); - } - if (counter >= this.config.fade_timer) { - document.getElementById('MMM-AlarmClock-Player').volume = max_volume; + volume += volumeStep; + counter += 1000; + if (volume >= maxVolume || counter >= this.config.fadeTimer) { + document.getElementById('MMM-AlarmClock-Player').volume = maxVolume; clearInterval(myTimer); } }, 1000); @@ -173,7 +169,7 @@ Module.register('MMM-AlarmClock', { sound.volume = this.config.volume; sound.setAttribute('autoplay', true); sound.setAttribute('loop', true); - if (this.config.fade == true) { + if (this.config.fade === true) { this.fadeAlarm(); } wrapper.appendChild(sound); From 6f5d8cf3296b24adb005c314ccbfa8da6c3bfaaa Mon Sep 17 00:00:00 2001 From: fewieden Date: Fri, 21 Apr 2017 11:03:23 +0200 Subject: [PATCH 10/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8045df3..2069523 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ Alarm Clock Module for MagicMirror2 | `format` | `'ddd, h:mmA'` | In which format the alarm in the header should be displayed. [All Options](http://momentjs.com/docs/#/displaying/format/) | | `timer` | `60000` (1 min) | How long the alarm should ring for non touch screen or without interaction on touch screen devices. | | `fade` | `false` | Set to enable a gradual fade-in of the alarm sound. -| `fade_timer` | `60 * 1000` (1 min) | How long to fade into the alarm before `volume` is set. -| `fade_step` | `.005` (.5%) | Increase the volume this percent amount each second until `fade_timer` is reached. +| `fadeTimer` | `60 * 1000` (1 min) | How long to fade into the alarm before `volume` is set. +| `fadeStep` | `.005` (.5%) | Increase the volume this percent amount each second until `fadeTimer` is reached. ## Alarm Sounds From 9a8b362968e22862f0dcffdcc1c90685828e5f54 Mon Sep 17 00:00:00 2001 From: fewieden Date: Fri, 21 Apr 2017 13:02:14 +0200 Subject: [PATCH 11/12] added templates --- .github/CONTRIBUTING.md | 8 ++++++++ .github/ISSUE_TEMPLATE.md | 9 +++++++++ .github/PULL_REQUEST_TEMPLATE.md | 5 +++++ 3 files changed, 22 insertions(+) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..5956f32 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..5bbae68 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +Platform (Hardware/OS): + +Node version: + +MagicMirror version: + +Module version: + +Description of the issue: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..63fa699 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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. From 5dda98476de8dde7087306974173f330a422f4f4 Mon Sep 17 00:00:00 2001 From: fewieden Date: Fri, 21 Apr 2017 13:03:28 +0200 Subject: [PATCH 12/12] fixed volume fade in for touch support and first second, added documentation --- .doclets.yml | 9 +++ .eslintignore | 1 + .gitignore | 8 +++ CHANGELOG.md | 19 ++++++ MMM-AlarmClock.js | 152 +++++++++++++++++++++++++++++++++++++++++----- README.md | 11 +++- jsdoc.json | 18 ++++++ package.json | 6 +- 8 files changed, 206 insertions(+), 18 deletions(-) create mode 100644 .doclets.yml create mode 100644 .eslintignore create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 jsdoc.json diff --git a/.doclets.yml b/.doclets.yml new file mode 100644 index 0000000..f8b3f58 --- /dev/null +++ b/.doclets.yml @@ -0,0 +1,9 @@ +dir: . +packageJson: package.json +articles: + - Overview: README.md + - Changelog: CHANGELOG.md + - License: LICENSE +branches: + - master + - develop diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..a188e06 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +docs/* diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a19034 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.log +npm-debug.log* + +node_modules/ + +.idea/ + +docs/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..abe492e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# MMM-AlarmClock Changelog + +## [1.1.0] + +### Added + +* Volume fade in (see config options fade, fadeTimer and fadeStep). +* French translations +* Indonesian translations +* Documentation +* [Doclets.io](https://doclets.io/fewieden/MMM-AlarmClock/master) integration +* Contributing guidelines +* Issue template +* Pull request template +* gitignore + +## [1.0.0] + +Initial version diff --git a/MMM-AlarmClock.js b/MMM-AlarmClock.js index 884bc74..21e7028 100644 --- a/MMM-AlarmClock.js +++ b/MMM-AlarmClock.js @@ -1,17 +1,72 @@ -/* global Module Log config moment MM */ - -/* Magic Mirror - * Module: MMM-AlarmClock +/** + * @file MMM-AlarmClock.js + * + * @author fewieden + * @license MIT * - * By fewieden https://github.com/fewieden/MMM-AlarmClock - * MIT Licensed. + * @see https://github.com/fewieden/MMM-AlarmClock + */ + +/* global Module Log moment config MM */ + +/** + * @external Module + * @see https://github.com/MichMich/MagicMirror/blob/master/js/module.js + */ + +/** + * @external Log + * @see https://github.com/MichMich/MagicMirror/blob/master/js/logger.js + */ + +/** + * @external moment + * @see https://www.npmjs.com/package/moment + */ + +/** + * @external config + * @see https://github.com/MichMich/MagicMirror/blob/master/config/config.js.sample + */ + +/** + * @external MM + * @see https://github.com/MichMich/MagicMirror/blob/master/js/main.js */ +/** + * @module MMM-AlarmClock + * @description Frontend for the module to display data. + * + * @requires external:Module + * @requires external:Log + * @requires external:moment + * @requires external:config + * @requires external:MM + */ Module.register('MMM-AlarmClock', { + /** @member {?Object} next - Contains the next alarm object. */ next: null, + /** @member {boolean} alarmFired - Flag that indicates if there is a alarm firing right now. */ alarmFired: false, + /** @member {?Timeout} timer - Fires resetAlarmClock */ + timer: null, + /** @member {?Interval} fadeInterval - Fades in the alarm volume. */ + fadeInterval: null, + + /** + * @member {Object} defaults - Defines the default config values. + * @property {string} sound - Alarm sound file. + * @property {boolean} touch - Flag to enable touch support. + * @property {number} volume - Alarm sound volume. + * @property {string} format - Alarm datetime format to display in UI. + * @property {int} timer - Alarm sound duration. + * @property {boolean} fade - Flag to fade in alarm sound volume. + * @property {int} fadeTimer - Fade in duration. + * @property {number} fadeStep - Fade in volume steps. + */ defaults: { sound: 'alarm.mp3', touch: false, @@ -23,14 +78,35 @@ Module.register('MMM-AlarmClock', { fadeStep: 0.005 // 0.5% }, + /** + * @function getStyles + * @description Style dependencies for this module. + * @override + * + * @returns {string[]} List of the style dependency filepaths. + */ getStyles() { return ['font-awesome.css', 'MMM-AlarmClock.css']; }, + /** + * @function getScripts + * @description Script dependencies for this module. + * @override + * + * @returns {string[]} List of the script dependency filepaths. + */ getScripts() { return ['moment.js']; }, + /** + * @function getTranslations + * @description Translations for this module. + * @override + * + * @returns {Object.} Available translations for this module (key: language code, value: filepath). + */ getTranslations() { return { en: 'translations/en.json', @@ -40,6 +116,11 @@ Module.register('MMM-AlarmClock', { }; }, + /** + * @function start + * @description Sets first alarm and creates interval to check the alarm event. + * @override + */ start() { Log.info(`Starting module: ${this.name}`); this.setNextAlarm(); @@ -49,6 +130,10 @@ Module.register('MMM-AlarmClock', { moment.locale(config.language); }, + /** + * @function checkAlarm + * @description Checks the alarm event and triggers the alert. + */ checkAlarm() { if (!this.alarmFired && this.next && moment().diff(this.next.moment) >= 0) { const alert = { @@ -70,6 +155,7 @@ Module.register('MMM-AlarmClock', { if (module.name === 'alert') { module.alerts['MMM-AlarmClock'].ntf.addEventListener('click', () => { clearTimeout(this.timer); + clearTimeout(this.fadeInterval); this.resetAlarmClock(); }); } @@ -78,22 +164,29 @@ Module.register('MMM-AlarmClock', { } }, + /** + * @function fadeAlarm + * @description Fades in the alarm sound step by step. + */ fadeAlarm() { - const maxVolume = this.config.volume; - const volumeStep = this.config.fadeStep; let volume = 0; let counter = 0; - let myTimer = setInterval(() => { - document.getElementById('MMM-AlarmClock-Player').volume = volume; - volume += volumeStep; + this.fadeInterval = setInterval(() => { + const player = document.getElementById('MMM-AlarmClock-Player'); + player.volume = volume; + volume += this.config.fadeStep; counter += 1000; - if (volume >= maxVolume || counter >= this.config.fadeTimer) { - document.getElementById('MMM-AlarmClock-Player').volume = maxVolume; - clearInterval(myTimer); + if (volume >= this.config.volume || counter >= this.config.fadeTimer) { + player.volume = this.config.volume; + clearInterval(this.fadeInterval); } }, 1000); }, + /** + * @function setNextAlarm + * @description Sets the next occurring alarm event. + */ setNextAlarm() { this.next = null; for (let i = 0; i < this.config.alarms.length; i += 1) { @@ -105,6 +198,10 @@ Module.register('MMM-AlarmClock', { } }, + /** + * @function resetAlarmClock + * @description Resets the alarm clock. + */ resetAlarmClock() { this.alarmFired = false; if (this.config.touch) { @@ -114,6 +211,24 @@ Module.register('MMM-AlarmClock', { this.updateDom(300); }, + /** + * @function getMoment + * @description Creates a moment object based on alarm event. + * + * @param {Object} alarm - Alarm event. + * @param {string} alarm.time - Alarm event time. + * @param {int[]} alarm.days - Weekdays the alarm event occurrs. + * + * @returns {Object} Moment object for the next occurrence of this alarm event. + * + * @example alarm object + * { + * time: "18:30", + * days: [2,4], + * title: "Soccer", + * message: "Get ready for soccer training!" + * } + */ getMoment(alarm) { const now = moment(); let difference = Math.min(); @@ -141,6 +256,13 @@ Module.register('MMM-AlarmClock', { }); }, + /** + * @function getDom + * @description Creates the UI as DOM for displaying in MagicMirror application. + * @override + * + * @returns {Element} + */ getDom() { const wrapper = document.createElement('div'); const header = document.createElement('header'); @@ -168,7 +290,7 @@ Module.register('MMM-AlarmClock', { } else { sound.src = this.file(`sounds/${this.config.sound}`); } - sound.volume = this.config.volume; + sound.volume = this.config.fade ? 0 : this.config.volume; sound.setAttribute('autoplay', true); sound.setAttribute('loop', true); if (this.config.fade === true) { diff --git a/README.md b/README.md index 2069523..5d9647b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MMM-AlarmClock [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/fewieden/MMM-AlarmClock/master/LICENSE) [![Build Status](https://travis-ci.org/fewieden/MMM-AlarmClock.svg?branch=master)](https://travis-ci.org/fewieden/MMM-AlarmClock) [![Code Climate](https://codeclimate.com/github/fewieden/MMM-AlarmClock/badges/gpa.svg?style=flat)](https://codeclimate.com/github/fewieden/MMM-AlarmClock) [![Known Vulnerabilities](https://snyk.io/test/github/fewieden/mmm-alarmclock/badge.svg)](https://snyk.io/test/github/fewieden/mmm-alarmclock) +# MMM-AlarmClock [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/fewieden/MMM-AlarmClock/master/LICENSE) [![Build Status](https://travis-ci.org/fewieden/MMM-AlarmClock.svg?branch=master)](https://travis-ci.org/fewieden/MMM-AlarmClock) [![Code Climate](https://codeclimate.com/github/fewieden/MMM-AlarmClock/badges/gpa.svg?style=flat)](https://codeclimate.com/github/fewieden/MMM-AlarmClock) [![Known Vulnerabilities](https://snyk.io/test/github/fewieden/mmm-alarmclock/badge.svg)](https://snyk.io/test/github/fewieden/mmm-alarmclock) [![API Doc](https://doclets.io/fewieden/MMM-AlarmClock/master.svg)](https://doclets.io/fewieden/MMM-AlarmClock/master) Alarm Clock Module for MagicMirror2 @@ -49,3 +49,12 @@ There are already two alarm sounds: * [alarm.mp3](http://www.orangefreesounds.com/mp3-alarm-clock/) | From Alexander licensed under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) * [blackforest.mp3](http://www.orangefreesounds.com/coo-coo-clock-sound/) | From Alexander licensed under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) + +## Developer + +* `npm run lint` - Lints JS and CSS files. +* `npm run docs` - Generates documentation. + +### Documentation + +The documentation can be found [here](https://doclets.io/fewieden/MMM-AlarmClock/master) diff --git a/jsdoc.json b/jsdoc.json new file mode 100644 index 0000000..7c46152 --- /dev/null +++ b/jsdoc.json @@ -0,0 +1,18 @@ +{ + "tags": { + "dictionaries": ["jsdoc"] + }, + "source": { + "include": [ + "package.json", + "README.md" + ], + "exclude": [ + "node_modules" + ] + }, + "opts": { + "destination": "docs", + "recurse": true + } +} diff --git a/package.json b/package.json index c4ddc7f..a5d6f7f 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "mmm-alarmclock", - "version": "1.0.0", + "version": "1.1.0", "description": "Alarm Clock Module for MagicMirror2", "scripts": { - "lint": "./node_modules/.bin/eslint . && ./node_modules/.bin/stylelint ." + "lint": "./node_modules/.bin/eslint . && ./node_modules/.bin/stylelint .", + "docs": "./node_modules/.bin/jsdoc -c jsdoc.json ." }, "repository": { "type": "git", @@ -23,6 +24,7 @@ "eslint": "^3.14.1", "eslint-config-airbnb-base": "^11.0.1", "eslint-plugin-import": "^2.2.0", + "jsdoc": "^3.4.3", "stylelint": "^7.8.0", "stylelint-config-standard": "^16.0.0" }