app/assets/javascripts/lato_view/build/Util.js in lato_view-1.1.4 vs app/assets/javascripts/lato_view/build/Util.js in lato_view-1.1.5

- old
+ new

@@ -1,16 +1,16 @@ var Util = (function($) { 'use strict'; /* * Debounce any function - * @params: + * @params: * func: function to test. * wait: the time interval for the next function execution. * immediate: triggers the function on the leading edge, instead of the trailing. * @return: a function, that, as long as it continues to be invoked, will not be triggered. - */ + */ var debounce = function(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { @@ -24,42 +24,42 @@ }; }; /* * Check if the value given is a number. - * @params: + * @params: * value: value to test * @return: boolean */ var isNumber = function(value) { return !Number(value); }; /* * Check if two strings have the same value. - * @params: + * @params: * firstValue: value to test. * secondValue: value to compare to. * @return: boolean */ var isEqual = function(firstValue, secondValue) { return firstValue === secondValue ? true : false; }; /* * Check if a string is empty - * @params: + * @params: * value: value to test * @return: boolean */ var isEmptyString = function(value) { return value === ''; }; /* * Check if the lenght of a given value respects the limit given. - * @params: + * @params: * el: element to test * limit: limit to give. Ex: max, min, between * minValue: minimum value to respect * maxValue: maximum value to respect * @return: boolean @@ -78,14 +78,30 @@ } else { return false; } }; + /* + * Goes through each item in the array and ask "Will you work?" + * @params: + * properties: properties to test + * @return: boolean + */ + var getSupportedPropertyName = function(properties) { + for (var i = 0; i < properties.length; i++) { + if (typeof document.body.style[properties[i]] !== 'undefined') { + return properties[i]; + } + } + return null; + } + return { debounce: debounce, isNumber: isNumber, isEqual: isEqual, isEmptyString: isEmptyString, - checkLength: checkLength + checkLength: checkLength, + getSupportedPropertyName: getSupportedPropertyName }; - -})(jQuery); \ No newline at end of file + +})(jQuery);