From d44325501aa3bb01d190c2c7cd4ed3a5f8d2ad8b Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 5 Jun 2019 14:53:33 +0900 Subject: [PATCH] Add non => function setups for some calls in case --- www/layout/admin/javascript/edit.jq.js | 17 ++++++++++++++++- www/layout/admin/javascript/edit.pt.js | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/www/layout/admin/javascript/edit.jq.js b/www/layout/admin/javascript/edit.jq.js index 33543ab0..3fa4136f 100644 --- a/www/layout/admin/javascript/edit.jq.js +++ b/www/layout/admin/javascript/edit.jq.js @@ -224,6 +224,7 @@ function getTimestamp() // METHOD: isObject // PARAMS: possible object // RETURN: true/false if it is an object or not +// DESC : checks if a variable is an object function isObject(val) { if (val === null) { return false; @@ -231,11 +232,25 @@ function isObject(val) { return ((typeof val === 'function') || (typeof val === 'object')); } +// METHOD: keyInObject +// PARAMS: key name, object +// RETURN: true/false if key exists in object +// DESC : checks if a key exists in a given object +const keyInObject = (key, object) => (key in object) ? true : false; +/*function keyInObject(key, object) +{ + return (key in object) ? true : false; +}*/ + // METHOD: exists // PARAMS: uid // RETURN: true/false // DESC : checks if a DOM element actually exists -const exists = (id) => $('#' + id) ? true : false; +const exists = (id) => $('#' + id).length > 0 ? true : false; +/*function exists(id) +{ + return $('#' + id).length > 0 ? true : false; +}*/ // METHOD: formatBytes // PARAMS: bytes in int diff --git a/www/layout/admin/javascript/edit.pt.js b/www/layout/admin/javascript/edit.pt.js index 68a87a80..92c05aa3 100644 --- a/www/layout/admin/javascript/edit.pt.js +++ b/www/layout/admin/javascript/edit.pt.js @@ -302,6 +302,7 @@ function getTimestamp() // METHOD: isObject // PARAMS: possible object // RETURN: true/false if it is an object or not +// DESC : checks if a variable is an object function isObject(val) { if (val === null) { return false; @@ -309,11 +310,25 @@ function isObject(val) { return ((typeof val === 'function') || (typeof val === 'object')); } +// METHOD: keyInObject +// PARAMS: key name, object +// RETURN: true/false if key exists in object +// DESC : checks if a key exists in a given object +const keyInObject = (key, object) => (key in object) ? true : false; +/*function keyInObject(key, object) +{ + return (key in object) ? true : false; +}*/ + // METHOD: exists // PARAMS: uid // RETURN: true/false // DESC : checks if a DOM element actually exists -const exists = (id) => $(id) ? true : false; +const exists = (id) => $('#' + id).length > 0 ? true : false; +/*function exists(id) +{ + return $('#' + id).length > 0 ? true : false; +}*/ // METHOD: formatBytes // PARAMS: bytes in int