var slice = [].slice; var hasProp = {}.hasOwnProperty; if (this.Utils == null) { this.Utils = { modules: [] }; } var addClass = function(element, name) { removeClass(element, name); return element.className += " " + name + " "; }; var removeClass = function(element, name) { var regExp = new RegExp("(\\s|^)" + name + "(\\s|$)", "gi"); return element.className = element.className.replace(regExp, ""); }; var hasClass = function(element, name) { return new RegExp("(^| )" + name + "( |$)", "gi").test(element.className); }; var merge = function() { var extension; var i; var len; var property; var target = arguments[0]; var extensions = 2 <= arguments.length ? slice.call(arguments, 1) : []; for (i = 0, len = extensions.length; i < len; i++) { extension = extensions[i]; for (property in extension) { if (!hasProp.call(extension, property)) continue; target[property] = extension[property]; } } return target; }; var setOptions = function(options, defaults) { return merge({}, defaults, options); }; var deleteUndefined = function(obj) { var key; var value; var results = []; for (key in obj) { value = obj[key]; if (value === null || value === void 0) { results.push(delete obj[key]); } else { results.push(void 0); } } return results; }; var transformKey = (function() { var i; var key; var len; var el = document.createElement("div"); var transforms = ["transform", "webkitTransform", "OTransform", "MozTransform", "msTransform"]; for (i = 0, len = transforms.length; i < len; i++) { key = transforms[i]; if (el.style[key] !== void 0) { return key; } } })(); var requestAnimationFrame = (function(window) { var i; var len; var vendor; var ref = ["ms", "moz", "webkit", "o"]; for (i = 0, len = ref.length; i < len; i++) { vendor = ref[i]; if (window.requestAnimationFrame) { break; } window.requestAnimationFrame = window[vendor + "RequestAnimationFrame"]; } return window.requestAnimationFrame || (window.requestAnimationFrame = function(callback) { return setTimeout(callback, 1000 / 60); }); })(window); this.Utils = { addClass: addClass, removeClass: removeClass, hasClass: hasClass, merge: merge, setOptions: setOptions, deleteUndefined: deleteUndefined, transformKey: transformKey, requestAnimationFrame: requestAnimationFrame };