# HG changeset patch # User Thierry Florac # Date 1611923198 -3600 # Node ID 97e0aed858835ed4e3992f6da477edd72de38cf3 # Parent 708805889fe2ff8366d280f561fb29e131b98bd7 Return "undefined" for any "false" value diff -r 708805889fe2 -r 97e0aed85883 src/myams/resources/js/myams-core.js --- a/src/myams/resources/js/myams-core.js Wed Jan 27 16:10:36 2021 +0100 +++ b/src/myams/resources/js/myams-core.js Fri Jan 29 13:26:38 2021 +0100 @@ -319,12 +319,12 @@ * Get an object given by name */ MyAMS.getObject = function (objectName, context) { + if (typeof(objectName) !== 'string') { + return objectName; + } if (!objectName) { return undefined; } - if (typeof(objectName) !== 'string') { - return objectName; - } var namespaces = objectName.split("."); context = (context === undefined || context === null) ? window : context; for (var i = 0; i < namespaces.length; i++) { @@ -342,10 +342,11 @@ * Small piece of code by Jason Bunting */ MyAMS.getFunctionByName = function (functionName, context) { - if (functionName === undefined) { + if (typeof(functionName) === 'function') { + return functionName; + } + if (!functionName) { return undefined; - } else if (typeof(functionName) === 'function') { - return functionName; } var namespaces = functionName.split("."); var func = namespaces.pop(); diff -r 708805889fe2 -r 97e0aed85883 src/myams/resources/js/myams-core.min.js --- a/src/myams/resources/js/myams-core.min.js Wed Jan 27 16:10:36 2021 +0100 +++ b/src/myams/resources/js/myams-core.min.js Fri Jan 29 13:26:38 2021 +0100 @@ -1,1 +1,1 @@ -"use strict";!function(t,e){var n=e.console;String.prototype.startsWith=function(t){var e=this.length,n=t.length;return!(e0},void 0===t.scrollbarWidth&&(t.scrollbarWidth=function(){var e=t('
').appendTo("body"),n=e.children(),r=n.innerWidth()-n.height(99).innerWidth();return e.remove(),r}),t.fn.extend({exists:function(){return t(this).length>0},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(e){var n=[];return this.each((function(){n.push(t(this).attr(e))})),n},style:function(t,e,n){if(void 0!==this.get(0)){var r=this.get(0).style;return void 0!==t?void 0!==e?(n=void 0!==n?n:"",r.setProperty(t,e,n),this):r.getPropertyValue(t):r}},removeClassPrefix:function(e){return this.each((function(n,r){var a=r.className.split(" ").map((function(t){return t.startsWith(e)?"":t}));r.className=t.trim(a.join(" "))})),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,formChangedCallback:null,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var r,a=e.MyAMS,i=a;a.baseURL=(r=t('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src"),i.devmode=r.indexOf(".min.js")<0,i.devext=i.devmode?"":".min",r.substring(0,r.lastIndexOf("/")+1)),a.log=function(){n&&n.debug&&n.debug(this,arguments)},a.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var n=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),r=t.replace(n,"$1");return r!==t&&r},a.rgb2hex=function(e){return"#"+t.map(e.match(/\b(\d+)\b/g),(function(t){return("0"+parseInt(t).toString(16)).slice(-2)})).join("")},a.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},a.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},a.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var n=t.split(".");e=null==e?window:e;for(var r=0;r").attr("data-ams-id",n).text('@import "'+i.getSource(e)+'";'),r)var c=setInterval((function(){try{o[0].sheet.cssRules;clearInterval(c),r.call(window,!0,a)}catch(t){}}),10);o.appendTo(s)}else r&&r.call(window,!1,a)},a.initHandlers=function(e){t(e).on("click","[data-ams-click-handler]",(function(e){var n=t(this),r=n.data("ams-disabled-handlers");if(!0!==r&&"click"!==r&&"all"!==r){var a=n.data();if(a.amsClickHandler){!0!==a.amsStopPropagation&&!0!==a.amsClickStopPropagation||e.stopPropagation(),!0!==a.amsClickKeepDefault&&e.preventDefault();for(var s=a.amsClickHandler.split(/\s+/),o=0;o0},void 0===t.scrollbarWidth&&(t.scrollbarWidth=function(){var e=t('
').appendTo("body"),n=e.children(),r=n.innerWidth()-n.height(99).innerWidth();return e.remove(),r}),t.fn.extend({exists:function(){return t(this).length>0},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(e){var n=[];return this.each((function(){n.push(t(this).attr(e))})),n},style:function(t,e,n){if(void 0!==this.get(0)){var r=this.get(0).style;return void 0!==t?void 0!==e?(n=void 0!==n?n:"",r.setProperty(t,e,n),this):r.getPropertyValue(t):r}},removeClassPrefix:function(e){return this.each((function(n,r){var a=r.className.split(" ").map((function(t){return t.startsWith(e)?"":t}));r.className=t.trim(a.join(" "))})),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,formChangedCallback:null,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var r,a=e.MyAMS,i=a;a.baseURL=(r=t('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src"),i.devmode=r.indexOf(".min.js")<0,i.devext=i.devmode?"":".min",r.substring(0,r.lastIndexOf("/")+1)),a.log=function(){n&&n.debug&&n.debug(this,arguments)},a.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var n=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),r=t.replace(n,"$1");return r!==t&&r},a.rgb2hex=function(e){return"#"+t.map(e.match(/\b(\d+)\b/g),(function(t){return("0"+parseInt(t).toString(16)).slice(-2)})).join("")},a.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},a.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))},a.getObject=function(t,e){if("string"!=typeof t)return t;if(t){var n=t.split(".");e=null==e?window:e;for(var r=0;r").attr("data-ams-id",n).text('@import "'+i.getSource(e)+'";'),r)var c=setInterval((function(){try{o[0].sheet.cssRules;clearInterval(c),r.call(window,!0,a)}catch(t){}}),10);o.appendTo(s)}else r&&r.call(window,!1,a)},a.initHandlers=function(e){t(e).on("click","[data-ams-click-handler]",(function(e){var n=t(this),r=n.data("ams-disabled-handlers");if(!0!==r&&"click"!==r&&"all"!==r){var a=n.data();if(a.amsClickHandler){!0!==a.amsStopPropagation&&!0!==a.amsClickStopPropagation||e.stopPropagation(),!0!==a.amsClickKeepDefault&&e.preventDefault();for(var s=a.amsClickHandler.split(/\s+/),o=0;o