mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
add .gitattributes and fix prettier/js warnings (#3094)
see title, as discussed in https://github.com/MichMich/MagicMirror/pull/3093
This commit is contained in:
parent
b80485b52f
commit
a41aa48dd1
56
.gitattributes
vendored
Normal file
56
.gitattributes
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# .gitattributes snippet to force users to use same line endings for project.
|
||||||
|
#
|
||||||
|
# Handle line endings automatically for files detected as text
|
||||||
|
# and leave all files detected as binary untouched.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
#
|
||||||
|
# The above will handle all files NOT found below
|
||||||
|
# https://help.github.com/articles/dealing-with-line-endings/
|
||||||
|
# https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# These files are text and should be normalized (Convert crlf => lf)
|
||||||
|
*.php text
|
||||||
|
*.css text
|
||||||
|
*.scss text
|
||||||
|
*.js text
|
||||||
|
*.json text
|
||||||
|
*.htm text
|
||||||
|
*.html text
|
||||||
|
*.xml text
|
||||||
|
*.txt text
|
||||||
|
*.ini text
|
||||||
|
*.inc text
|
||||||
|
*.pl text
|
||||||
|
*.rb text
|
||||||
|
*.py text
|
||||||
|
*.scm text
|
||||||
|
*.sql text
|
||||||
|
.htaccess text
|
||||||
|
*.sh text
|
||||||
|
Dockerfile* text
|
||||||
|
*.yml text
|
||||||
|
*.yaml text
|
||||||
|
*.md text
|
||||||
|
*.markdown text
|
||||||
|
|
||||||
|
# These files are binary and should be left untouched
|
||||||
|
# (binary is a macro for -text -diff)
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.ico binary
|
||||||
|
*.mov binary
|
||||||
|
*.mp4 binary
|
||||||
|
*.mp3 binary
|
||||||
|
*.flv binary
|
||||||
|
*.fla binary
|
||||||
|
*.swf binary
|
||||||
|
*.gz binary
|
||||||
|
*.zip binary
|
||||||
|
*.7z binary
|
||||||
|
*.ttf binary
|
||||||
|
*.pyc binary
|
@ -30,6 +30,7 @@ _This release is scheduled to be released on 2023-07-01._
|
|||||||
|
|
||||||
- Fix envcanada hourly forecast time (#3080)
|
- Fix envcanada hourly forecast time (#3080)
|
||||||
- Fix electron not running under windows after async changes (#3083)
|
- Fix electron not running under windows after async changes (#3083)
|
||||||
|
- Fix style issues after eslint-plugin-jsdoc update
|
||||||
|
|
||||||
## [2.23.0] - 2023-04-04
|
## [2.23.0] - 2023-04-04
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
/**
|
/**
|
||||||
* Get command line parameters
|
* Get command line parameters
|
||||||
* Assumes that a cmdline parameter is defined with `--key [value]`
|
* Assumes that a cmdline parameter is defined with `--key [value]`
|
||||||
*
|
|
||||||
* @param {string} key key to look for at the command line
|
* @param {string} key key to look for at the command line
|
||||||
* @param {string} defaultValue value if no key is given at the command line
|
* @param {string} defaultValue value if no key is given at the command line
|
||||||
* @returns {string} the value of the parameter
|
* @returns {string} the value of the parameter
|
||||||
@ -33,7 +32,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the config from the specified server url
|
* Gets the config from the specified server url
|
||||||
*
|
|
||||||
* @param {string} url location where the server is running.
|
* @param {string} url location where the server is running.
|
||||||
* @returns {Promise} the config
|
* @returns {Promise} the config
|
||||||
*/
|
*/
|
||||||
@ -63,7 +61,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message to the console in case of errors
|
* Print a message to the console in case of errors
|
||||||
*
|
|
||||||
* @param {string} message error message to print
|
* @param {string} message error message to print
|
||||||
* @param {number} code error code for the exit call
|
* @param {number} code error code for the exit call
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,6 @@ process.on("uncaughtException", function (err) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The core app.
|
* The core app.
|
||||||
*
|
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
function App() {
|
function App() {
|
||||||
@ -53,7 +52,6 @@ function App() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the config file. Combines it with the defaults and returns the config
|
* Loads the config file. Combines it with the defaults and returns the config
|
||||||
*
|
|
||||||
* @async
|
* @async
|
||||||
* @returns {Promise<object>} the loaded config or the defaults if something goes wrong
|
* @returns {Promise<object>} the loaded config or the defaults if something goes wrong
|
||||||
*/
|
*/
|
||||||
@ -135,7 +133,6 @@ function App() {
|
|||||||
/**
|
/**
|
||||||
* Checks the config for deprecated options and throws a warning in the logs
|
* Checks the config for deprecated options and throws a warning in the logs
|
||||||
* if it encounters one option from the deprecated.js list
|
* if it encounters one option from the deprecated.js list
|
||||||
*
|
|
||||||
* @param {object} userConfig The user config
|
* @param {object} userConfig The user config
|
||||||
*/
|
*/
|
||||||
function checkDeprecatedOptions(userConfig) {
|
function checkDeprecatedOptions(userConfig) {
|
||||||
@ -150,7 +147,6 @@ function App() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a specific module.
|
* Loads a specific module.
|
||||||
*
|
|
||||||
* @param {string} module The name of the module (including subpath).
|
* @param {string} module The name of the module (including subpath).
|
||||||
*/
|
*/
|
||||||
function loadModule(module) {
|
function loadModule(module) {
|
||||||
@ -204,7 +200,6 @@ function App() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all modules.
|
* Loads all modules.
|
||||||
*
|
|
||||||
* @param {Module[]} modules All modules to be loaded
|
* @param {Module[]} modules All modules to be loaded
|
||||||
* @returns {Promise} A promise that is resolved when all modules been loaded
|
* @returns {Promise} A promise that is resolved when all modules been loaded
|
||||||
*/
|
*/
|
||||||
@ -220,7 +215,6 @@ function App() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two semantic version numbers and return the difference.
|
* Compare two semantic version numbers and return the difference.
|
||||||
*
|
|
||||||
* @param {string} a Version number a.
|
* @param {string} a Version number a.
|
||||||
* @param {string} b Version number b.
|
* @param {string} b Version number b.
|
||||||
* @returns {number} A positive number if a is larger than b, a negative
|
* @returns {number} A positive number if a is larger than b, a negative
|
||||||
@ -246,7 +240,6 @@ function App() {
|
|||||||
* Start the core app.
|
* Start the core app.
|
||||||
*
|
*
|
||||||
* It loads the config, then it loads all modules.
|
* It loads the config, then it loads all modules.
|
||||||
*
|
|
||||||
* @async
|
* @async
|
||||||
* @returns {Promise<object>} the config used
|
* @returns {Promise<object>} the config used
|
||||||
*/
|
*/
|
||||||
@ -301,7 +294,6 @@ function App() {
|
|||||||
* exists.
|
* exists.
|
||||||
*
|
*
|
||||||
* Added to fix #1056
|
* Added to fix #1056
|
||||||
*
|
|
||||||
* @returns {Promise} A promise that is resolved when all node_helpers and
|
* @returns {Promise} A promise that is resolved when all node_helpers and
|
||||||
* the http server has been closed
|
* the http server has been closed
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,6 @@ const Utils = require(`${rootPath}/js/utils.js`);
|
|||||||
/**
|
/**
|
||||||
* Returns a string with path of configuration file.
|
* Returns a string with path of configuration file.
|
||||||
* Check if set by environment variable MM_CONFIG_FILE
|
* Check if set by environment variable MM_CONFIG_FILE
|
||||||
*
|
|
||||||
* @returns {string} path and filename of the config file
|
* @returns {string} path and filename of the config file
|
||||||
*/
|
*/
|
||||||
function getConfigFile() {
|
function getConfigFile() {
|
||||||
|
@ -82,7 +82,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the clone method for later use. Helper Method.
|
* Define the clone method for later use. Helper Method.
|
||||||
*
|
|
||||||
* @param {object} obj Object to be cloned
|
* @param {object} obj Object to be cloned
|
||||||
* @returns {object} the cloned object
|
* @returns {object} the cloned object
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
*
|
*
|
||||||
* Attention: After some discussion we always return the third party
|
* Attention: After some discussion we always return the third party
|
||||||
* implementation until the node implementation is stable and more tested
|
* implementation until the node implementation is stable and more tested
|
||||||
*
|
|
||||||
* @see https://github.com/MichMich/MagicMirror/pull/2952
|
* @see https://github.com/MichMich/MagicMirror/pull/2952
|
||||||
* @see https://github.com/MichMich/MagicMirror/issues/2649
|
* @see https://github.com/MichMich/MagicMirror/issues/2649
|
||||||
* @param {string} url to be fetched
|
* @param {string} url to be fetched
|
||||||
|
@ -52,7 +52,6 @@ const Loader = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve list of all modules.
|
* Retrieve list of all modules.
|
||||||
*
|
|
||||||
* @returns {object[]} module data as configured in config
|
* @returns {object[]} module data as configured in config
|
||||||
*/
|
*/
|
||||||
const getAllModules = function () {
|
const getAllModules = function () {
|
||||||
@ -61,7 +60,6 @@ const Loader = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate array with module information including module paths.
|
* Generate array with module information including module paths.
|
||||||
*
|
|
||||||
* @returns {object[]} Module information.
|
* @returns {object[]} Module information.
|
||||||
*/
|
*/
|
||||||
const getModuleData = function () {
|
const getModuleData = function () {
|
||||||
@ -103,7 +101,6 @@ const Loader = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load modules via ajax request and create module objects.
|
* Load modules via ajax request and create module objects.
|
||||||
*
|
|
||||||
* @param {object} module Information about the module we want to load.
|
* @param {object} module Information about the module we want to load.
|
||||||
* @returns {Promise<void>} resolved when module is loaded
|
* @returns {Promise<void>} resolved when module is loaded
|
||||||
*/
|
*/
|
||||||
@ -131,7 +128,6 @@ const Loader = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap modules by setting the module data and loading the scripts & styles.
|
* Bootstrap modules by setting the module data and loading the scripts & styles.
|
||||||
*
|
|
||||||
* @param {object} module Information about the module we want to load.
|
* @param {object} module Information about the module we want to load.
|
||||||
* @param {Module} mObj Modules instance.
|
* @param {Module} mObj Modules instance.
|
||||||
*/
|
*/
|
||||||
@ -153,7 +149,6 @@ const Loader = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a script or stylesheet by adding it to the dom.
|
* Load a script or stylesheet by adding it to the dom.
|
||||||
*
|
|
||||||
* @param {string} fileName Path of the file we want to load.
|
* @param {string} fileName Path of the file we want to load.
|
||||||
* @returns {Promise} resolved when the file is loaded
|
* @returns {Promise} resolved when the file is loaded
|
||||||
*/
|
*/
|
||||||
@ -229,7 +224,6 @@ const Loader = (function () {
|
|||||||
/**
|
/**
|
||||||
* Load a file (script or stylesheet).
|
* Load a file (script or stylesheet).
|
||||||
* Prevent double loading and search for files in the vendor folder.
|
* Prevent double loading and search for files in the vendor folder.
|
||||||
*
|
|
||||||
* @param {string} fileName Path of the file we want to load.
|
* @param {string} fileName Path of the file we want to load.
|
||||||
* @param {Module} module The module that calls the loadFile function.
|
* @param {Module} module The module that calls the loadFile function.
|
||||||
* @returns {Promise} resolved when the file is loaded
|
* @returns {Promise} resolved when the file is loaded
|
||||||
|
20
js/main.js
20
js/main.js
@ -68,7 +68,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Select the wrapper dom object for a specific position.
|
* Select the wrapper dom object for a specific position.
|
||||||
*
|
|
||||||
* @param {string} position The name of the position.
|
* @param {string} position The name of the position.
|
||||||
* @returns {HTMLElement | void} the wrapper element
|
* @returns {HTMLElement | void} the wrapper element
|
||||||
*/
|
*/
|
||||||
@ -85,7 +84,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to all modules.
|
* Send a notification to all modules.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
* @param {Module} sender The module that sent the notification.
|
* @param {Module} sender The module that sent the notification.
|
||||||
@ -102,7 +100,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the dom for a specific module.
|
* Update the dom for a specific module.
|
||||||
*
|
|
||||||
* @param {Module} module The module that needs an update.
|
* @param {Module} module The module that needs an update.
|
||||||
* @param {number} [speed] The (optional) number of microseconds for the animation.
|
* @param {number} [speed] The (optional) number of microseconds for the animation.
|
||||||
* @returns {Promise} Resolved when the dom is fully updated.
|
* @returns {Promise} Resolved when the dom is fully updated.
|
||||||
@ -129,7 +126,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the dom with the specified content
|
* Update the dom with the specified content
|
||||||
*
|
|
||||||
* @param {Module} module The module that needs an update.
|
* @param {Module} module The module that needs an update.
|
||||||
* @param {number} [speed] The (optional) number of microseconds for the animation.
|
* @param {number} [speed] The (optional) number of microseconds for the animation.
|
||||||
* @param {string} newHeader The new header that is generated.
|
* @param {string} newHeader The new header that is generated.
|
||||||
@ -167,7 +163,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the content has changed.
|
* Check if the content has changed.
|
||||||
*
|
|
||||||
* @param {Module} module The module to check.
|
* @param {Module} module The module to check.
|
||||||
* @param {string} newHeader The new header that is generated.
|
* @param {string} newHeader The new header that is generated.
|
||||||
* @param {HTMLElement} newContent The new content that is generated.
|
* @param {HTMLElement} newContent The new content that is generated.
|
||||||
@ -198,7 +193,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the content of a module on screen.
|
* Update the content of a module on screen.
|
||||||
*
|
|
||||||
* @param {Module} module The module to check.
|
* @param {Module} module The module to check.
|
||||||
* @param {string} newHeader The new header that is generated.
|
* @param {string} newHeader The new header that is generated.
|
||||||
* @param {HTMLElement} newContent The new content that is generated.
|
* @param {HTMLElement} newContent The new content that is generated.
|
||||||
@ -224,7 +218,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the module.
|
* Hide the module.
|
||||||
*
|
|
||||||
* @param {Module} module The module to hide.
|
* @param {Module} module The module to hide.
|
||||||
* @param {number} speed The speed of the hide animation.
|
* @param {number} speed The speed of the hide animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
@ -269,7 +262,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the module.
|
* Show the module.
|
||||||
*
|
|
||||||
* @param {Module} module The module to show.
|
* @param {Module} module The module to show.
|
||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
@ -376,13 +368,11 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds special selectors on a collection of modules.
|
* Adds special selectors on a collection of modules.
|
||||||
*
|
|
||||||
* @param {Module[]} modules Array of modules.
|
* @param {Module[]} modules Array of modules.
|
||||||
*/
|
*/
|
||||||
const setSelectionMethodsForModules = function (modules) {
|
const setSelectionMethodsForModules = function (modules) {
|
||||||
/**
|
/**
|
||||||
* Filter modules with the specified classes.
|
* Filter modules with the specified classes.
|
||||||
*
|
|
||||||
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
||||||
* @returns {Module[]} Filtered collection of modules.
|
* @returns {Module[]} Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
@ -392,7 +382,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter modules without the specified classes.
|
* Filter modules without the specified classes.
|
||||||
*
|
|
||||||
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
||||||
* @returns {Module[]} Filtered collection of modules.
|
* @returns {Module[]} Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
@ -402,7 +391,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters a collection of modules based on classname(s).
|
* Filters a collection of modules based on classname(s).
|
||||||
*
|
|
||||||
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
* @param {string|string[]} className one or multiple classnames (array or space divided).
|
||||||
* @param {boolean} include if the filter should include or exclude the modules with the specific classes.
|
* @param {boolean} include if the filter should include or exclude the modules with the specific classes.
|
||||||
* @returns {Module[]} Filtered collection of modules.
|
* @returns {Module[]} Filtered collection of modules.
|
||||||
@ -431,7 +419,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a module instance from the collection.
|
* Removes a module instance from the collection.
|
||||||
*
|
|
||||||
* @param {object} module The module instance to remove from the collection.
|
* @param {object} module The module instance to remove from the collection.
|
||||||
* @returns {Module[]} Filtered collection of modules.
|
* @returns {Module[]} Filtered collection of modules.
|
||||||
*/
|
*/
|
||||||
@ -446,7 +433,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Walks thru a collection of modules and executes the callback with the module as an argument.
|
* Walks thru a collection of modules and executes the callback with the module as an argument.
|
||||||
*
|
|
||||||
* @param {Function} callback The function to execute with the module as an argument.
|
* @param {Function} callback The function to execute with the module as an argument.
|
||||||
*/
|
*/
|
||||||
const enumerate = function (callback) {
|
const enumerate = function (callback) {
|
||||||
@ -487,7 +473,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets called when all modules are started.
|
* Gets called when all modules are started.
|
||||||
*
|
|
||||||
* @param {Module[]} moduleObjects All module instances.
|
* @param {Module[]} moduleObjects All module instances.
|
||||||
*/
|
*/
|
||||||
modulesStarted: function (moduleObjects) {
|
modulesStarted: function (moduleObjects) {
|
||||||
@ -502,7 +487,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to all modules.
|
* Send a notification to all modules.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
* @param {Module} sender The module that sent the notification.
|
* @param {Module} sender The module that sent the notification.
|
||||||
@ -529,7 +513,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the dom for a specific module.
|
* Update the dom for a specific module.
|
||||||
*
|
|
||||||
* @param {Module} module The module that needs an update.
|
* @param {Module} module The module that needs an update.
|
||||||
* @param {number} [speed] The number of microseconds for the animation.
|
* @param {number} [speed] The number of microseconds for the animation.
|
||||||
*/
|
*/
|
||||||
@ -550,7 +533,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a collection of all modules currently active.
|
* Returns a collection of all modules currently active.
|
||||||
*
|
|
||||||
* @returns {Module[]} A collection of all modules currently active.
|
* @returns {Module[]} A collection of all modules currently active.
|
||||||
*/
|
*/
|
||||||
getModules: function () {
|
getModules: function () {
|
||||||
@ -560,7 +542,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the module.
|
* Hide the module.
|
||||||
*
|
|
||||||
* @param {Module} module The module to hide.
|
* @param {Module} module The module to hide.
|
||||||
* @param {number} speed The speed of the hide animation.
|
* @param {number} speed The speed of the hide animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
@ -573,7 +554,6 @@ const MM = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the module.
|
* Show the module.
|
||||||
*
|
|
||||||
* @param {Module} module The module to show.
|
* @param {Module} module The module to show.
|
||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
|
26
js/module.js
26
js/module.js
@ -46,7 +46,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of scripts the module requires to be loaded.
|
* Returns a list of scripts the module requires to be loaded.
|
||||||
*
|
|
||||||
* @returns {string[]} An array with filenames.
|
* @returns {string[]} An array with filenames.
|
||||||
*/
|
*/
|
||||||
getScripts: function () {
|
getScripts: function () {
|
||||||
@ -55,7 +54,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of stylesheets the module requires to be loaded.
|
* Returns a list of stylesheets the module requires to be loaded.
|
||||||
*
|
|
||||||
* @returns {string[]} An array with filenames.
|
* @returns {string[]} An array with filenames.
|
||||||
*/
|
*/
|
||||||
getStyles: function () {
|
getStyles: function () {
|
||||||
@ -66,7 +64,6 @@ const Module = Class.extend({
|
|||||||
* Returns a map of translation files the module requires to be loaded.
|
* Returns a map of translation files the module requires to be loaded.
|
||||||
*
|
*
|
||||||
* return Map<String, String> -
|
* return Map<String, String> -
|
||||||
*
|
|
||||||
* @returns {*} A map with langKeys and filenames.
|
* @returns {*} A map with langKeys and filenames.
|
||||||
*/
|
*/
|
||||||
getTranslations: function () {
|
getTranslations: function () {
|
||||||
@ -77,7 +74,6 @@ const Module = Class.extend({
|
|||||||
* Generates the dom which needs to be displayed. This method is called by the MagicMirror² core.
|
* Generates the dom which needs to be displayed. This method is called by the MagicMirror² core.
|
||||||
* This method can to be subclassed if the module wants to display info on the mirror.
|
* This method can to be subclassed if the module wants to display info on the mirror.
|
||||||
* Alternatively, the getTemplate method could be subclassed.
|
* Alternatively, the getTemplate method could be subclassed.
|
||||||
*
|
|
||||||
* @returns {HTMLElement|Promise} The dom or a promise with the dom to display.
|
* @returns {HTMLElement|Promise} The dom or a promise with the dom to display.
|
||||||
*/
|
*/
|
||||||
getDom: function () {
|
getDom: function () {
|
||||||
@ -111,7 +107,6 @@ const Module = Class.extend({
|
|||||||
* Generates the header string which needs to be displayed if a user has a header configured for this module.
|
* Generates the header string which needs to be displayed if a user has a header configured for this module.
|
||||||
* This method is called by the MagicMirror² core, but only if the user has configured a default header for the module.
|
* This method is called by the MagicMirror² core, but only if the user has configured a default header for the module.
|
||||||
* This method needs to be subclassed if the module wants to display modified headers on the mirror.
|
* This method needs to be subclassed if the module wants to display modified headers on the mirror.
|
||||||
*
|
|
||||||
* @returns {string} The header to display above the header.
|
* @returns {string} The header to display above the header.
|
||||||
*/
|
*/
|
||||||
getHeader: function () {
|
getHeader: function () {
|
||||||
@ -123,7 +118,6 @@ const Module = Class.extend({
|
|||||||
* This method needs to be subclassed if the module wants to use a template.
|
* This method needs to be subclassed if the module wants to use a template.
|
||||||
* It can either return a template sting, or a template filename.
|
* It can either return a template sting, or a template filename.
|
||||||
* If the string ends with '.html' it's considered a file from within the module's folder.
|
* If the string ends with '.html' it's considered a file from within the module's folder.
|
||||||
*
|
|
||||||
* @returns {string} The template string of filename.
|
* @returns {string} The template string of filename.
|
||||||
*/
|
*/
|
||||||
getTemplate: function () {
|
getTemplate: function () {
|
||||||
@ -133,7 +127,6 @@ const Module = Class.extend({
|
|||||||
/**
|
/**
|
||||||
* Returns the data to be used in the template.
|
* Returns the data to be used in the template.
|
||||||
* This method needs to be subclassed if the module wants to use a custom data.
|
* This method needs to be subclassed if the module wants to use a custom data.
|
||||||
*
|
|
||||||
* @returns {object} The data for the template
|
* @returns {object} The data for the template
|
||||||
*/
|
*/
|
||||||
getTemplateData: function () {
|
getTemplateData: function () {
|
||||||
@ -142,7 +135,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the MagicMirror² core when a notification arrives.
|
* Called by the MagicMirror² core when a notification arrives.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
* @param {Module} sender The module that sent the notification.
|
* @param {Module} sender The module that sent the notification.
|
||||||
@ -158,7 +150,6 @@ const Module = Class.extend({
|
|||||||
/**
|
/**
|
||||||
* Returns the nunjucks environment for the current module.
|
* Returns the nunjucks environment for the current module.
|
||||||
* The environment is checked in the _nunjucksEnvironment instance variable.
|
* The environment is checked in the _nunjucksEnvironment instance variable.
|
||||||
*
|
|
||||||
* @returns {object} The Nunjucks Environment
|
* @returns {object} The Nunjucks Environment
|
||||||
*/
|
*/
|
||||||
nunjucksEnvironment: function () {
|
nunjucksEnvironment: function () {
|
||||||
@ -180,7 +171,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a socket notification arrives.
|
* Called when a socket notification arrives.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
*/
|
*/
|
||||||
@ -208,7 +198,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the module data.
|
* Set the module data.
|
||||||
*
|
|
||||||
* @param {object} data The module data
|
* @param {object} data The module data
|
||||||
*/
|
*/
|
||||||
setData: function (data) {
|
setData: function (data) {
|
||||||
@ -222,7 +211,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the module config and combine it with the module defaults.
|
* Set the module config and combine it with the module defaults.
|
||||||
*
|
|
||||||
* @param {object} config The combined module config.
|
* @param {object} config The combined module config.
|
||||||
* @param {boolean} deep Merge module config in deep.
|
* @param {boolean} deep Merge module config in deep.
|
||||||
*/
|
*/
|
||||||
@ -233,7 +221,6 @@ const Module = Class.extend({
|
|||||||
/**
|
/**
|
||||||
* Returns a socket object. If it doesn't exist, it's created.
|
* Returns a socket object. If it doesn't exist, it's created.
|
||||||
* It also registers the notification callback.
|
* It also registers the notification callback.
|
||||||
*
|
|
||||||
* @returns {MMSocket} a socket object
|
* @returns {MMSocket} a socket object
|
||||||
*/
|
*/
|
||||||
socket: function () {
|
socket: function () {
|
||||||
@ -250,7 +237,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the path to a module file.
|
* Retrieve the path to a module file.
|
||||||
*
|
|
||||||
* @param {string} file Filename
|
* @param {string} file Filename
|
||||||
* @returns {string} the file path
|
* @returns {string} the file path
|
||||||
*/
|
*/
|
||||||
@ -260,7 +246,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all required stylesheets by requesting the MM object to load the files.
|
* Load all required stylesheets by requesting the MM object to load the files.
|
||||||
*
|
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
loadStyles: function () {
|
loadStyles: function () {
|
||||||
@ -269,7 +254,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all required scripts by requesting the MM object to load the files.
|
* Load all required scripts by requesting the MM object to load the files.
|
||||||
*
|
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
loadScripts: function () {
|
loadScripts: function () {
|
||||||
@ -278,7 +262,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to load all dependencies.
|
* Helper method to load all dependencies.
|
||||||
*
|
|
||||||
* @param {string} funcName Function name to call to get scripts or styles.
|
* @param {string} funcName Function name to call to get scripts or styles.
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@ -301,6 +284,7 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all translations.
|
* Load all translations.
|
||||||
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
loadTranslations: async function () {
|
loadTranslations: async function () {
|
||||||
const translations = this.getTranslations() || {};
|
const translations = this.getTranslations() || {};
|
||||||
@ -329,7 +313,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request the translation for a given key with optional variables and default value.
|
* Request the translation for a given key with optional variables and default value.
|
||||||
*
|
|
||||||
* @param {string} key The key of the string to translate
|
* @param {string} key The key of the string to translate
|
||||||
* @param {string|object} [defaultValueOrVariables] The default value or variables for translating.
|
* @param {string|object} [defaultValueOrVariables] The default value or variables for translating.
|
||||||
* @param {string} [defaultValue] The default value with variables.
|
* @param {string} [defaultValue] The default value with variables.
|
||||||
@ -344,7 +327,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request an (animated) update of the module.
|
* Request an (animated) update of the module.
|
||||||
*
|
|
||||||
* @param {number} [speed] The speed of the animation.
|
* @param {number} [speed] The speed of the animation.
|
||||||
*/
|
*/
|
||||||
updateDom: function (speed) {
|
updateDom: function (speed) {
|
||||||
@ -353,7 +335,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to all modules.
|
* Send a notification to all modules.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
*/
|
*/
|
||||||
@ -363,7 +344,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a socket notification to the node helper.
|
* Send a socket notification to the node helper.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
*/
|
*/
|
||||||
@ -373,7 +353,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide this module.
|
* Hide this module.
|
||||||
*
|
|
||||||
* @param {number} speed The speed of the hide animation.
|
* @param {number} speed The speed of the hide animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
* @param {object} [options] Optional settings for the hide method.
|
* @param {object} [options] Optional settings for the hide method.
|
||||||
@ -401,7 +380,6 @@ const Module = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show this module.
|
* Show this module.
|
||||||
*
|
|
||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
* @param {object} [options] Optional settings for the show method.
|
* @param {object} [options] Optional settings for the show method.
|
||||||
@ -447,7 +425,6 @@ const Module = Class.extend({
|
|||||||
* -------
|
* -------
|
||||||
*
|
*
|
||||||
* Todo: idea of Mich determinate what do you want to merge or not
|
* Todo: idea of Mich determinate what do you want to merge or not
|
||||||
*
|
|
||||||
* @param {object} result the initial object
|
* @param {object} result the initial object
|
||||||
* @returns {object} the merged config
|
* @returns {object} the merged config
|
||||||
*/
|
*/
|
||||||
@ -509,7 +486,6 @@ window.Module = Module;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two semantic version numbers and return the difference.
|
* Compare two semantic version numbers and return the difference.
|
||||||
*
|
|
||||||
* @param {string} a Version number a.
|
* @param {string} a Version number a.
|
||||||
* @param {string} b Version number b.
|
* @param {string} b Version number b.
|
||||||
* @returns {number} A positive number if a is larger than b, a negative
|
* @returns {number} A positive number if a is larger than b, a negative
|
||||||
|
@ -32,7 +32,6 @@ const NodeHelper = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called when a socket notification arrives.
|
* This method is called when a socket notification arrives.
|
||||||
*
|
|
||||||
* @param {string} notification The identifier of the notification.
|
* @param {string} notification The identifier of the notification.
|
||||||
* @param {*} payload The payload of the notification.
|
* @param {*} payload The payload of the notification.
|
||||||
*/
|
*/
|
||||||
@ -42,7 +41,6 @@ const NodeHelper = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the module name.
|
* Set the module name.
|
||||||
*
|
|
||||||
* @param {string} name Module name.
|
* @param {string} name Module name.
|
||||||
*/
|
*/
|
||||||
setName(name) {
|
setName(name) {
|
||||||
@ -51,7 +49,6 @@ const NodeHelper = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the module path.
|
* Set the module path.
|
||||||
*
|
|
||||||
* @param {string} path Module path.
|
* @param {string} path Module path.
|
||||||
*/
|
*/
|
||||||
setPath(path) {
|
setPath(path) {
|
||||||
@ -123,7 +120,6 @@ NodeHelper.checkFetchStatus = function (response) {
|
|||||||
/**
|
/**
|
||||||
* Look at the specified error and return an appropriate error type, that
|
* Look at the specified error and return an appropriate error type, that
|
||||||
* can be translated to a detailed error message
|
* can be translated to a detailed error message
|
||||||
*
|
|
||||||
* @param {Error} error the error from fetching something
|
* @param {Error} error the error from fetching something
|
||||||
* @returns {string} the string of the detailed error message in the translations
|
* @returns {string} the string of the detailed error message in the translations
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,6 @@ const { cors, getConfig, getHtml, getVersion } = require("./server_functions");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Server
|
* Server
|
||||||
*
|
|
||||||
* @param {object} config The MM config
|
* @param {object} config The MM config
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
@ -31,7 +30,6 @@ function Server(config) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the server for incoming connections
|
* Opens the server for incoming connections
|
||||||
*
|
|
||||||
* @returns {Promise} A promise that is resolved when the server listens to connections
|
* @returns {Promise} A promise that is resolved when the server listens to connections
|
||||||
*/
|
*/
|
||||||
this.open = function () {
|
this.open = function () {
|
||||||
@ -106,7 +104,6 @@ function Server(config) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the server and destroys all lingering connections to it.
|
* Closes the server and destroys all lingering connections to it.
|
||||||
*
|
|
||||||
* @returns {Promise} A promise that resolves when server has successfully shut down
|
* @returns {Promise} A promise that resolves when server has successfully shut down
|
||||||
*/
|
*/
|
||||||
this.close = function () {
|
this.close = function () {
|
||||||
|
@ -5,7 +5,6 @@ const fetch = require("./fetch");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the config.
|
* Gets the config.
|
||||||
*
|
|
||||||
* @param {Request} req - the request
|
* @param {Request} req - the request
|
||||||
* @param {Response} res - the result
|
* @param {Response} res - the result
|
||||||
*/
|
*/
|
||||||
@ -19,7 +18,6 @@ function getConfig(req, res) {
|
|||||||
* Example input request url: /cors?sendheaders=header1:value1,header2:value2&expectedheaders=header1,header2&url=http://www.test.com/path?param1=value1
|
* Example input request url: /cors?sendheaders=header1:value1,header2:value2&expectedheaders=header1,header2&url=http://www.test.com/path?param1=value1
|
||||||
*
|
*
|
||||||
* Only the url-param of the input request url is required. It must be the last parameter.
|
* Only the url-param of the input request url is required. It must be the last parameter.
|
||||||
*
|
|
||||||
* @param {Request} req - the request
|
* @param {Request} req - the request
|
||||||
* @param {Response} res - the result
|
* @param {Response} res - the result
|
||||||
*/
|
*/
|
||||||
@ -57,7 +55,6 @@ async function cors(req, res) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets headers and values to attach to the web request.
|
* Gets headers and values to attach to the web request.
|
||||||
*
|
|
||||||
* @param {string} url - The url containing the headers and values to send.
|
* @param {string} url - The url containing the headers and values to send.
|
||||||
* @returns {object} An object specifying name and value of the headers.
|
* @returns {object} An object specifying name and value of the headers.
|
||||||
*/
|
*/
|
||||||
@ -79,7 +76,6 @@ function getHeadersToSend(url) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the headers expected from the response.
|
* Gets the headers expected from the response.
|
||||||
*
|
|
||||||
* @param {string} url - The url containing the expected headers from the response.
|
* @param {string} url - The url containing the expected headers from the response.
|
||||||
* @returns {string[]} headers - The name of the expected headers.
|
* @returns {string[]} headers - The name of the expected headers.
|
||||||
*/
|
*/
|
||||||
@ -97,7 +93,6 @@ function geExpectedRecievedHeaders(url) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the HTML to display the magic mirror.
|
* Gets the HTML to display the magic mirror.
|
||||||
*
|
|
||||||
* @param {Request} req - the request
|
* @param {Request} req - the request
|
||||||
* @param {Response} res - the result
|
* @param {Response} res - the result
|
||||||
*/
|
*/
|
||||||
@ -116,7 +111,6 @@ function getHtml(req, res) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the MagicMirror version.
|
* Gets the MagicMirror version.
|
||||||
*
|
|
||||||
* @param {Request} req - the request
|
* @param {Request} req - the request
|
||||||
* @param {Response} res - the result
|
* @param {Response} res - the result
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
const Translator = (function () {
|
const Translator = (function () {
|
||||||
/**
|
/**
|
||||||
* Load a JSON file via XHR.
|
* Load a JSON file via XHR.
|
||||||
*
|
|
||||||
* @param {string} file Path of the file we want to load.
|
* @param {string} file Path of the file we want to load.
|
||||||
* @returns {Promise<object>} the translations in the specified file
|
* @returns {Promise<object>} the translations in the specified file
|
||||||
*/
|
*/
|
||||||
@ -43,7 +42,6 @@ const Translator = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a translation for a given key for a given module.
|
* Load a translation for a given key for a given module.
|
||||||
*
|
|
||||||
* @param {Module} module The module to load the translation for.
|
* @param {Module} module The module to load the translation for.
|
||||||
* @param {string} key The key of the text to translate.
|
* @param {string} key The key of the text to translate.
|
||||||
* @param {object} variables The variables to use within the translation template (optional)
|
* @param {object} variables The variables to use within the translation template (optional)
|
||||||
@ -55,7 +53,6 @@ const Translator = (function () {
|
|||||||
* template: "Please wait for {timeToWait} before continuing with {work}."
|
* template: "Please wait for {timeToWait} before continuing with {work}."
|
||||||
* variables: {timeToWait: "2 hours", work: "painting"}
|
* variables: {timeToWait: "2 hours", work: "painting"}
|
||||||
* to: "Please wait for 2 hours before continuing with painting."
|
* to: "Please wait for 2 hours before continuing with painting."
|
||||||
*
|
|
||||||
* @param {string} template Text with placeholder
|
* @param {string} template Text with placeholder
|
||||||
* @param {object} variables Variables for the placeholder
|
* @param {object} variables Variables for the placeholder
|
||||||
* @returns {string} the template filled with the variables
|
* @returns {string} the template filled with the variables
|
||||||
@ -98,7 +95,6 @@ const Translator = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a translation file (json) and remember the data.
|
* Load a translation file (json) and remember the data.
|
||||||
*
|
|
||||||
* @param {Module} module The module to load the translation file for.
|
* @param {Module} module The module to load the translation file for.
|
||||||
* @param {string} file Path of the file we want to load.
|
* @param {string} file Path of the file we want to load.
|
||||||
* @param {boolean} isFallback Flag to indicate fallback translations.
|
* @param {boolean} isFallback Flag to indicate fallback translations.
|
||||||
@ -117,7 +113,6 @@ const Translator = (function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the core translations.
|
* Load the core translations.
|
||||||
*
|
|
||||||
* @param {string} lang The language identifier of the core language.
|
* @param {string} lang The language identifier of the core language.
|
||||||
*/
|
*/
|
||||||
loadCoreTranslations: async function (lang) {
|
loadCoreTranslations: async function (lang) {
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2014, Codrops
|
* Copyright 2014, Codrops
|
||||||
* https://tympanus.net/codrops/
|
* https://tympanus.net/codrops/
|
||||||
*
|
|
||||||
* @param {object} window The window object
|
* @param {object} window The window object
|
||||||
*/
|
*/
|
||||||
(function (window) {
|
(function (window) {
|
||||||
/**
|
/**
|
||||||
* Extend one object with another one
|
* Extend one object with another one
|
||||||
*
|
|
||||||
* @param {object} a The object to extend
|
* @param {object} a The object to extend
|
||||||
* @param {object} b The object which extends the other, overwrites existing keys
|
* @param {object} b The object which extends the other, overwrites existing keys
|
||||||
* @returns {object} The merged object
|
* @returns {object} The merged object
|
||||||
@ -31,7 +29,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* NotificationFx constructor
|
* NotificationFx constructor
|
||||||
*
|
|
||||||
* @param {object} options The configuration options
|
* @param {object} options The configuration options
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
@ -124,7 +121,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dismiss the notification
|
* Dismiss the notification
|
||||||
*
|
|
||||||
* @param {boolean} [close] call the onClose callback at the end
|
* @param {boolean} [close] call the onClose callback at the end
|
||||||
*/
|
*/
|
||||||
NotificationFx.prototype.dismiss = function (close = true) {
|
NotificationFx.prototype.dismiss = function (close = true) {
|
||||||
|
@ -524,7 +524,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this config contains the calendar url.
|
* Checks if this config contains the calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {boolean} True if the calendar config contains the url, False otherwise
|
* @returns {boolean} True if the calendar config contains the url, False otherwise
|
||||||
*/
|
*/
|
||||||
@ -540,7 +539,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the sorted list of all events.
|
* Creates the sorted list of all events.
|
||||||
*
|
|
||||||
* @param {boolean} limitNumberOfEntries Whether to filter returned events for display.
|
* @param {boolean} limitNumberOfEntries Whether to filter returned events for display.
|
||||||
* @returns {object[]} Array with events.
|
* @returns {object[]} Array with events.
|
||||||
*/
|
*/
|
||||||
@ -673,7 +671,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests node helper to add calendar url.
|
* Requests node helper to add calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url to add
|
* @param {string} url The calendar url to add
|
||||||
* @param {object} auth The authentication method and credentials
|
* @param {object} auth The authentication method and credentials
|
||||||
* @param {object} calendarConfig The config of the specific calendar
|
* @param {object} calendarConfig The config of the specific calendar
|
||||||
@ -698,7 +695,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the symbols for a specific event.
|
* Retrieves the symbols for a specific event.
|
||||||
*
|
|
||||||
* @param {object} event Event to look for.
|
* @param {object} event Event to look for.
|
||||||
* @returns {string[]} The symbols
|
* @returns {string[]} The symbols
|
||||||
*/
|
*/
|
||||||
@ -739,7 +735,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the symbolClass for a specific calendar url.
|
* Retrieves the symbolClass for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {string} The class to be used for the symbols of the calendar
|
* @returns {string} The class to be used for the symbols of the calendar
|
||||||
*/
|
*/
|
||||||
@ -749,7 +744,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the titleClass for a specific calendar url.
|
* Retrieves the titleClass for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {string} The class to be used for the title of the calendar
|
* @returns {string} The class to be used for the title of the calendar
|
||||||
*/
|
*/
|
||||||
@ -759,7 +753,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the timeClass for a specific calendar url.
|
* Retrieves the timeClass for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {string} The class to be used for the time of the calendar
|
* @returns {string} The class to be used for the time of the calendar
|
||||||
*/
|
*/
|
||||||
@ -769,7 +762,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the calendar name for a specific calendar url.
|
* Retrieves the calendar name for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {string} The name of the calendar
|
* @returns {string} The name of the calendar
|
||||||
*/
|
*/
|
||||||
@ -779,7 +771,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the color for a specific calendar url.
|
* Retrieves the color for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @param {boolean} isBg Determines if we fetch the bgColor or not
|
* @param {boolean} isBg Determines if we fetch the bgColor or not
|
||||||
* @returns {string} The color
|
* @returns {string} The color
|
||||||
@ -790,7 +781,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the count title for a specific calendar url.
|
* Retrieves the count title for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {string} The title
|
* @returns {string} The title
|
||||||
*/
|
*/
|
||||||
@ -800,7 +790,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the maximum entry count for a specific calendar url.
|
* Retrieves the maximum entry count for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {number} The maximum entry count
|
* @returns {number} The maximum entry count
|
||||||
*/
|
*/
|
||||||
@ -810,7 +799,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the maximum count of past days which events of should be displayed for a specific calendar url.
|
* Retrieves the maximum count of past days which events of should be displayed for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @returns {number} The maximum past days count
|
* @returns {number} The maximum past days count
|
||||||
*/
|
*/
|
||||||
@ -820,7 +808,6 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to retrieve the property for a specific calendar url.
|
* Helper method to retrieve the property for a specific calendar url.
|
||||||
*
|
|
||||||
* @param {string} url The calendar url
|
* @param {string} url The calendar url
|
||||||
* @param {string} property The property to look for
|
* @param {string} property The property to look for
|
||||||
* @param {string} defaultValue The value if the property is not found
|
* @param {string} defaultValue The value if the property is not found
|
||||||
|
@ -121,7 +121,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the on success callback
|
* Sets the on success callback
|
||||||
*
|
|
||||||
* @param {Function} callback The on success callback.
|
* @param {Function} callback The on success callback.
|
||||||
*/
|
*/
|
||||||
this.onReceive = function (callback) {
|
this.onReceive = function (callback) {
|
||||||
@ -130,7 +129,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the on error callback
|
* Sets the on error callback
|
||||||
*
|
|
||||||
* @param {Function} callback The on error callback.
|
* @param {Function} callback The on error callback.
|
||||||
*/
|
*/
|
||||||
this.onError = function (callback) {
|
this.onError = function (callback) {
|
||||||
@ -139,7 +137,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the url of this fetcher.
|
* Returns the url of this fetcher.
|
||||||
*
|
|
||||||
* @returns {string} The url of this fetcher.
|
* @returns {string} The url of this fetcher.
|
||||||
*/
|
*/
|
||||||
this.url = function () {
|
this.url = function () {
|
||||||
@ -148,7 +145,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current available events for this fetcher.
|
* Returns current available events for this fetcher.
|
||||||
*
|
|
||||||
* @returns {object[]} The current available events for this fetcher.
|
* @returns {object[]} The current available events for this fetcher.
|
||||||
*/
|
*/
|
||||||
this.events = function () {
|
this.events = function () {
|
||||||
|
@ -17,7 +17,6 @@ const CalendarFetcherUtils = {
|
|||||||
/**
|
/**
|
||||||
* Calculate the time correction, either dst/std or full day in cases where
|
* Calculate the time correction, either dst/std or full day in cases where
|
||||||
* utc time is day before plus offset
|
* utc time is day before plus offset
|
||||||
*
|
|
||||||
* @param {object} event the event which needs adjustment
|
* @param {object} event the event which needs adjustment
|
||||||
* @param {Date} date the date on which this event happens
|
* @param {Date} date the date on which this event happens
|
||||||
* @returns {number} the necessary adjustment in hours
|
* @returns {number} the necessary adjustment in hours
|
||||||
@ -119,7 +118,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the events from ical according to the given config
|
* Filter the events from ical according to the given config
|
||||||
*
|
|
||||||
* @param {object} data the calendar data from ical
|
* @param {object} data the calendar data from ical
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
* @returns {string[]} the filtered events
|
* @returns {string[]} the filtered events
|
||||||
@ -511,7 +509,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup iana tz from windows
|
* Lookup iana tz from windows
|
||||||
*
|
|
||||||
* @param {string} msTZName the timezone name to lookup
|
* @param {string} msTZName the timezone name to lookup
|
||||||
* @returns {string|null} the iana name or null of none is found
|
* @returns {string|null} the iana name or null of none is found
|
||||||
*/
|
*/
|
||||||
@ -524,7 +521,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the title from the event.
|
* Gets the title from the event.
|
||||||
*
|
|
||||||
* @param {object} event The event object to check.
|
* @param {object} event The event object to check.
|
||||||
* @returns {string} The title of the event, or "Event" if no title is found.
|
* @returns {string} The title of the event, or "Event" if no title is found.
|
||||||
*/
|
*/
|
||||||
@ -541,7 +537,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an event is a fullday event.
|
* Checks if an event is a fullday event.
|
||||||
*
|
|
||||||
* @param {object} event The event object to check.
|
* @param {object} event The event object to check.
|
||||||
* @returns {boolean} True if the event is a fullday event, false otherwise
|
* @returns {boolean} True if the event is a fullday event, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -563,7 +558,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the user defined time filter should apply
|
* Determines if the user defined time filter should apply
|
||||||
*
|
|
||||||
* @param {Date} now Date object using previously created object for consistency
|
* @param {Date} now Date object using previously created object for consistency
|
||||||
* @param {Moment} endDate Moment object representing the event end date
|
* @param {Moment} endDate Moment object representing the event end date
|
||||||
* @param {string} filter The time to subtract from the end date to determine if an event should be shown
|
* @param {string} filter The time to subtract from the end date to determine if an event should be shown
|
||||||
@ -584,7 +578,6 @@ const CalendarFetcherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the user defined title filter should apply
|
* Determines if the user defined title filter should apply
|
||||||
*
|
|
||||||
* @param {string} title the title of the event
|
* @param {string} title the title of the event
|
||||||
* @param {string} filter the string to look for, can be a regex also
|
* @param {string} filter the string to look for, can be a regex also
|
||||||
* @param {boolean} useRegex true if a regex should be used, otherwise it just looks for the filter as a string
|
* @param {boolean} useRegex true if a regex should be used, otherwise it just looks for the filter as a string
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
const CalendarUtils = {
|
const CalendarUtils = {
|
||||||
/**
|
/**
|
||||||
* Capitalize the first letter of a string
|
* Capitalize the first letter of a string
|
||||||
*
|
|
||||||
* @param {string} string The string to capitalize
|
* @param {string} string The string to capitalize
|
||||||
* @returns {string} The capitalized string
|
* @returns {string} The capitalized string
|
||||||
*/
|
*/
|
||||||
@ -19,7 +18,6 @@ const CalendarUtils = {
|
|||||||
* This function accepts a number (either 12 or 24) and returns a moment.js LocaleSpecification with the
|
* This function accepts a number (either 12 or 24) and returns a moment.js LocaleSpecification with the
|
||||||
* corresponding time-format to be used in the calendar display. If no number is given (or otherwise invalid input)
|
* corresponding time-format to be used in the calendar display. If no number is given (or otherwise invalid input)
|
||||||
* it will a localeSpecification object with the system locale time format.
|
* it will a localeSpecification object with the system locale time format.
|
||||||
*
|
|
||||||
* @param {number} timeFormat Specifies either 12 or 24-hour time format
|
* @param {number} timeFormat Specifies either 12 or 24-hour time format
|
||||||
* @returns {moment.LocaleSpecification} formatted time
|
* @returns {moment.LocaleSpecification} formatted time
|
||||||
*/
|
*/
|
||||||
@ -39,7 +37,6 @@ const CalendarUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortens a string if it's longer than maxLength and add an ellipsis to the end
|
* Shortens a string if it's longer than maxLength and add an ellipsis to the end
|
||||||
*
|
|
||||||
* @param {string} string Text string to shorten
|
* @param {string} string Text string to shorten
|
||||||
* @param {number} maxLength The max length of the string
|
* @param {number} maxLength The max length of the string
|
||||||
* @param {boolean} wrapEvents Wrap the text after the line has reached maxLength
|
* @param {boolean} wrapEvents Wrap the text after the line has reached maxLength
|
||||||
@ -94,7 +91,6 @@ const CalendarUtils = {
|
|||||||
* Transforms the title of an event for usage.
|
* Transforms the title of an event for usage.
|
||||||
* Replaces parts of the text as defined in config.titleReplace.
|
* Replaces parts of the text as defined in config.titleReplace.
|
||||||
* Shortens title based on config.maxTitleLength and config.wrapEvents
|
* Shortens title based on config.maxTitleLength and config.wrapEvents
|
||||||
*
|
|
||||||
* @param {string} title The title to transform.
|
* @param {string} title The title to transform.
|
||||||
* @param {object} titleReplace Pairs of strings to be replaced in the title
|
* @param {object} titleReplace Pairs of strings to be replaced in the title
|
||||||
* @returns {string} The transformed title.
|
* @returns {string} The transformed title.
|
||||||
|
@ -33,7 +33,6 @@ module.exports = NodeHelper.create({
|
|||||||
/**
|
/**
|
||||||
* Creates a fetcher for a new url if it doesn't exist yet.
|
* Creates a fetcher for a new url if it doesn't exist yet.
|
||||||
* Otherwise it reuses the existing one.
|
* Otherwise it reuses the existing one.
|
||||||
*
|
|
||||||
* @param {string} url The url of the calendar
|
* @param {string} url The url of the calendar
|
||||||
* @param {number} fetchInterval How often does the calendar needs to be fetched in ms
|
* @param {number} fetchInterval How often does the calendar needs to be fetched in ms
|
||||||
* @param {string[]} excludedEvents An array of words / phrases from event titles that will be excluded from being shown.
|
* @param {string[]} excludedEvents An array of words / phrases from event titles that will be excluded from being shown.
|
||||||
|
@ -52,7 +52,6 @@ Module.register("compliments", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a random index for a list of compliments.
|
* Generate a random index for a list of compliments.
|
||||||
*
|
|
||||||
* @param {string[]} compliments Array with compliments.
|
* @param {string[]} compliments Array with compliments.
|
||||||
* @returns {number} a random index of given array
|
* @returns {number} a random index of given array
|
||||||
*/
|
*/
|
||||||
@ -78,7 +77,6 @@ Module.register("compliments", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an array of compliments for the time of the day.
|
* Retrieve an array of compliments for the time of the day.
|
||||||
*
|
|
||||||
* @returns {string[]} array with compliments for the time of the day.
|
* @returns {string[]} array with compliments for the time of the day.
|
||||||
*/
|
*/
|
||||||
complimentArray: function () {
|
complimentArray: function () {
|
||||||
@ -115,7 +113,6 @@ Module.register("compliments", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a file from the local filesystem
|
* Retrieve a file from the local filesystem
|
||||||
*
|
|
||||||
* @returns {Promise} Resolved when the file is loaded
|
* @returns {Promise} Resolved when the file is loaded
|
||||||
*/
|
*/
|
||||||
loadComplimentFile: async function () {
|
loadComplimentFile: async function () {
|
||||||
@ -127,7 +124,6 @@ Module.register("compliments", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a random compliment.
|
* Retrieve a random compliment.
|
||||||
*
|
|
||||||
* @returns {string} a compliment
|
* @returns {string} a compliment
|
||||||
*/
|
*/
|
||||||
getRandomCompliment: function () {
|
getRandomCompliment: function () {
|
||||||
|
@ -179,7 +179,6 @@ Module.register("newsfeed", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an ordered list of items for this configured module.
|
* Generate an ordered list of items for this configured module.
|
||||||
*
|
|
||||||
* @param {object} feeds An object with feeds returned by the node helper.
|
* @param {object} feeds An object with feeds returned by the node helper.
|
||||||
*/
|
*/
|
||||||
generateFeed: function (feeds) {
|
generateFeed: function (feeds) {
|
||||||
@ -272,7 +271,6 @@ Module.register("newsfeed", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this module is configured to show this feed.
|
* Check if this module is configured to show this feed.
|
||||||
*
|
|
||||||
* @param {string} feedUrl Url of the feed to check.
|
* @param {string} feedUrl Url of the feed to check.
|
||||||
* @returns {boolean} True if it is subscribed, false otherwise
|
* @returns {boolean} True if it is subscribed, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -287,7 +285,6 @@ Module.register("newsfeed", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns title for the specific feed url.
|
* Returns title for the specific feed url.
|
||||||
*
|
|
||||||
* @param {string} feedUrl Url of the feed
|
* @param {string} feedUrl Url of the feed
|
||||||
* @returns {string} The title of the feed
|
* @returns {string} The title of the feed
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,6 @@ const NodeHelper = require("node_helper");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for requesting an update on the set interval and broadcasting the data.
|
* Responsible for requesting an update on the set interval and broadcasting the data.
|
||||||
*
|
|
||||||
* @param {string} url URL of the news feed.
|
* @param {string} url URL of the news feed.
|
||||||
* @param {number} reloadInterval Reload interval in milliseconds.
|
* @param {number} reloadInterval Reload interval in milliseconds.
|
||||||
* @param {string} encoding Encoding of the feed.
|
* @param {string} encoding Encoding of the feed.
|
||||||
@ -137,7 +136,6 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the reload interval, but only if we need to increase the speed.
|
* Update the reload interval, but only if we need to increase the speed.
|
||||||
*
|
|
||||||
* @param {number} interval Interval for the update in milliseconds.
|
* @param {number} interval Interval for the update in milliseconds.
|
||||||
*/
|
*/
|
||||||
this.setReloadInterval = function (interval) {
|
this.setReloadInterval = function (interval) {
|
||||||
|
@ -26,7 +26,6 @@ module.exports = NodeHelper.create({
|
|||||||
/**
|
/**
|
||||||
* Creates a fetcher for a new feed if it doesn't exist yet.
|
* Creates a fetcher for a new feed if it doesn't exist yet.
|
||||||
* Otherwise it reuses the existing one.
|
* Otherwise it reuses the existing one.
|
||||||
*
|
|
||||||
* @param {object} feed The feed object
|
* @param {object} feed The feed object
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* A function to make HTTP requests via the server to avoid CORS-errors.
|
* A function to make HTTP requests via the server to avoid CORS-errors.
|
||||||
*
|
|
||||||
* @param {string} url the url to fetch from
|
* @param {string} url the url to fetch from
|
||||||
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
|
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
|
||||||
* @param {boolean} useCorsProxy A flag to indicate
|
* @param {boolean} useCorsProxy A flag to indicate
|
||||||
@ -35,7 +34,6 @@ async function performWebRequest(url, type = "json", useCorsProxy = false, reque
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a URL that will be used when calling the CORS-method on the server.
|
* Gets a URL that will be used when calling the CORS-method on the server.
|
||||||
*
|
|
||||||
* @param {string} url the url to fetch from
|
* @param {string} url the url to fetch from
|
||||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||||
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
||||||
@ -66,7 +64,6 @@ const getCorsUrl = function (url, requestHeaders, expectedResponseHeaders) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the part of the CORS URL that represents the HTTP headers to send.
|
* Gets the part of the CORS URL that represents the HTTP headers to send.
|
||||||
*
|
|
||||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||||
* @returns {string} to be used as request-headers component in CORS URL.
|
* @returns {string} to be used as request-headers component in CORS URL.
|
||||||
*/
|
*/
|
||||||
@ -87,7 +84,6 @@ const getRequestHeaderString = function (requestHeaders) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets headers and values to attach to the web request.
|
* Gets headers and values to attach to the web request.
|
||||||
*
|
|
||||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||||
* @returns {object} An object specifying name and value of the headers.
|
* @returns {object} An object specifying name and value of the headers.
|
||||||
*/
|
*/
|
||||||
@ -104,7 +100,6 @@ const getHeadersToSend = (requestHeaders) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the part of the CORS URL that represents the expected HTTP headers to receive.
|
* Gets the part of the CORS URL that represents the expected HTTP headers to receive.
|
||||||
*
|
|
||||||
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
||||||
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
|
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
|
||||||
*/
|
*/
|
||||||
@ -125,7 +120,6 @@ const getExpectedResponseHeadersString = function (expectedResponseHeaders) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the values for the expected headers from the response.
|
* Gets the values for the expected headers from the response.
|
||||||
*
|
|
||||||
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
* @param {Array.<string>} expectedResponseHeaders the expected HTTP headers to receive
|
||||||
* @param {Response} response the HTTP response
|
* @param {Response} response the HTTP response
|
||||||
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
|
* @returns {string} to be used as the expected HTTP-headers component in CORS URL.
|
||||||
@ -145,7 +139,6 @@ const getHeadersFromResponse = (expectedResponseHeaders, response) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the time according to the config
|
* Format the time according to the config
|
||||||
*
|
|
||||||
* @param {object} config The config of the module
|
* @param {object} config The config of the module
|
||||||
* @param {object} time time to format
|
* @param {object} time time to format
|
||||||
* @returns {string} The formatted time string
|
* @returns {string} The formatted time string
|
||||||
|
@ -194,7 +194,6 @@ WeatherProvider.register("openmeteo", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides method for setting config to check if endpoint is correct for hourly
|
* Overrides method for setting config to check if endpoint is correct for hourly
|
||||||
*
|
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
*/
|
*/
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
|
@ -90,7 +90,6 @@ WeatherProvider.register("openweathermap", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides method for setting config to check if endpoint is correct for hourly
|
* Overrides method for setting config to check if endpoint is correct for hourly
|
||||||
*
|
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
*/
|
*/
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
|
@ -69,7 +69,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides method for setting config with checks for the precipitationValue being unset or invalid
|
* Overrides method for setting config with checks for the precipitationValue being unset or invalid
|
||||||
*
|
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
*/
|
*/
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
@ -82,7 +81,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Of all the times returned find out which one is closest to the current time, should be the first if the data isn't old.
|
* Of all the times returned find out which one is closest to the current time, should be the first if the data isn't old.
|
||||||
*
|
|
||||||
* @param {object[]} times Array of time objects
|
* @param {object[]} times Array of time objects
|
||||||
* @returns {object} The weatherdata closest to the current time
|
* @returns {object} The weatherdata closest to the current time
|
||||||
*/
|
*/
|
||||||
@ -100,7 +98,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the forecast url for the configured coordinates
|
* Get the forecast url for the configured coordinates
|
||||||
*
|
|
||||||
* @returns {string} the url for the specified coordinates
|
* @returns {string} the url for the specified coordinates
|
||||||
*/
|
*/
|
||||||
getURL() {
|
getURL() {
|
||||||
@ -115,7 +112,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the apparent temperature based on known atmospheric data.
|
* Calculates the apparent temperature based on known atmospheric data.
|
||||||
*
|
|
||||||
* @param {object} weatherData Weatherdata to use for the calculation
|
* @param {object} weatherData Weatherdata to use for the calculation
|
||||||
* @returns {number} The apparent temperature
|
* @returns {number} The apparent temperature
|
||||||
*/
|
*/
|
||||||
@ -132,7 +128,6 @@ WeatherProvider.register("smhi", {
|
|||||||
* Converts the returned data into a WeatherObject with required properties set for both current weather and forecast.
|
* Converts the returned data into a WeatherObject with required properties set for both current weather and forecast.
|
||||||
* The returned units is always in metric system.
|
* The returned units is always in metric system.
|
||||||
* Requires coordinates to determine if its daytime or nighttime to know which icon to use and also to set sunrise and sunset.
|
* Requires coordinates to determine if its daytime or nighttime to know which icon to use and also to set sunrise and sunset.
|
||||||
*
|
|
||||||
* @param {object} weatherData Weatherdata to convert
|
* @param {object} weatherData Weatherdata to convert
|
||||||
* @param {object} coordinates Coordinates of the locations of the weather
|
* @param {object} coordinates Coordinates of the locations of the weather
|
||||||
* @returns {WeatherObject} The converted weatherdata at the specified location
|
* @returns {WeatherObject} The converted weatherdata at the specified location
|
||||||
@ -178,7 +173,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes all the data points and converts it to one WeatherObject per day.
|
* Takes all the data points and converts it to one WeatherObject per day.
|
||||||
*
|
|
||||||
* @param {object[]} allWeatherData Array of weatherdata
|
* @param {object[]} allWeatherData Array of weatherdata
|
||||||
* @param {object} coordinates Coordinates of the locations of the weather
|
* @param {object} coordinates Coordinates of the locations of the weather
|
||||||
* @param {string} groupBy The interval to use for grouping the data (day, hour)
|
* @param {string} groupBy The interval to use for grouping the data (day, hour)
|
||||||
@ -230,7 +224,6 @@ WeatherProvider.register("smhi", {
|
|||||||
/**
|
/**
|
||||||
* Resolve coordinates from the response data (probably preferably to use
|
* Resolve coordinates from the response data (probably preferably to use
|
||||||
* this if it's not matching the config values exactly)
|
* this if it's not matching the config values exactly)
|
||||||
*
|
|
||||||
* @param {object} data Response data from the weather service
|
* @param {object} data Response data from the weather service
|
||||||
* @returns {{lon, lat}} the lat/long coordinates of the data
|
* @returns {{lon, lat}} the lat/long coordinates of the data
|
||||||
*/
|
*/
|
||||||
@ -241,7 +234,6 @@ WeatherProvider.register("smhi", {
|
|||||||
/**
|
/**
|
||||||
* The distance between the data points is increasing in the data the more distant the prediction is.
|
* The distance between the data points is increasing in the data the more distant the prediction is.
|
||||||
* Find these gaps and fill them with the previous hours data to make the data returned a complete set.
|
* Find these gaps and fill them with the previous hours data to make the data returned a complete set.
|
||||||
*
|
|
||||||
* @param {object[]} data Response data from the weather service
|
* @param {object[]} data Response data from the weather service
|
||||||
* @returns {object[]} Given data with filled gaps
|
* @returns {object[]} Given data with filled gaps
|
||||||
*/
|
*/
|
||||||
@ -263,7 +255,6 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to get a property from the returned data set.
|
* Helper method to get a property from the returned data set.
|
||||||
*
|
|
||||||
* @param {object} currentWeatherData Weatherdata to get from
|
* @param {object} currentWeatherData Weatherdata to get from
|
||||||
* @param {string} name The name of the property
|
* @param {string} name The name of the property
|
||||||
* @returns {*} The value of the property in the weatherdata
|
* @returns {*} The value of the property in the weatherdata
|
||||||
@ -276,7 +267,6 @@ WeatherProvider.register("smhi", {
|
|||||||
* Map the icon value from SMHI to an icon that MagicMirror² understands.
|
* Map the icon value from SMHI to an icon that MagicMirror² understands.
|
||||||
* Uses different icons depending on if its daytime or nighttime.
|
* Uses different icons depending on if its daytime or nighttime.
|
||||||
* SMHI's description of what the numeric value means is the comment after the case.
|
* SMHI's description of what the numeric value means is the comment after the case.
|
||||||
*
|
|
||||||
* @param {number} input The SMHI icon value
|
* @param {number} input The SMHI icon value
|
||||||
* @param {boolean} isDayTime True if the icon should be for daytime, false for nighttime
|
* @param {boolean} isDayTime True if the icon should be for daytime, false for nighttime
|
||||||
* @returns {string} The icon name for the MagicMirror
|
* @returns {string} The icon name for the MagicMirror
|
||||||
|
@ -189,7 +189,6 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an url with api parameters based on the config.
|
* Generates an url with api parameters based on the config.
|
||||||
*
|
|
||||||
* @param {string} forecastType daily or 3hourly forecast
|
* @param {string} forecastType daily or 3hourly forecast
|
||||||
* @returns {string} url
|
* @returns {string} url
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,6 @@ WeatherProvider.register("weatherbit", {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides method for setting config to check if endpoint is correct for hourly
|
* Overrides method for setting config to check if endpoint is correct for hourly
|
||||||
*
|
|
||||||
* @param {object} config The configuration object
|
* @param {object} config The configuration object
|
||||||
*/
|
*/
|
||||||
setConfig(config) {
|
setConfig(config) {
|
||||||
|
@ -75,7 +75,6 @@ class WeatherObject {
|
|||||||
/**
|
/**
|
||||||
* Determines if the sun sets or rises next. Uses the current time and not
|
* Determines if the sun sets or rises next. Uses the current time and not
|
||||||
* the date from the weather-forecast.
|
* the date from the weather-forecast.
|
||||||
*
|
|
||||||
* @param {Moment} date an optional date where you want to get the next
|
* @param {Moment} date an optional date where you want to get the next
|
||||||
* action for. Useful only in tests, defaults to the current time.
|
* action for. Useful only in tests, defaults to the current time.
|
||||||
* @returns {string} "sunset" or "sunrise"
|
* @returns {string} "sunset" or "sunrise"
|
||||||
@ -93,7 +92,6 @@ class WeatherObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the weatherObject is at dayTime.
|
* Checks if the weatherObject is at dayTime.
|
||||||
*
|
|
||||||
* @returns {boolean} true if it is at dayTime
|
* @returns {boolean} true if it is at dayTime
|
||||||
*/
|
*/
|
||||||
isDayTime() {
|
isDayTime() {
|
||||||
@ -105,7 +103,6 @@ class WeatherObject {
|
|||||||
* Update the sunrise / sunset time depending on the location. This can be
|
* Update the sunrise / sunset time depending on the location. This can be
|
||||||
* used if your provider doesn't provide that data by itself. Then SunCalc
|
* used if your provider doesn't provide that data by itself. Then SunCalc
|
||||||
* is used here to calculate them according to the location.
|
* is used here to calculate them according to the location.
|
||||||
*
|
|
||||||
* @param {number} lat latitude
|
* @param {number} lat latitude
|
||||||
* @param {number} lon longitude
|
* @param {number} lon longitude
|
||||||
*/
|
*/
|
||||||
@ -121,7 +118,6 @@ class WeatherObject {
|
|||||||
*
|
*
|
||||||
* Before being handed to other modules, mutable values must be cloned safely.
|
* Before being handed to other modules, mutable values must be cloned safely.
|
||||||
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
|
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
|
||||||
*
|
|
||||||
* @returns {object} plained object clone of original weatherObject
|
* @returns {object} plained object clone of original weatherObject
|
||||||
*/
|
*/
|
||||||
simpleClone() {
|
simpleClone() {
|
||||||
|
@ -113,7 +113,6 @@ const WeatherProvider = Class.extend({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenience function to make requests.
|
* A convenience function to make requests.
|
||||||
*
|
|
||||||
* @param {string} url the url to fetch from
|
* @param {string} url the url to fetch from
|
||||||
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
|
* @param {string} type what contenttype to expect in the response, can be "json" or "xml"
|
||||||
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
* @param {Array.<{name: string, value:string}>} requestHeaders the HTTP headers to send
|
||||||
@ -138,7 +137,6 @@ WeatherProvider.providers = [];
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Static method to register a new weather provider.
|
* Static method to register a new weather provider.
|
||||||
*
|
|
||||||
* @param {string} providerIdentifier The name of the weather provider
|
* @param {string} providerIdentifier The name of the weather provider
|
||||||
* @param {object} providerDetails The details of the weather provider
|
* @param {object} providerDetails The details of the weather provider
|
||||||
*/
|
*/
|
||||||
@ -148,7 +146,6 @@ WeatherProvider.register = function (providerIdentifier, providerDetails) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Static method to initialize a new weather provider.
|
* Static method to initialize a new weather provider.
|
||||||
*
|
|
||||||
* @param {string} providerIdentifier The name of the weather provider
|
* @param {string} providerIdentifier The name of the weather provider
|
||||||
* @param {object} delegate The weather module
|
* @param {object} delegate The weather module
|
||||||
* @returns {object} The new weather provider
|
* @returns {object} The new weather provider
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
const WeatherUtils = {
|
const WeatherUtils = {
|
||||||
/**
|
/**
|
||||||
* Convert wind (from m/s) to beaufort scale
|
* Convert wind (from m/s) to beaufort scale
|
||||||
*
|
|
||||||
* @param {number} speedInMS the windspeed you want to convert
|
* @param {number} speedInMS the windspeed you want to convert
|
||||||
* @returns {number} the speed in beaufort
|
* @returns {number} the speed in beaufort
|
||||||
*/
|
*/
|
||||||
@ -25,7 +24,6 @@ const WeatherUtils = {
|
|||||||
/**
|
/**
|
||||||
* Convert a value in a given unit to a string with a converted
|
* Convert a value in a given unit to a string with a converted
|
||||||
* value and a postfix matching the output unit system.
|
* value and a postfix matching the output unit system.
|
||||||
*
|
|
||||||
* @param {number} value - The value to convert.
|
* @param {number} value - The value to convert.
|
||||||
* @param {string} valueUnit - The unit the values has. Default is mm.
|
* @param {string} valueUnit - The unit the values has. Default is mm.
|
||||||
* @param {string} outputUnit - The unit system (imperial/metric) the return value should have.
|
* @param {string} outputUnit - The unit system (imperial/metric) the return value should have.
|
||||||
@ -50,7 +48,6 @@ const WeatherUtils = {
|
|||||||
/**
|
/**
|
||||||
* Convert temp (from degrees C) into imperial or metric unit depending on
|
* Convert temp (from degrees C) into imperial or metric unit depending on
|
||||||
* your config
|
* your config
|
||||||
*
|
|
||||||
* @param {number} tempInC the temperature in celsius you want to convert
|
* @param {number} tempInC the temperature in celsius you want to convert
|
||||||
* @param {string} unit can be 'imperial' or 'metric'
|
* @param {string} unit can be 'imperial' or 'metric'
|
||||||
* @returns {number} the converted temperature
|
* @returns {number} the converted temperature
|
||||||
@ -61,7 +58,6 @@ const WeatherUtils = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert wind speed into another unit.
|
* Convert wind speed into another unit.
|
||||||
*
|
|
||||||
* @param {number} windInMS the windspeed in meter/sec you want to convert
|
* @param {number} windInMS the windspeed in meter/sec you want to convert
|
||||||
* @param {string} unit can be 'beaufort', 'kmh', 'knots, 'imperial' (mph)
|
* @param {string} unit can be 'beaufort', 'kmh', 'knots, 'imperial' (mph)
|
||||||
* or 'metric' (mps)
|
* or 'metric' (mps)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Suppresses errors concerning web server already shut down.
|
* Suppresses errors concerning web server already shut down.
|
||||||
*
|
|
||||||
* @param {string} err The error message.
|
* @param {string} err The error message.
|
||||||
*/
|
*/
|
||||||
const mockError = (err) => {
|
const mockError = (err) => {
|
||||||
|
@ -3,7 +3,6 @@ const helpers = require("../helpers/global-setup");
|
|||||||
describe("Compliments module", () => {
|
describe("Compliments module", () => {
|
||||||
/**
|
/**
|
||||||
* move similar tests in function doTest
|
* move similar tests in function doTest
|
||||||
*
|
|
||||||
* @param {Array} complimentsArray The array of compliments.
|
* @param {Array} complimentsArray The array of compliments.
|
||||||
*/
|
*/
|
||||||
const doTest = async (complimentsArray) => {
|
const doTest = async (complimentsArray) => {
|
||||||
|
@ -3,7 +3,6 @@ const helpers = require("../helpers/global-setup");
|
|||||||
describe("Calendar module", () => {
|
describe("Calendar module", () => {
|
||||||
/**
|
/**
|
||||||
* move similar tests in function doTest
|
* move similar tests in function doTest
|
||||||
*
|
|
||||||
* @param {string} cssClass css selector
|
* @param {string} cssClass css selector
|
||||||
*/
|
*/
|
||||||
const doTest = async (cssClass) => {
|
const doTest = async (cssClass) => {
|
||||||
|
@ -3,7 +3,6 @@ const helpers = require("../helpers/global-setup");
|
|||||||
describe("Compliments module", () => {
|
describe("Compliments module", () => {
|
||||||
/**
|
/**
|
||||||
* move similar tests in function doTest
|
* move similar tests in function doTest
|
||||||
*
|
|
||||||
* @param {Array} complimentsArray The array of compliments.
|
* @param {Array} complimentsArray The array of compliments.
|
||||||
*/
|
*/
|
||||||
const doTest = async (complimentsArray) => {
|
const doTest = async (complimentsArray) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user