From 62567264f09ae186c3c68b0f2eba6e926ca6387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Mon, 14 Nov 2016 14:43:30 -0300 Subject: [PATCH] Config: Add option disabled for modules configuration --- CHANGELOG.md | 1 + README.md | 1 + js/app.js | 4 ++-- js/loader.js | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cf68a59..7a2a7e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add the abilty to set timezone on the date display in the Clock Module - Ability to set date format in calendar module - Possibility to use currentweather for the compliments +- Added option `disabled` for modules. ### Updated - Modified translations for Frysk. diff --git a/README.md b/README.md index 0f9ec65d..11672ef8 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ Module configuration: | `position` | The location of the module in which the module will be loaded. Possible values are `top_ bar`, `top_left`, `top_center`, `top_right`, `upper_third`, `middle_center`, `lower_third`, `bottom_left`, `bottom_center`, `bottom_right`, `bottom_bar`, `fullscreen_above`, and `fullscreen_below`. This field is optional but most modules require this field to set. Check the documentation of the module for more information. Multiple modules with the same position will be ordered based on the order in the configuration file. | | `classes` | Additional classes which are passed to the module. The field is optional. | | `header` | To display a header text above the module, add the header property. This field is optional. | +| `disabled` | Set disabled to `true` to skip creating the module. This field is optional. | | `config` | An object with the module configuration properties. Check the documentation of the module for more information. This field is optional, unless the module requires extra configuration. | ## Modules diff --git a/js/app.js b/js/app.js index 84e89d13..29036f69 100644 --- a/js/app.js +++ b/js/app.js @@ -156,7 +156,7 @@ var App = function() { for (var m in config.modules) { var module = config.modules[m]; - if (modules.indexOf(module.module) === -1) { + if (modules.indexOf(module.module) === -1 && !module.disabled) { modules.push(module.module); } } @@ -184,4 +184,4 @@ var App = function() { }; }; -module.exports = new App(); \ No newline at end of file +module.exports = new App(); diff --git a/js/loader.js b/js/loader.js index 84e42a0a..0c7c643a 100644 --- a/js/loader.js +++ b/js/loader.js @@ -89,6 +89,10 @@ var Loader = (function() { moduleFolder = config.paths.modules + "/default/" + module; } + if (moduleData.disabled === true) { + continue; + } + moduleFiles.push({ index: m, identifier: "module_" + m + "_" + module,