diff --git a/.doclets.yml b/.doclets.yml
deleted file mode 100644
index f8b3f58..0000000
--- a/.doclets.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-dir: .
-packageJson: package.json
-articles:
- - Overview: README.md
- - Changelog: CHANGELOG.md
- - License: LICENSE
-branches:
- - master
- - develop
diff --git a/.github/example.jpg b/.github/example.jpg
deleted file mode 100644
index 3e4c81b..0000000
Binary files a/.github/example.jpg and /dev/null differ
diff --git a/.github/example_focused.png b/.github/example_focused.png
deleted file mode 100644
index 3fcaaf2..0000000
Binary files a/.github/example_focused.png and /dev/null differ
diff --git a/.github/example_full.png b/.github/example_full.png
deleted file mode 100644
index 2d377fa..0000000
Binary files a/.github/example_full.png and /dev/null differ
diff --git a/.github/modal.png b/.github/modal.png
new file mode 100644
index 0000000..d7cc8c8
Binary files /dev/null and b/.github/modal.png differ
diff --git a/.github/regular.png b/.github/regular.png
new file mode 100644
index 0000000..6636347
Binary files /dev/null and b/.github/regular.png differ
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b52fa21..2ca05f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,29 @@
# MMM-soccer Changelog
+## [2.1.0]
+
+**Requires version > 2.14 of MagicMirror!**
+
+### Added
+
+* Integrated [MMM-Modal](https://github.com/fewieden/MMM-Modal)
+
+### Changed
+
+* Using remote logos
+* Preview pictures
+
+### Fixed
+
+* Fade effect
+* Focus_on in modal highlights correct team
+* Help modal shows correct voice commands
+
+### Removed
+
+* Logo downloader
+* Doclet integration
+
## [2.0.1]
### Added
diff --git a/MMM-soccer.css b/MMM-soccer.css
index 5a7465f..74128ce 100644
--- a/MMM-soccer.css
+++ b/MMM-soccer.css
@@ -19,25 +19,11 @@
vertical-align: middle;
}
-.MMM-soccer .centered {
- text-align: center;
+.MMM-soccer .space-between {
+ display: flex;
+ justify-content: space-between;
}
-.MMM-soccer-blur {
- -webkit-filter: blur(2px) brightness(50%);
-}
-
-.MMM-soccer .modal {
- position: fixed;
- text-align: left;
- left: 50%;
- top: 50%;
- -webkit-transform: translate(-50%, -50%);
- -moz-transform: translate(-50%, -50%);
- -o-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
-}
-
-.MMM-soccer .modal ul {
- margin: 0;
+.MMM-soccer .centered {
+ text-align: center;
}
diff --git a/MMM-soccer.js b/MMM-soccer.js
index 350fd96..aad3524 100644
--- a/MMM-soccer.js
+++ b/MMM-soccer.js
@@ -27,6 +27,11 @@
* @requires external:Log
*/
Module.register('MMM-soccer', {
+ /**
+ * @member {string} requiresVersion - Defines the required minimum version of the MagicMirror framework in order to run this verion of the module.
+ */
+ requiresVersion: '2.14.0',
+
/**
* @member {Object} defaults - Defines the default config values.
* @property {boolean|string} api_key - API acces key for football-data.org.
@@ -53,16 +58,6 @@ Module.register('MMM-soccer', {
}
},
- /**
- * @member {Object} modals - Stores the status of the module's modals.
- * @property {boolean} standings - Full standings table.
- * @property {boolean} help - List of voice commands of this module.
- */
- modals: {
- standings: false,
- help: false
- },
-
/**
* @member {Object} voice - Defines the default mode and commands of this module.
* @property {string} mode - Voice mode of this module.
@@ -129,7 +124,7 @@ Module.register('MMM-soccer', {
this.season = payload.season;
this.competition = payload.competition;
this.loading = false;
- this.updateDom();
+ this.updateDom(300);
}
},
@@ -144,15 +139,16 @@ Module.register('MMM-soccer', {
*/
notificationReceived(notification, payload, sender) {
if (notification === 'ALL_MODULES_STARTED') {
- const voice = Object.assign({}, this.voice);
- voice.sentences.push(Object.keys(this.config.leagues).join(' '));
- this.sendNotification('REGISTER_VOICE_MODULE', voice);
+ const leagues = Object.keys(this.config.leagues).join(' ');
+ this.sendNotification('REGISTER_VOICE_MODULE', {
+ mode: this.voice.mode,
+ sentences: [...this.voice.sentences, leagues]
+ });
} else if (notification === 'VOICE_SOCCER' && sender.name === 'MMM-voice') {
- this.checkCommands(payload);
+ this.executeVoiceCommands(payload);
} else if (notification === 'VOICE_MODE_CHANGED' && sender.name === 'MMM-voice'
&& payload.old === this.voice.mode) {
- this.closeAllModals();
- this.updateDom(300);
+ this.sendNotification('CLOSE_MODAL');
}
},
@@ -192,7 +188,7 @@ Module.register('MMM-soccer', {
* @returns {string} Path to nunjuck template.
*/
getTemplate() {
- return 'MMM-soccer.njk';
+ return 'templates/MMM-soccer.njk';
},
/**
@@ -207,83 +203,105 @@ Module.register('MMM-soccer', {
boundaries: this.calculateTeamDisplayBoundaries(),
competitionName: this.competition.name || this.name,
config: this.config,
- isModalActive: this.isModalActive(),
- modals: this.modals,
- season: this.season ?
- `${this.translate('MATCHDAY')}: ${this.season.currentMatchday || 'N/A'}` : this.translate('LOADING'),
+ matchDayNumber: this.season ? this.season.currentMatchday : 'N/A',
standing: this.standing,
- voice: this.voice
+ loading: this.loading
};
},
/**
- * @function handleModals
- * @description Hide/show modules based on voice commands.
+ * @function handleHelpModal
+ * @description Opens/closes help modal based on voice commands.
+ *
+ * @param {string} data - Text with commands.
+ *
+ * @returns {void}
*/
- handleModals(data, modal, open, close) {
- if (close.test(data) || (this.modals[modal] && !open.test(data))) {
- this.closeAllModals();
- } else if (open.test(data) || (!this.modals[modal] && !close.test(data))) {
- this.closeAllModals();
- this.modals[modal] = true;
- }
-
- const modules = document.querySelectorAll('.module');
- for (let i = 0; i < modules.length; i += 1) {
- if (!modules[i].classList.contains('MMM-soccer')) {
- if (this.isModalActive()) {
- modules[i].classList.add('MMM-soccer-blur');
- } else {
- modules[i].classList.remove('MMM-soccer-blur');
+ handleHelpModal(data) {
+ if (/(CLOSE)/g.test(data) && !/(OPEN)/g.test(data)) {
+ this.sendNotification('CLOSE_MODAL');
+ } else if (/(OPEN)/g.test(data) && !/(CLOSE)/g.test(data)) {
+ this.sendNotification('OPEN_MODAL', {
+ template: 'templates/HelpModal.njk',
+ data: {
+ ...this.voice,
+ fns: {
+ translate: this.translate.bind(this)
+ }
}
- }
+ });
}
},
/**
- * @function closeAllModals
- * @description Close all modals of the module.
+ * @function handleStandingsModal
+ * @description Opens/closes standing modal based on voice commands.
+ *
+ * @param {string} data - Text with commands.
+ *
+ * @returns {void}
*/
- closeAllModals() {
- const modals = Object.keys(this.modals);
- modals.forEach((modal) => { this.modals[modal] = false; });
+ handleStandingsModal(data) {
+ if (/(COLLAPSE)/g.test(data) && !/(EXPAND)/g.test(data)) {
+ this.sendNotification('CLOSE_MODAL');
+ } else if (/(EXPAND)/g.test(data) && !/(COLLAPSE)/g.test(data)) {
+ this.sendNotification('OPEN_MODAL', {
+ template: 'templates/StandingsModal.njk',
+ data: {
+ ...this.getTemplateData(),
+ fns: {
+ translate: this.translate.bind(this)
+ }
+ }
+ });
+ }
},
/**
- * @function isModalActive
- * @description Checks if at least one modal is active.
+ * @function handleLeagueSwitch
+ * @description Sitches the soccer league based on voice commands.
+ *
+ * @param {string} data - Text with commands.
*
- * @returns {boolean} Flag if there is an active modal.
+ * @returns {void}
*/
- isModalActive() {
- const modals = Object.keys(this.modals);
- return modals.some(modal => this.modals[modal] === true);
+ handleLeagueSwitch(data) {
+ const countrys = Object.keys(this.config.leagues);
+
+ for (let i = 0; i < countrys.length; i += 1) {
+ const regexp = new RegExp(countrys[i], 'g');
+
+ if (regexp.test(data)) {
+ this.sendNotification('CLOSE_MODAL');
+
+ if (this.currentLeague !== this.config.leagues[countrys[i]]) {
+ this.currentLeague = this.config.leagues[countrys[i]];
+ this.getData();
+ }
+
+ break;
+ }
+ }
+
+ this.updateDom(300);
},
/**
- * @function checkCommands
- * @description Voice command handler.
+ * @function executeVoiceCommands
+ * @description Executes the voice commands.
+ *
+ * @param {string} data - Text with commands.
+ *
+ * @returns {void}
*/
- checkCommands(data) {
+ executeVoiceCommands(data) {
if (/(HELP)/g.test(data)) {
- this.handleModals(data, 'help', /(OPEN)/g, /(CLOSE)/g);
+ this.handleHelpModal(data);
} else if (/(VIEW)/g.test(data)) {
- this.handleModals(data, 'standings', /(EXPAND)/g, /(COLLAPSE)/g);
+ this.handleStandingsModal(data);
} else if (/(STANDINGS)/g.test(data)) {
- const countrys = Object.keys(this.config.leagues);
- for (let i = 0; i < countrys.length; i += 1) {
- const regexp = new RegExp(countrys[i], 'g');
- if (regexp.test(data)) {
- this.closeAllModals();
- if (this.currentLeague !== this.config.leagues[countrys[i]]) {
- this.currentLeague = this.config.leagues[countrys[i]];
- this.getData();
- }
- break;
- }
- }
+ this.handleLeagueSwitch(data);
}
- this.updateDom(300);
},
/**
@@ -293,7 +311,7 @@ Module.register('MMM-soccer', {
* @returns {boolean}
*/
isMaxTeamsLessAll() {
- return (this.config.max_teams && this.config.max_teams <= this.standing.length);
+ return this.config.max_teams && this.config.max_teams <= this.standing.length;
},
/**
@@ -380,6 +398,8 @@ Module.register('MMM-soccer', {
/**
* @function addFilters
* @description Adds the filter used by the nunjuck template.
+ *
+ * @returns {void}
*/
addFilters() {
this.nunjucksEnvironment().addFilter('fade', (index, focus) => {
diff --git a/MMM-soccer.njk b/MMM-soccer.njk
deleted file mode 100644
index 8a8c34e..0000000
--- a/MMM-soccer.njk
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
- {% if loading %}
- {{'LOADING' | translate}}
- {% else %}
-
-
{{season}}
-
-
-
- |
- {% if config.logos %}
- |
- {% endif %}
- {{'TEAM' | translate}} |
- |
- |
-
-
-
- {% for index in range(boundaries.firstTeam, boundaries.lastTeam) %}
-
- {{standing[index].position}} |
- {% if config.logos %}
- |
- {% endif %}
- {{standing[index].team.name}} |
- {{standing[index].points}} |
- {{standing[index].goalDifference}} |
-
- {% endfor %}
-
-
- {% endif %}
-
- {% if isModalActive %}
-
- {% if modal.standings %}
-
-
-
- |
- {% if config.logos %}
- |
- {% endif %}
- {{'TEAM' | translate}} |
- |
- |
-
-
-
- {% for entry in standing %}
-
- {{entry.position}} |
- {% if config.logos %}
- |
- {% endif %}
- {{entry.team.name}} |
- {{entry.points}} |
- {{entry.goalDifference}} |
-
- {% endfor %}
-
-
- {% else %}
-
{{competitionName}} - {{'COMMAND_LIST' | translate}}
-
{{'MODE' | translate}}: {{voice.mode}}
-
{{'VOICE_COMMANDS' | translate}}
-
- {% for sentence in voice.sentences %}
- - {{sentence}}
- {% endfor %}
-
- {% endif %}
-
- {% endif %}
-
diff --git a/README.md b/README.md
index 37982d2..4be71cb 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,15 @@
-# MMM-soccer [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/fewieden/MMM-soccer/master/LICENSE) [![Build Status](https://travis-ci.org/fewieden/MMM-soccer.svg?branch=master)](https://travis-ci.org/fewieden/MMM-soccer) [![Code Climate](https://codeclimate.com/github/fewieden/MMM-soccer/badges/gpa.svg?style=flat)](https://codeclimate.com/github/fewieden/MMM-soccer) [![Known Vulnerabilities](https://snyk.io/test/github/fewieden/mmm-soccer/badge.svg)](https://snyk.io/test/github/fewieden/mmm-soccer) [![API Doc](https://doclets.io/fewieden/MMM-soccer/master.svg)](https://doclets.io/fewieden/MMM-soccer/master)
+# MMM-soccer [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/fewieden/MMM-soccer/master/LICENSE) [![Build Status](https://travis-ci.org/fewieden/MMM-soccer.svg?branch=master)](https://travis-ci.org/fewieden/MMM-soccer) [![Code Climate](https://codeclimate.com/github/fewieden/MMM-soccer/badges/gpa.svg?style=flat)](https://codeclimate.com/github/fewieden/MMM-soccer) [![Known Vulnerabilities](https://snyk.io/test/github/fewieden/mmm-soccer/badge.svg)](https://snyk.io/test/github/fewieden/mmm-soccer)
European Soccer Standings Module for MagicMirror²
## Example
-![](.github/example_full.png) ![](.github/example_focused.png)
-![](.github/example.jpg)
+![](.github/regular.png) ![](.github/modal.png)
## Dependencies
* An installation of [MagicMirror²](https://github.com/MichMich/MagicMirror)
-* OPTIONAL: [Voice Control](https://github.com/fewieden/MMM-voice)
+* OPTIONAL: [Voice Control](https://github.com/fewieden/MMM-voice) and [MMM-Modal](https://github.com/fewieden/MMM-Modal)
* npm
* [request](https://www.npmjs.com/package/request)
@@ -44,25 +43,10 @@ European Soccer Standings Module for MagicMirror²
| `leagues` | `{"GERMANY": "BL1", "FRANCE": "FL1", "ENGLAND": "PL", "SPAIN": "PD", "ITALY": "SA"}` | A collection of leagues obtained from |
| `logos` | `false` | Boolean to show club logos or not. |
-## Logos
+## OPTIONAL: Voice Control and Modal
-As the v2 api doesn't provide logos anymore, I developed a club logo downloader. It supports the five major leagues as above named.
-To run the downloader you need to execute the following steps.
-
-1. Go to the module directory `cd ~/MagicMirror/modules/MMM-soccer`.
-1. Execute `node scripts/downloader COUNTRYNAME`.
-1. Run this command for all the leagues you want to display on the mirror.
-1. Don't forget to activate the display of the logos in the config.
-
-If there isn't every club logo, you can also place them manually in the public directory of the module,
-the logos need to be in `svg` format and the name of the file has to match the displayed name.
-
-## OPTIONAL: Voice Control
-
-This module supports voice control by
-[MMM-voice](https://github.com/fewieden/MMM-voice). In order to use this
-feature, it's required to install the voice module. There are no extra config
-options for voice control needed.
+This module supports voice control by [MMM-voice](https://github.com/fewieden/MMM-voice) and [MMM-Modal](https://github.com/fewieden/MMM-Modal).
+In order to use this feature, it's required to install the voice and modal modules. There are no extra config options for voice control and modals needed.
### Mode
@@ -78,3 +62,8 @@ The voice control mode for this module is `SOCCER`
you have to edit the config)
* EXPAND VIEW -> Expands the standings table and shows all teams.
* COLLAPSE VIEW -> Collapse the expanded view.
+
+## Developer
+
+* `npm run lint` - Lints JS and CSS files.
+* `npm run docs` - Generates documentation.
diff --git a/package.json b/package.json
index 0ffaea7..8928322 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mmm-soccer",
- "version": "2.0.1",
+ "version": "2.1.0",
"description": "European Soccer Standings Module for MagicMirror2",
"repository": {
"type": "git",
diff --git a/scripts/downloader.js b/scripts/downloader.js
deleted file mode 100644
index 1363480..0000000
--- a/scripts/downloader.js
+++ /dev/null
@@ -1,137 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-const request = require('request');
-
-const leagues = {
- GERMANY: 452,
- FRANCE: 450,
- ENGLAND: 445,
- SPAIN: 455,
- ITALY: 456
-};
-
-if (process.argv.length <= 2) {
- throw new Error('You need to specify a country name!');
-}
-
-const country = process.argv[2].toUpperCase();
-
-if (!Object.prototype.hasOwnProperty.call(leagues, country)) {
- throw new Error('Selected country is not supported!');
-}
-
-const options = {
- url: `http://api.football-data.org/v1/competitions/${leagues[country]}/leagueTable`
-};
-
-const missingTeams = {
- GERMANY: ['1. FC Nürnberg', 'TSV Fortuna 95 Düsseldorf'],
- FRANCE: ['En Avant Guingamp', 'Nîmes Olympique', 'Stade de Reims'],
- ENGLAND: ['Cardiff City FC', 'Fulham FC', 'Wolverhampton Wanderers FC'],
- SPAIN: ['Rayo Vallecano de Madrid', 'Real Valladolid CF', 'SD Huesca'],
- ITALY: ['Empoli FC', 'Frosinone Calcio', 'Parma Calcio 1913']
-};
-
-function extendTeams(teams) {
- missingTeams[country].forEach((name) => {
- teams.push({ teamName: name });
- });
-}
-
-const iconFixes = {
- // Germany
- '1. FC Nürnberg': 'https://upload.wikimedia.org/wikipedia/commons/5/56/FC_N%C3%BCrnberg.svg',
- 'Bor. Mönchengladbach': 'https://upload.wikimedia.org/wikipedia/commons/8/81/Borussia_M%C3%B6nchengladbach_logo.svg',
- 'FC Bayern München': 'https://upload.wikimedia.org/wikipedia/commons/1/1f/Logo_FC_Bayern_M%C3%BCnchen_%282002%E2%80%932017%29.svg',
- 'TSV Fortuna 95 Düsseldorf': 'https://upload.wikimedia.org/wikipedia/commons/9/94/Fortuna_D%C3%BCsseldorf.svg',
- // France
- 'En Avant Guingamp': 'https://vignette.wikia.nocookie.net/logopedia/images/9/99/En_Avant_de_Guingamp_logo.svg',
- 'Nîmes Olympique': 'https://upload.wikimedia.org/wikipedia/fr/f/f0/N%C3%AEmes_Olympique_logo_2018.svg',
- 'OGC Nice': 'https://upload.wikimedia.org/wikipedia/de/5/58/OGC_Nizza_Logo.svg',
- 'OSC Lille': 'https://vignette.wikia.nocookie.net/logopedia/images/a/ab/Lille_OSC_logo.svg',
- 'SM Caen': 'https://upload.wikimedia.org/wikipedia/commons/6/64/SM_Caen.svg',
- 'Stade de Reims': 'https://upload.wikimedia.org/wikipedia/de/9/9e/Stade_Reims_Logo.svg',
- // England
- 'Burnley FC': 'https://upload.wikimedia.org/wikipedia/de/4/49/FC_Burnley.svg',
- 'Cardiff City FC': 'https://upload.wikimedia.org/wikipedia/de/1/18/Cardiff_City_AFC.svg',
- 'Crystal Palace FC': 'https://upload.wikimedia.org/wikipedia/de/f/fc/Crystal_Palace_FC.svg',
- 'Fulham FC': 'https://upload.wikimedia.org/wikipedia/de/a/a8/Fulham_fc.svg',
- 'Leicester City FC': 'https://upload.wikimedia.org/wikipedia/de/b/b6/Leicester_City.svg',
- 'Wolverhampton Wanderers FC': 'https://upload.wikimedia.org/wikipedia/de/1/1d/Wolverhampton_wanderers.svg',
- // Spain
- 'CD Leganes': 'https://svgur.com/i/890.svg',
- 'Málaga CF': 'https://upload.wikimedia.org/wikipedia/de/e/e8/FC_M%C3%A1laga.svg',
- 'Rayo Vallecano de Madrid': 'https://upload.wikimedia.org/wikipedia/de/1/12/Rayo_vallecano_madrid.svg',
- 'RC Deportivo La Coruna': 'https://upload.wikimedia.org/wikipedia/de/b/b9/Deportivo_La_Coruna.svg',
- 'Real Sociedad de Fútbol': 'https://upload.wikimedia.org/wikipedia/de/5/55/Real_Sociedad_San_Sebasti%C3%A1n.svg',
- 'Real Valladolid CF': 'https://upload.wikimedia.org/wikipedia/de/6/6e/Real_Valladolid_Logo.svg',
- 'SD Huesca': 'https://upload.wikimedia.org/wikipedia/de/7/71/SD_Huesca.svg',
- 'Sevilla FC': 'https://upload.wikimedia.org/wikipedia/de/c/c0/FC_Sevilla.svg',
- // Italy
- 'Benevento Calcio': 'https://upload.wikimedia.org/wikipedia/de/4/48/Benevento_Calcio_Logo.svg',
- 'Empoli FC': 'https://upload.wikimedia.org/wikipedia/de/4/42/Logo_FC_Empoli.svg',
- 'FC Internazionale Milano': 'https://upload.wikimedia.org/wikipedia/commons/4/41/Inter_Mailand.svg',
- 'Frosinone Calcio': 'https://upload.wikimedia.org/wikipedia/de/2/2b/Frosinone_Calcio.svg',
- 'Parma Calcio 1913': 'https://upload.wikimedia.org/wikipedia/de/e/e2/FC_Parma.svg',
- 'SPAL Ferrara': 'https://upload.wikimedia.org/wikipedia/de/e/e7/SPAL_Ferrara.svg',
- 'SS Lazio': 'https://upload.wikimedia.org/wikipedia/sco/e/e4/SS_Lazio.svg',
- 'UC Sampdoria': 'https://upload.wikimedia.org/wikipedia/ro/c/c4/UC_Sampdoria.svg'
-};
-
-const renamedTeams = {
- // Germany
- 'Bayer Leverkusen': 'Bayer 04 Leverkusen',
- 'Borussia Dortmund': 'BV Borussia 09 Dortmund',
- 'Bor. Mönchengladbach': 'Borussia Mönchengladbach',
- 'Red Bull Leipzig': 'RB Leipzig',
- 'Werder Bremen': 'SV Werder Bremen',
- // France
- 'Dijon FCO': 'Dijon Football Côte d\'Or',
- 'Montpellier Hérault SC': 'Montpellier HSC',
- 'OGC Nice': 'OGC de Nice Côte d\'Azur',
- 'OSC Lille': 'Lille OSC',
- 'Paris Saint-Germain': 'Paris Saint-Germain FC',
- 'Stade Rennais FC': 'Stade Rennais FC 1901',
- // England
- 'Brighton & Hove Albion': 'Brighton & Hove Albion FC',
- 'Huddersfield Town': 'Huddersfield Town AFC',
- // Spain,
- 'RCD Espanyol': 'RCD Espanyol de Barcelona',
- 'Real Betis': 'Real Betis Balompié',
- // Italy
- 'Bologna FC': 'Bologna FC 1909',
- 'Juventus Turin': 'Juventus FC',
- 'SPAL Ferrara': 'SPAL 2013'
-};
-
-function download(uri, team, callback) {
- const filename = path.join(__dirname, '..', 'public', `${Object.prototype.hasOwnProperty.call(renamedTeams, team) ? renamedTeams[team] : team}.svg`);
- request(Object.prototype.hasOwnProperty.call(iconFixes, team) ? iconFixes[team] : uri)
- .pipe(fs.createWriteStream(filename))
- .on('close', () => callback(team));
-}
-
-let iconsCount = 0;
-
-function counter(team) {
- iconsCount -= 1;
- console.log(`Downloaded: ${team}`); // eslint-disable-line no-console
-
- if (iconsCount <= 0) {
- console.log('All icons downloaded'); // eslint-disable-line no-console
- process.exit(1);
- }
-}
-
-request(options, (error, response, body) => {
- if (response.statusCode === 200) {
- const parsedBody = JSON.parse(body);
- extendTeams(parsedBody.standing);
- iconsCount = parsedBody.standing.length;
-
- parsedBody.standing.forEach(({ teamName, crestURI }) => {
- const uri = Object.prototype.hasOwnProperty.call(iconFixes, teamName) ? iconFixes[teamName] : crestURI;
- download(uri, teamName, counter);
- });
- }
-});
diff --git a/templates/HelpModal.njk b/templates/HelpModal.njk
new file mode 100644
index 0000000..e3057d5
--- /dev/null
+++ b/templates/HelpModal.njk
@@ -0,0 +1,8 @@
+MMM-soccer
+{{ data.fns.translate("MODE") }}: {{ data.mode }}
+{{ data.fns.translate("VOICE_COMMANDS") }}:
+
+ {% for sentence in data.sentences %}
+ - {{ sentence }}
+ {% endfor %}
+
diff --git a/templates/MMM-soccer.njk b/templates/MMM-soccer.njk
new file mode 100644
index 0000000..7ef724a
--- /dev/null
+++ b/templates/MMM-soccer.njk
@@ -0,0 +1,34 @@
+{% if loading %}
+ {{ "LOADING" | translate | safe }}
+{% else %}
+
+ {{ competitionName }}
+ {{ "MATCHDAY" | translate({matchDayNumber: matchDayNumber}) }}
+
+
+
+
+ |
+ {% if config.logos %}
+ |
+ {% endif %}
+ {{ "TEAM" | translate }} |
+ |
+ |
+
+
+
+ {% for index in range(boundaries.firstTeam, boundaries.lastTeam) %}
+
+ {{ standing[index].position }} |
+ {% if config.logos %}
+ |
+ {% endif %}
+ {{ standing[index].team.name }} |
+ {{ standing[index].points }} |
+ {{ standing[index].goalDifference }} |
+
+ {% endfor %}
+
+
+{% endif %}
diff --git a/templates/StandingsModal.njk b/templates/StandingsModal.njk
new file mode 100644
index 0000000..5151828
--- /dev/null
+++ b/templates/StandingsModal.njk
@@ -0,0 +1,32 @@
+
+ {{ data.competitionName }}
+ {{ data.fns.translate("MATCHDAY", {matchDayNumber: data.matchDayNumber}) }}
+
+
+
+
+ |
+ {% if data.config.logos %}
+ |
+ {% endif %}
+ {{ data.fns.translate("TEAM") }} |
+ |
+ |
+
+
+
+ {% for entry in data.standing %}
+
+ {{ entry.position }} |
+ {% if data.config.logos %}
+ |
+ {% endif %}
+ {{ entry.team.name }} |
+ {{ entry.points }} |
+ {{ entry.goalDifference }} |
+
+ {% else %}
+ No entries |
+ {% endfor %}
+
+
diff --git a/translations/de.json b/translations/de.json
index b431072..caa5a16 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -1,9 +1,9 @@
{
"LOADING": "Lade...",
"NO_DATA_AVAILABLE": "Keine Daten verfügbar!",
- "MATCHDAY": "Spieltag",
+ "MATCHDAY": "{matchDayNumber}. Spieltag",
"TEAM": "Mannschaft",
"COMMAND_LIST": "Liste aller Sprachbefehle",
"MODE": "Modus",
"VOICE_COMMANDS": "Sprachbefehle"
-}
\ No newline at end of file
+}
diff --git a/translations/en.json b/translations/en.json
index 3935324..1875596 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -1,9 +1,9 @@
{
"LOADING": "loading...",
"NO_DATA_AVAILABLE": "No data available!",
- "MATCHDAY": "Matchday",
+ "MATCHDAY": "Matchday {matchDayNumber}",
"TEAM": "Team",
"COMMAND_LIST": "List of all Voice Commands",
"MODE": "Mode",
"VOICE_COMMANDS": "Voice Commands"
-}
\ No newline at end of file
+}
diff --git a/translations/fr.json b/translations/fr.json
index 176c5e3..50509fa 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -1,7 +1,7 @@
{
"LOADING": "Chargement...",
"NO_DATA_AVAILABLE": "Aucunes données disponibles!",
- "MATCHDAY": "Jour de Match",
+ "MATCHDAY": "Jour de Match {matchDayNumber}",
"TEAM": "Equipe",
"COMMAND_LIST": "Liste de toutes les commandes vocales",
"MODE": "Mode",
diff --git a/translations/id.json b/translations/id.json
index f8faee5..2aeb704 100644
--- a/translations/id.json
+++ b/translations/id.json
@@ -1,9 +1,9 @@
{
"LOADING": "memuat...",
"NO_DATA_AVAILABLE": "Data tidak tersedia!",
- "MATCHDAY": "Jadwal",
+ "MATCHDAY": "Jadwal {matchDayNumber}",
"TEAM": "Tim",
"COMMAND_LIST": "Daftar semua Perintah Suara",
"MODE": "Mode",
"VOICE_COMMANDS": "Perintah Suara"
-}
\ No newline at end of file
+}
diff --git a/translations/sv.json b/translations/sv.json
index b832f00..853ad24 100644
--- a/translations/sv.json
+++ b/translations/sv.json
@@ -1,7 +1,7 @@
{
"LOADING": "laddar...",
"NO_DATA_AVAILABLE": "Ingen data tillänglig!",
- "MATCHDAY": "Matchdag",
+ "MATCHDAY": "Matchdag {matchDayNumber}",
"TEAM": "Lag",
"COMMAND_LIST": "Lista för alla röstkommandon",
"MODE": "Läge",