From 8704b5b454c65ce725ef4b6f3cdb76bc82b122d3 Mon Sep 17 00:00:00 2001 From: Julian Shapiro Date: Sat, 23 Aug 2014 14:34:52 -0700 Subject: [PATCH] 0.11.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropped support for the easeBack and easeElastic easings. They are rarely used, look stupid, and take up a bunch of lines. Sped up bezier curve easing performance. Thanks, @gre. The display option now gets browser-prefixed if necessary. This inherently adds cross-browser support for the ‘flex’ value. Closes #257. Fixed bug where slideDown/up left excess inline styles on elements. Closes #260. cc @kpeatt, @scalvert. Allow passing an empty string to `display` to remove the inline style from the element. Closes #184. Shimmed version of jQuery’s $.dequeue() now accepts a raw DOM element *set* instead of just a single element. You can now stop custom queues individually. Closes #262. --- packages/velocity/bower.json | 4 +- packages/velocity/jquery.velocity.js | 584 ++++++++++----------- packages/velocity/jquery.velocity.min.js | 4 +- packages/velocity/package.json | 4 +- packages/velocity/velocity.js | 627 +++++++++++------------ packages/velocity/velocity.min.js | 6 +- 6 files changed, 573 insertions(+), 656 deletions(-) diff --git a/packages/velocity/bower.json b/packages/velocity/bower.json index 91ca64c8..6c2e56d1 100644 --- a/packages/velocity/bower.json +++ b/packages/velocity/bower.json @@ -1,6 +1,6 @@ { "name": "velocity", - "version": "0.11.7", + "version": "0.11.8", "homepage": "http://velocityjs.org", "authors": [ { "name" : "Julian Shapiro", @@ -34,4 +34,4 @@ "type" : "git", "url" : "http://github.com/julianshapiro/velocity.git" } -} +} \ No newline at end of file diff --git a/packages/velocity/jquery.velocity.js b/packages/velocity/jquery.velocity.js index 3045b8cf..26fd73c6 100644 --- a/packages/velocity/jquery.velocity.js +++ b/packages/velocity/jquery.velocity.js @@ -2,18 +2,18 @@ Velocity.js ******************/ -/*! VelocityJS.org (0.11.7). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ +/*! VelocityJS.org (0.11.8). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ ;(function (factory) { /* CommonJS module. */ if (typeof module === "object" && typeof module.exports === "object") { module.exports = factory(window.Velocity ? window.jQuery : require("jquery")); /* AMD module. */ - } else if (typeof define === "function" && define.amd) { + } else if (typeof define === "function" && define.amd) { if (window.Velocity) { - define("velocity", factory); + define(factory); } else { - define("velocity", [ "jquery" ], factory) + define([ "jquery" ], factory); } /* Browser globals. */ } else { @@ -33,14 +33,6 @@ return function (global, window, document, undefined) { - completeCall(): Handles the cleanup process for each Velocity call. */ - /***************** - Constants - *****************/ - - var NAME = "velocity", - DEFAULT_DURATION = 400, - DEFAULT_EASING = "swing"; - /********************* Helper Functions *********************/ @@ -66,8 +58,8 @@ return function (global, window, document, undefined) { return undefined; })(); - /* rAF polyfill. Gist: https://gist.github.com/julianshapiro/9497513 */ - var rAFPollyfill = (function() { + /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ + var rAFShim = (function() { var timeLast = 0; return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { @@ -83,7 +75,7 @@ return function (global, window, document, undefined) { }; })(); - var ticker = window.requestAnimationFrame || rAFPollyfill; + var ticker = window.requestAnimationFrame || rAFShim; /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ function compactSparseArray (array) { @@ -192,12 +184,19 @@ return function (global, window, document, undefined) { /* Shorthand alias for jQuery's $.data() utility. */ function Data (element) { /* Hardcode a reference to the plugin name. */ - var response = $.data(element, NAME); + var response = $.data(element, "velocity"); /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ return response === null ? undefined : response; }; + /***************** + Constants + *****************/ + + var DURATION_DEFAULT = 400, + EASING_DEFAULT = "swing"; + /************* State *************/ @@ -244,12 +243,12 @@ return function (global, window, document, undefined) { /* Page-wide option defaults, which can be overriden by the user. */ defaults: { queue: "", - duration: DEFAULT_DURATION, - easing: DEFAULT_EASING, + duration: DURATION_DEFAULT, + easing: EASING_DEFAULT, begin: null, complete: null, progress: null, - display: null, + display: undefined, loop: false, delay: false, mobileHA: true, @@ -259,7 +258,7 @@ return function (global, window, document, undefined) { /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache instantiated on it. */ init: function (element) { - $.data(element, NAME, { + $.data(element, "velocity", { /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ isSVG: Type.isSVG(element), /* Keep track of whether the element is currently being animated by Velocity. @@ -281,44 +280,10 @@ return function (global, window, document, undefined) { /* Velocity's core animation method, later aliased to $.fn if a framework (jQuery or Zepto) is detected. */ animate: null, /* Defined below. */ /* A reimplementation of jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ - hook: function (elements, arg2, arg3) { - var value = undefined; - - /* Unwrap jQuery/Zepto objects. */ - if (Type.isWrapped(elements)) { - elements = [].slice.call(elements); - } - - $.each(createElementsArray(elements), function(i, element) { - /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ - if (Data(element) === undefined) { - Velocity.init(element); - } - - /* Get property value. If an element set was passed in, only return the value for the first element. */ - if (arg3 === undefined) { - if (value === undefined) { - value = Velocity.CSS.getPropertyValue(element, arg2); - } - /* Set property value. */ - } else { - /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ - var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); - - /* Transform properties don't automatically set. They have to be flushed to the DOM. */ - if (adjustedSet[0] === "transform") { - Velocity.CSS.flushTransformCache(element); - } - - value = adjustedSet; - } - }); - - return value; - }, + hook: null, /* Defined below. */ /* Set to true to force a duration of 1ms for all animations so that UI testing can be performed without waiting on animations to complete. */ mock: false, - version: { major: 0, minor: 11, patch: 7 }, + version: { major: 0, minor: 11, patch: 8 }, /* Set to 1 or 2 (most verbose) to output debug info to console. */ debug: false }; @@ -346,18 +311,39 @@ return function (global, window, document, undefined) { } /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ - var generateBezier = (function () { - function A (aA1, aA2) { - return 1.0 - 3.0 * aA2 + 3.0 * aA1; + function generateBezier (mX1, mY1, mX2, mY2) { + var NEWTON_ITERATIONS = 4, + NEWTON_MIN_SLOPE = 0.001, + SUBDIVISION_PRECISION = 0.0000001, + SUBDIVISION_MAX_ITERATIONS = 10, + kSplineTableSize = 11, + kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), + float32ArraySupported = "Float32Array" in window; + + /* Must contain four arguments. */ + if (arguments.length !== 4) { + return false; } - function B (aA1, aA2) { - return 3.0 * aA2 - 6.0 * aA1; - } - function C (aA1) { - return 3.0 * aA1; + /* Arguments must be numbers. */ + for (var i = 0; i < 4; ++i) { + if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { + return false; + } } + /* X values must be in the [0, 1] range. */ + mX1 = Math.min(mX1, 1); + mX2 = Math.min(mX2, 1); + mX1 = Math.max(mX1, 0); + mX2 = Math.max(mX2, 0); + + var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + + function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } + function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } + function C (aA1) { return 3.0 * aA1; } + function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; } @@ -366,56 +352,92 @@ return function (global, window, document, undefined) { return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } - return function (mX1, mY1, mX2, mY2) { - /* Must contain four arguments. */ - if (arguments.length !== 4) { - return false; + function newtonRaphsonIterate (aX, aGuessT) { + for (var i = 0; i < NEWTON_ITERATIONS; ++i) { + var currentSlope = getSlope(aGuessT, mX1, mX2); + + if (currentSlope === 0.0) return aGuessT; + + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; } - /* Arguments must be numbers. */ - for (var i = 0; i < 4; ++i) { - if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { - return false; - } + return aGuessT; + } + + function calcSampleValues () { + for (var i = 0; i < kSplineTableSize; ++i) { + mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); } + } - /* X values must be in the [0, 1] range. */ - mX1 = Math.min(mX1, 1); - mX2 = Math.min(mX2, 1); - mX1 = Math.max(mX1, 0); - mX2 = Math.max(mX2, 0); + function binarySubdivide (aX, aA, aB) { + var currentX, currentT, i = 0; - function getTForX (aX) { - var aGuessT = aX; + do { + currentT = aA + (aB - aA) / 2.0; + currentX = calcBezier(currentT, mX1, mX2) - aX; + if (currentX > 0.0) { + aB = currentT; + } else { + aA = currentT; + } + } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); - for (var i = 0; i < 8; ++i) { - var currentSlope = getSlope(aGuessT, mX1, mX2); + return currentT; + } - if (currentSlope === 0.0) { - return aGuessT; - } + function getTForX (aX) { + var intervalStart = 0.0, + currentSample = 1, + lastSample = kSplineTableSize - 1; + + for (; currentSample != lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { + intervalStart += kSampleStepSize; + } - var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + --currentSample; - aGuessT -= currentX / currentSlope; - } + var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]), + guessForT = intervalStart + dist * kSampleStepSize, + initialSlope = getSlope(guessForT, mX1, mX2); - return aGuessT; + if (initialSlope >= NEWTON_MIN_SLOPE) { + return newtonRaphsonIterate(aX, guessForT); + } else if (initialSlope == 0.0) { + return guessForT; + } else { + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); } + } - return function (aX) { - if (mX1 === mY1 && mX2 === mY2) { - return aX; - } else { - return calcBezier(getTForX(aX), mY1, mY2); - } - }; + var _precomputed = false; + + function precompute() { + _precomputed = true; + if (mX1 != mY1 || mX2 != mY2) calcSampleValues(); + } + + var f = function (aX) { + if (!_precomputed) precompute(); + if (mX1 === mY1 && mX2 === mY2) return aX; + if (aX === 0) return 0; + if (aX === 1) return 1; + + return calcBezier(getTForX(aX), mY1, mY2); }; - }()); + + f.getControlPoints = function() { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; + + var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; + f.toString = function () { return str; }; + + return f; + } /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass - then adjusts the time dela -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ + then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ var generateSpringRK4 = (function () { function springAccelerationForState (state) { @@ -501,77 +523,46 @@ return function (global, window, document, undefined) { }; }()); - /* Velocity embeds the named easings from jQuery, jQuery UI, and CSS3 in order to save users from having to include additional libraries on their page. */ - (function () { + /* Easings from jQuery, jQuery UI, and CSS3. */ + Velocity.Easings = { /* jQuery's default named easing types. */ - Velocity.Easings["linear"] = function(p) { - return p; - }; - - Velocity.Easings["swing"] = function(p) { - return 0.5 - Math.cos(p * Math.PI) / 2; - }; - + linear: function(p) { return p; }, + swing: function(p) { return 0.5 - Math.cos( p * Math.PI ) / 2 }, /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ - Velocity.Easings["spring"] = function(p) { - return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); - }; - - /* CSS3's named easing types. */ - Velocity.Easings["ease"] = generateBezier(0.25, 0.1, 0.25, 1.0); - Velocity.Easings["ease-in"] = generateBezier(0.42, 0.0, 1.00, 1.0); - Velocity.Easings["ease-out"] = generateBezier(0.00, 0.0, 0.58, 1.0); - Velocity.Easings["ease-in-out"] = generateBezier(0.42, 0.0, 0.58, 1.0); - - /* jQuery UI's Robert Penner easing equations. Copyright The jQuery Foundation. MIT License: https://jquery.org/license */ - var baseEasings = {}; - - $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(i, name) { - baseEasings[name] = function(p) { - return Math.pow(p, i + 2); - }; - }); - - $.extend(baseEasings, { - Sine: function (p) { - return 1 - Math.cos(p * Math.PI / 2); - }, - - Circ: function (p) { - return 1 - Math.sqrt(1 - p * p); - }, - - Elastic: function(p) { - return p === 0 || p === 1 ? p : - -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); - }, - - Back: function(p) { - return p * p * (3 * p - 2); - }, - - Bounce: function (p) { - var pow2, - bounce = 4; - - while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {} - return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); - } - }); - - /* jQuery's easing generator for the object above. */ - $.each(baseEasings, function(name, easeIn) { - Velocity.Easings["easeIn" + name] = easeIn; - Velocity.Easings["easeOut" + name] = function(p) { - return 1 - easeIn(1 - p); - }; - Velocity.Easings["easeInOut" + name] = function(p) { - return p < 0.5 ? - easeIn(p * 2) / 2 : - 1 - easeIn(p * -2 + 2) / 2; - }; + spring: function(p) { return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); } + }; + $.each( + [ + /* CSS3's named easing types. */ + [ "ease", [ 0.25, 0.1, 0.25, 1.0 ] ], + [ "ease-in", [ 0.42, 0.0, 1.00, 1.0 ] ], + [ "ease-out", [ 0.00, 0.0, 0.58, 1.0 ] ], + [ "ease-in-out", [ 0.42, 0.0, 0.58, 1.0 ] ], + /* Robert Penner easing equations. */ + [ "easeInSine", [ 0.47, 0, 0.745, 0.715 ] ], + [ "easeOutSine", [ 0.39, 0.575, 0.565, 1 ] ], + [ "easeInOutSine", [ 0.445, 0.05, 0.55, 0.95 ] ], + [ "easeInQuad", [ 0.55, 0.085, 0.68, 0.53 ] ], + [ "easeOutQuad", [ 0.25, 0.46, 0.45, 0.94 ] ], + [ "easeInOutQuad", [ 0.455, 0.03, 0.515, 0.955 ] ], + [ "easeInCubic", [ 0.55, 0.055, 0.675, 0.19 ] ], + [ "easeOutCubic", [ 0.215, 0.61, 0.355, 1 ] ], + [ "easeInOutCubic", [ 0.645, 0.045, 0.355, 1 ] ], + [ "easeInQuart", [ 0.895, 0.03, 0.685, 0.22 ] ], + [ "easeOutQuart", [ 0.165, 0.84, 0.44, 1 ] ], + [ "easeInOutQuart", [ 0.77, 0, 0.175, 1 ] ], + [ "easeInQuint", [ 0.755, 0.05, 0.855, 0.06 ] ], + [ "easeOutQuint", [ 0.23, 1, 0.32, 1 ] ], + [ "easeInOutQuint", [ 0.86, 0, 0.07, 1 ] ], + [ "easeInExpo", [ 0.95, 0.05, 0.795, 0.035 ] ], + [ "easeOutExpo", [ 0.19, 1, 0.22, 1 ] ], + [ "easeInOutExpo", [ 1, 0, 0, 1 ] ], + [ "easeInCirc", [ 0.6, 0.04, 0.98, 0.335 ] ], + [ "easeOutCirc", [ 0.075, 0.82, 0.165, 1 ] ], + [ "easeInOutCirc", [ 0.785, 0.135, 0.15, 0.86 ] ] + ], function(i, easingArray) { + Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); }); - })(); /* Determine the appropriate easing type given an easing input. */ function getEasing(value, duration) { @@ -604,7 +595,7 @@ return function (global, window, document, undefined) { if (Velocity.Easings[Velocity.defaults.easing]) { easing = Velocity.defaults.easing; } else { - easing = DEFAULT_EASING; + easing = EASING_DEFAULT; } } @@ -1209,7 +1200,6 @@ return function (global, window, document, undefined) { element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. We subtract border and padding to get the sum of interior + scrollbar. */ - var computedValue = 0; /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array @@ -1546,6 +1536,43 @@ return function (global, window, document, undefined) { CSS.Hooks.register(); CSS.Normalizations.register(); + /* Allow hook setting in the same fashion as jQuery's $.css(). */ + Velocity.hook = function (elements, arg2, arg3) { + var value = undefined; + + /* Unwrap jQuery/Zepto objects. */ + if (Type.isWrapped(elements)) { + elements = [].slice.call(elements); + } + + $.each(createElementsArray(elements), function(i, element) { + /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ + if (Data(element) === undefined) { + Velocity.init(element); + } + + /* Get property value. If an element set was passed in, only return the value for the first element. */ + if (arg3 === undefined) { + if (value === undefined) { + value = Velocity.CSS.getPropertyValue(element, arg2); + } + /* Set property value. */ + } else { + /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ + var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); + + /* Transform properties don't automatically set. They have to be flushed to the DOM. */ + if (adjustedSet[0] === "transform") { + Velocity.CSS.flushTransformCache(element); + } + + value = adjustedSet; + } + }); + + return value; + }; + /***************** Animation *****************/ @@ -1720,15 +1747,23 @@ return function (global, window, document, undefined) { is stopped, the next item in its animation queue is immediately triggered. */ /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) or a custom queue string can be passed in. */ - /* Stopping is achieved by traversing active calls for those which contain the targeted element. */ /* Note: The stop command runs prior to Queueing since its behavior is intended to take effect *immediately*, regardless of the element's current queue state. */ + + /* Iterate through every active call. */ $.each(Velocity.State.calls, function(i, activeCall) { /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ if (activeCall) { - /* If we're operating on a single element, wrap it in an array so that $.each() can iterate over it. */ + /* Iterate through the active call's targeted elements. */ $.each(createElementsArray(activeCall[1]), function(k, activeElement) { - $.each(createElementsArray(elements), function(l, element) { + var queueName = Type.isString(options) ? options : ""; + + if (options !== undefined && activeCall[2].queue !== queueName) { + return true; + } + + /* Iterate through the calls targeted by the stop command. */ + $.each(createElementsArray(elements), function(l, element) { /* Check that this call was applied to the target element. */ if (element === activeElement) { if (Data(element)) { @@ -1739,13 +1774,10 @@ return function (global, window, document, undefined) { }); } - /* Clear the remaining queued calls. */ - if (options === true || Type.isString(options)) { - /* The options argument can be overriden with a custom queue's name. */ - var queueName = Type.isString(options) ? options : ""; - + /* Optionally clear the remaining queued calls. */ + if (options !== undefined) { /* Iterate through the items in the element's queue. */ - $.each($.queue(element, queueName), function(i, item) { + $.each($.queue(element, queueName), function(_, item) { /* The queue array can contain an "inprogress" string, which we skip. */ if (Type.isFunction(item)) { /* Pass the item's callback a flag indicating that we want to abort from the queue call. @@ -1811,7 +1843,7 @@ return function (global, window, document, undefined) { the duration of each element's animation, using floors to prevent producing very short durations. */ if (options.drag) { /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ - options.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DEFAULT_DURATION); + options.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). @@ -1937,7 +1969,7 @@ return function (global, window, document, undefined) { break; case "normal": - opts.duration = DEFAULT_DURATION; + opts.duration = DURATION_DEFAULT; break; case "slow": @@ -1978,7 +2010,8 @@ return function (global, window, document, undefined) { *********************************/ /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ - if (opts.display) { + /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ + if (opts.display !== undefined && opts.display !== null) { opts.display = opts.display.toString().toLowerCase(); /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ @@ -2117,9 +2150,9 @@ return function (global, window, document, undefined) { *********************/ /* If the element was hidden via the display option in the previous call, - revert display to block prior to reversal so that the element is visible again. */ + revert display to "auto" prior to reversal so that the element is visible again. */ if (Data(element).opts.display === "none") { - Data(element).opts.display = "block"; + Data(element).opts.display = "auto"; } if (Data(element).opts.visibility === "hidden") { @@ -2323,7 +2356,7 @@ return function (global, window, document, undefined) { /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ - if (((opts.display && opts.display !== "none") || (opts.visibility && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { + if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { startValue = 0; } @@ -2415,9 +2448,9 @@ return function (global, window, document, undefined) { startValue = parseFloat(startValue) || 0; endValue = parseFloat(endValue) || 0; - /***************************** - Value & Unit Conversion - *****************************/ + /*************************************** + Property-Specific Value Conversion + ***************************************/ /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ if (endValueUnitType === "%") { @@ -2438,6 +2471,10 @@ return function (global, window, document, undefined) { } } + /*************************** + Unit Ratio Calculation + ***************************/ + /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred @@ -2450,7 +2487,6 @@ return function (global, window, document, undefined) { of batching the SETs and GETs together upfront outweights the potential overhead of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ - function calculateUnitRatios () { /************************ @@ -2502,12 +2538,9 @@ return function (global, window, document, undefined) { /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ - Velocity.CSS.setPropertyValue(dummy, "minWidth", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "maxWidth", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "width", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "minHeight", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "maxHeight", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "height", measurement + "%"); + $.each([ "minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height" ], function(i, property) { + Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); + }); /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ @@ -2549,6 +2582,10 @@ return function (global, window, document, undefined) { return unitRatios; } + /******************** + Unit Conversion + ********************/ + /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ if (/[\/*]/.test(operator)) { endValueUnitType = startValueUnitType; @@ -2607,9 +2644,9 @@ return function (global, window, document, undefined) { } } - /*********************** - Value Operators - ***********************/ + /********************* + Relative Values + *********************/ /* Operator logic must be performed last since it requires unit-normalized start and end values. */ /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" @@ -2836,7 +2873,7 @@ return function (global, window, document, undefined) { /* The rAF loop has been paused by the browser, so we manually restart the tick. */ tick(); } else { - ticker = window.requestAnimationFrame || rAFPollyfill; + ticker = window.requestAnimationFrame || rAFShim; } }); } @@ -2918,7 +2955,12 @@ return function (global, window, document, undefined) { /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ - if (opts.display && opts.display !== "none") { + if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { + /* Popular versions of major browsers only support the prefixed value of flex. */ + if (opts.display === "flex") { + CSS.setPropertyValue(element, "display", (IE ? "-ms-" : "-webkit-") + opts.display); + } + CSS.setPropertyValue(element, "display", opts.display); } @@ -3034,7 +3076,7 @@ return function (global, window, document, undefined) { /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ - if (opts.display && opts.display !== "none") { + if (opts.display !== undefined && opts.display !== "none") { Velocity.State.calls[i][2].display = false; } @@ -3251,132 +3293,45 @@ return function (global, window, document, undefined) { $.each([ "Down", "Up" ], function(i, direction) { Velocity.Sequences["slide" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { var opts = $.extend({}, options), - originalValues = { - height: null, - marginTop: null, - marginBottom: null, - paddingTop: null, - paddingBottom: null, - overflow: null, - overflowX: null, - overflowY: null - }, - /* Since the slide functions make use of the begin and complete callbacks, the user's custom callbacks are stored - upfront for triggering once slideDown/Up's own callback logic is complete. */ begin = opts.begin, complete = opts.complete, - isHeightAuto = false; - - /* Allow the user to set display to null to bypass display toggling. */ - if (opts.display !== null) { - /* Unless the user is overriding the display value, show the element before slideDown begins and hide the element after slideUp completes. */ - if (direction === "Down") { - /* All sliding elements are set to the "block" display value (as opposed to an element-appropriate block/inline distinction) - because inline elements cannot actually have their dimensions modified. */ - opts.display = opts.display || "auto"; - } else { - opts.display = opts.display || "none"; - } - } - - /* Begin callback. */ - opts.begin = function () { - /* Check for height: "auto" so we can revert back to it when the sliding animation is complete. */ - function checkHeightAuto() { - originalValues.height = parseFloat(Velocity.CSS.getPropertyValue(element, "height")); - - /* Determine if height was originally "auto" by checking if the computed "auto" value is identical to the original value. */ - element.style.height = "auto"; - if (parseFloat(Velocity.CSS.getPropertyValue(element, "height")) === originalValues.height) { - isHeightAuto = true; - } - - /* Revert to the computed value before sliding begins to prevent vertical popping due to scrollbars. */ - Velocity.CSS.setPropertyValue(element, "height", originalValues.height + "px"); - } - - if (direction === "Down") { - originalValues.overflow = [ Velocity.CSS.getPropertyValue(element, "overflow"), 0 ]; - originalValues.overflowX = [ Velocity.CSS.getPropertyValue(element, "overflowX"), 0 ]; - originalValues.overflowY = [ Velocity.CSS.getPropertyValue(element, "overflowY"), 0 ]; - - /* Ensure the element is visible, and temporarily remove vertical scrollbars since animating them is visually unappealing. */ - element.style.overflow = "hidden"; - element.style.overflowX = "visible"; - element.style.overflowY = "hidden"; - - /* With the scrollars no longer affecting sizing, determine whether the element is currently height: "auto". */ - checkHeightAuto(); - - /* Cache the elements' original vertical dimensional values so that we can animate back to them. */ - for (var property in originalValues) { - /* Overflow values have already been cached; do not overwrite them with "hidden". */ - if (/^overflow/.test(property)) { - continue; - } - - var propertyValue = Velocity.CSS.getPropertyValue(element, property); + computedValues = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" }, + inlineValues = {}; - if (property === "height") { - propertyValue = parseFloat(propertyValue); - } - - /* Use forcefeeding to animate slideDown properties from 0. */ - originalValues[property] = [ propertyValue, 0 ]; - } - } else { - checkHeightAuto(); - - for (var property in originalValues) { - var propertyValue = Velocity.CSS.getPropertyValue(element, property); + if (opts.display === undefined) { + /* Show the element before slideDown begins and hide the element after slideUp completes. */ + /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ + opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); + } - if (property === "height") { - propertyValue = parseFloat(propertyValue); - } + opts.begin = function (element) { + /* If the user passed in a begin callback, fire it now. */ + begin && begin.call(element, element); - /* Use forcefeeding to animate slideUp properties toward 0. */ - originalValues[property] = [ 0, propertyValue ]; - } + /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ + for (var property in computedValues) { + /* Cache all inline values, we reset to upon animation completion. */ + inlineValues[property] = element.style[property]; - /* Both directions hide scrollbars since scrollbar height tweening looks unappealing. */ - element.style.overflow = "hidden"; - element.style.overflowX = "visible"; - element.style.overflowY = "hidden"; - } - - /* If the user passed in a begin callback, fire it now. */ - if (begin) { - begin.call(element, element); + /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, + use forcefeeding to start from computed values and animate down to 0. */ + var propertyValue = Velocity.CSS.getPropertyValue(element, property); + computedValues[property] = (direction === "Down") ? [ propertyValue, 0 ] : [ 0, propertyValue ]; } } - /* Complete callback. */ opts.complete = function (element) { - var propertyValuePosition = (direction === "Down") ? 0 : 1; - - if (isHeightAuto === true) { - /* If the element's height was originally set to auto, overwrite the computed value with "auto". */ - originalValues.height[propertyValuePosition] = "auto"; - } else { - originalValues.height[propertyValuePosition] += "px"; - } - - /* Reset element to its original values once its slide animation is complete: For slideDown, overflow - values are reset. For slideUp, all values are reset (since they were animated to 0).) */ - for (var property in originalValues) { - element.style[property] = originalValues[property][propertyValuePosition]; + /* Reset element to its pre-slide inline values once its slide animation is complete. */ + for (var property in inlineValues) { + element.style[property] = inlineValues[property]; } /* If the user passed in a complete callback, fire it now. */ - if (complete) { - complete.call(element, element); - } - + complete && complete.call(element, element); promiseData && promiseData.resolver(elements || element); }; - /* Animation triggering. */ - Velocity(element, originalValues, opts); + Velocity(element, computedValues, opts); }; }); @@ -3406,8 +3361,8 @@ return function (global, window, document, undefined) { /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ /* Note: We allow users to pass in "null" to skip display setting altogether. */ - if (opts.display !== null) { - opts.display = opts.display || ((direction === "In") ? "auto" : "none"); + if (opts.display === undefined) { + opts.display = (direction === "In" ? "auto" : "none"); } Velocity(this, propertiesMap, opts); @@ -3423,8 +3378,7 @@ return function (global, window, document, undefined) { ******************/ /* When animating height/width to a % value on an element *without* box-sizing:border-box and *with* visible scrollbars - on *both* axes, the opposite axis (e.g. height vs width) will be shortened by the height/width of its scrollbar. */ - +on *both* axes, the opposite axis (e.g. height vs width) will be shortened by the height/width of its scrollbar. */ /* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. - Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties - will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ \ No newline at end of file +Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties +will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ \ No newline at end of file diff --git a/packages/velocity/jquery.velocity.min.js b/packages/velocity/jquery.velocity.min.js index a0839f7a..99246afe 100644 --- a/packages/velocity/jquery.velocity.min.js +++ b/packages/velocity/jquery.velocity.min.js @@ -1,2 +1,2 @@ -/*! VelocityJS.org (0.11.7). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ -!function(e){"object"==typeof module&&"object"==typeof module.exports?module.exports=e(window.Velocity?window.jQuery:require("jquery")):"function"==typeof define&&define.amd?window.Velocity?define("velocity",e):define("velocity",["jquery"],e):e(window.jQuery)}(function(e){return function(t,r,a,o){function i(e){for(var t=-1,r=e?e.length:0,a=[];++tr;r++)if(S.State.calls[r]){var i=S.State.calls[r],n=i[0],l=i[2],u=i[3];u||(u=S.State.calls[r][3]=t-16);for(var f=Math.min((t-u)/l.duration,1),d=0,g=n.length;g>d;d++){var m=n[d],y=m.element;if(s(y)){var x=!1;l.display&&"none"!==l.display&&V.setPropertyValue(y,"display",l.display),l.visibility&&"hidden"!==l.visibility&&V.setPropertyValue(y,"visibility",l.visibility);for(var b in m)if("element"!==b){var P=m[b],w,C=v.isString(P.easing)?S.Easings[P.easing]:P.easing;if(w=1===f?P.endValue:P.startValue+(P.endValue-P.startValue)*C(f),P.currentValue=w,V.Hooks.registered[b]){var T=V.Hooks.getRoot(b),k=s(y).rootPropertyValueCache[T];k&&(P.rootPropertyValue=k)}var E=V.setPropertyValue(y,b,P.currentValue+(0===parseFloat(w)?"":P.unitType),P.rootPropertyValue,P.scrollData);V.Hooks.registered[b]&&(s(y).rootPropertyValueCache[T]=V.Normalizations.registered[T]?V.Normalizations.registered[T]("extract",null,E[1]):E[1]),"transform"===E[0]&&(x=!0)}l.mobileHA&&s(y).transformCache.translate3d===o&&(s(y).transformCache.translate3d="(0px, 0px, 0px)",x=!0),x&&V.flushTransformCache(y)}}l.display&&"none"!==l.display&&(S.State.calls[r][2].display=!1),l.visibility&&"hidden"!==l.visibility&&(S.State.calls[r][2].visibility=!1),l.progress&&l.progress.call(i[1],i[1],f,Math.max(0,u+l.duration-t),u),1===f&&p(r)}S.State.isTicking&&h(c)}function p(e,t){if(!S.State.calls[e])return!1;for(var r=S.State.calls[e][0],a=S.State.calls[e][1],i=S.State.calls[e][2],n=S.State.calls[e][4],l=!1,u=0,c=r.length;c>u;u++){var p=r[u].element;if(t||i.loop||("none"===i.display&&V.setPropertyValue(p,"display",i.display),"hidden"===i.visibility&&V.setPropertyValue(p,"visibility",i.visibility)),($.queue(p)[1]===o||!/\.velocityQueueEntryFlag/i.test($.queue(p)[1]))&&s(p)){s(p).isAnimating=!1,s(p).rootPropertyValueCache={};var f=!1;$.each(V.Lists.transforms3D,function(e,t){var r=/^scale/.test(t)?1:0,a=s(p).transformCache[t];s(p).transformCache[t]!==o&&new RegExp("^\\("+r+"[^.]").test(a)&&(f=!0,delete s(p).transformCache[t])}),i.mobileHA&&(f=!0,delete s(p).transformCache.translate3d),f&&V.flushTransformCache(p),V.Values.removeClass(p,"velocity-animating")}if(!t&&i.complete&&!i.loop&&u===c-1)try{i.complete.call(a,a)}catch(d){setTimeout(function(){throw d},1)}n&&i.loop!==!0&&n(a),i.loop!==!0||t||S(p,"reverse",{loop:!0,delay:i.delay}),i.queue!==!1&&$.dequeue(p,i.queue)}S.State.calls[e]=!1;for(var g=0,m=S.State.calls.length;m>g;g++)if(S.State.calls[g]!==!1){l=!0;break}l===!1&&(S.State.isTicking=!1,delete S.State.calls,S.State.calls=[])}var f="velocity",d=400,g="swing",m=function(){if(a.documentMode)return a.documentMode;for(var e=7;e>4;e--){var t=a.createElement("div");if(t.innerHTML="",t.getElementsByTagName("span").length)return t=null,e}return o}(),y=function(){var e=0;return r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||function(t){var r=(new Date).getTime(),a;return a=Math.max(0,16-(r-e)),e=r+a,setTimeout(function(){t(r+a)},a)}}(),h=r.requestAnimationFrame||y,v={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&e.length!==o&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||r.Zepto&&r.Zepto.zepto.isZ(e))},isSVG:function(e){return r.SVGElement&&e instanceof SVGElement},isEmptyObject:function(e){var t;for(t in e)return!1;return!0}},$;if(e&&e.fn!==o?$=e:r.Velocity&&r.Velocity.Utilities&&($=r.Velocity.Utilities),!$)throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.");if(t.Velocity!==o&&t.Velocity.Utilities==o)throw new Error("Velocity: Namespace is occupied.");if(7>=m){if(e)return void(e.fn.velocity=e.fn.animate);throw new Error("Velocity: In IE<=7, Velocity falls back to jQuery, which must first be loaded.")}if(8===m&&!e)throw new Error("Velocity: In IE8, Velocity requires jQuery proper to be loaded; Velocity's jQuery shim does not work with IE8.");var S={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:r.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:a.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:$,Sequences:{},Easings:{},Promise:r.Promise,defaults:{queue:"",duration:d,easing:g,begin:null,complete:null,progress:null,display:null,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){$.data(e,f,{isSVG:v.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},animate:null,hook:function(e,t,r){var a=o;return v.isWrapped(e)&&(e=[].slice.call(e)),$.each(n(e),function(e,i){if(s(i)===o&&S.init(i),r===o)a===o&&(a=S.CSS.getPropertyValue(i,t));else{var n=S.CSS.setPropertyValue(i,t,r);"transform"===n[0]&&S.CSS.flushTransformCache(i),a=n}}),a},mock:!1,version:{major:0,minor:11,patch:7},debug:!1};r.pageYOffset!==o?(S.State.scrollAnchor=r,S.State.scrollPropertyLeft="pageXOffset",S.State.scrollPropertyTop="pageYOffset"):(S.State.scrollAnchor=a.documentElement||a.body.parentNode||a.body,S.State.scrollPropertyLeft="scrollLeft",S.State.scrollPropertyTop="scrollTop");var x=function(){function e(e,t){return 1-3*t+3*e}function t(e,t){return 3*t-6*e}function r(e){return 3*e}function a(a,o,i){return((e(o,i)*a+t(o,i))*a+r(o))*a}function o(a,o,i){return 3*e(o,i)*a*a+2*t(o,i)*a+r(o)}return function(e,t,r,i){function n(t){for(var i=t,n=0;8>n;++n){var s=o(i,e,r);if(0===s)return i;var l=a(i,e,r)-t;i-=l/s}return i}if(4!==arguments.length)return!1;for(var s=0;4>s;++s)if("number"!=typeof arguments[s]||isNaN(arguments[s])||!isFinite(arguments[s]))return!1;return e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0),function(o){return e===t&&r===i?o:a(n(o),t,i)}}}(),b=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,a){var o={x:t.x+a.dx*r,v:t.v+a.dv*r,tension:t.tension,friction:t.friction};return{dx:o.v,dv:e(o)}}function r(r,a){var o={dx:r.v,dv:e(r)},i=t(r,.5*a,o),n=t(r,.5*a,i),s=t(r,a,n),l=1/6*(o.dx+2*(i.dx+n.dx)+s.dx),u=1/6*(o.dv+2*(i.dv+n.dv)+s.dv);return r.x=r.x+l*a,r.v=r.v+u*a,r}return function a(e,t,o){var i={x:-1,v:0,tension:null,friction:null},n=[0],s=0,l=1e-4,u=.016,c,p,f;for(e=parseFloat(e)||500,t=parseFloat(t)||20,o=o||null,i.tension=e,i.friction=t,c=null!==o,c?(s=a(e,t),p=s/o*u):p=u;;)if(f=r(f||i,p),n.push(1+f.x),s+=16,!(Math.abs(f.x)>l&&Math.abs(f.v)>l))break;return c?function(e){return n[e*(n.length-1)|0]}:s}}();!function(){S.Easings.linear=function(e){return e},S.Easings.swing=function(e){return.5-Math.cos(e*Math.PI)/2},S.Easings.spring=function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)},S.Easings.ease=x(.25,.1,.25,1),S.Easings["ease-in"]=x(.42,0,1,1),S.Easings["ease-out"]=x(0,0,.58,1),S.Easings["ease-in-out"]=x(.42,0,.58,1);var e={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,r){e[r]=function(e){return Math.pow(e,t+2)}}),$.extend(e,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,r=4;e<((t=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((3*t-2)/22-e,2)}}),$.each(e,function(e,t){S.Easings["easeIn"+e]=t,S.Easings["easeOut"+e]=function(e){return 1-t(1-e)},S.Easings["easeInOut"+e]=function(e){return.5>e?t(2*e)/2:1-t(-2*e+2)/2}})}();var V=S.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e=m)switch(e){case"name":return"filter";case"extract":var a=r.toString().match(/alpha\(opacity=(.*)\)/i);return r=a?a[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(r)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(r),10)+")"}else switch(e){case"name":return"opacity";case"extract":return r;case"inject":return r}}},register:function(){9>=m||S.State.isGingerbread||(V.Lists.transformsBase=V.Lists.transformsBase.concat(V.Lists.transforms3D));for(var e=0;ea&&(a=1),i=!/(\d)$/i.test(a);break;case"skew":i=!/(deg|\d)$/i.test(a);break;case"rotate":i=!/(deg|\d)$/i.test(a)}return i||(s(r).transformCache[t]="("+a+")"),s(r).transformCache[t]}}}();for(var e=0;e=m||3!==i.split(" ").length||(i+=" 1"),i;case"inject":return 8>=m?4===a.split(" ").length&&(a=a.split(/\s+/).slice(0,3).join(" ")):3===a.split(" ").length&&(a+=" 1"),(8>=m?"rgb":"rgba")+"("+a.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(m||S.State.isAndroid&&!S.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")$","i").test(e)},prefixCheck:function(e){if(S.State.prefixMatches[e])return[S.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],r=0,a=t.length;a>r;r++){var o;if(o=0===r?e:t[r]+e.replace(/^\w/,function(e){return e.toUpperCase()}),v.isString(S.State.prefixElement.style[o]))return S.State.prefixMatches[e]=o,[o,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,a;return e=e.replace(t,function(e,t,r,a){return t+t+r+r+a+a}),a=r.exec(e),a?[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t)?"inline":/^(li)$/i.test(t)?"list-item":/^(tr)$/i.test(t)?"table-row":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,t,a,i){function n(e,t){function a(){u&&V.setPropertyValue(e,"display","none")}var l=0;if(8>=m)l=$.css(e,t);else{var u=!1;if(/^(width|height)$/.test(t)&&0===V.getPropertyValue(e,"display")&&(u=!0,V.setPropertyValue(e,"display",V.Values.getDisplayType(e))),!i){if("height"===t&&"border-box"!==V.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var c=e.offsetHeight-(parseFloat(V.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(V.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(V.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(V.getPropertyValue(e,"paddingBottom"))||0);return a(),c}if("width"===t&&"border-box"!==V.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetWidth-(parseFloat(V.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(V.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(V.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(V.getPropertyValue(e,"paddingRight"))||0);return a(),p}}var f;f=s(e)===o?r.getComputedStyle(e,null):s(e).computedStyle?s(e).computedStyle:s(e).computedStyle=r.getComputedStyle(e,null),(m||S.State.isFirefox)&&"borderColor"===t&&(t="borderTopColor"),l=9===m&&"filter"===t?f.getPropertyValue(t):f[t],(""===l||null===l)&&(l=e.style[t]),a()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(t)){var d=n(e,"position");("fixed"===d||"absolute"===d&&/top|left/i.test(t))&&(l=$(e).position()[t]+"px")}return l}var l;if(V.Hooks.registered[t]){var u=t,c=V.Hooks.getRoot(u);a===o&&(a=V.getPropertyValue(e,V.Names.prefixCheck(c)[0])),V.Normalizations.registered[c]&&(a=V.Normalizations.registered[c]("extract",e,a)),l=V.Hooks.extractValue(u,a)}else if(V.Normalizations.registered[t]){var p,f;p=V.Normalizations.registered[t]("name",e),"transform"!==p&&(f=n(e,V.Names.prefixCheck(p)[0]),V.Values.isCSSNullValue(f)&&V.Hooks.templates[t]&&(f=V.Hooks.templates[t][1])),l=V.Normalizations.registered[t]("extract",e,f)}return/^[\d-]/.test(l)||(l=s(e)&&s(e).isSVG&&V.Names.SVGAttribute(t)?/^(height|width)$/i.test(t)?e.getBBox()[t]:e.getAttribute(t):n(e,V.Names.prefixCheck(t)[0])),V.Values.isCSSNullValue(l)&&(l=0),S.debug>=2&&console.log("Get "+t+": "+l),l},setPropertyValue:function(e,t,a,o,i){var n=t;if("scroll"===t)i.container?i.container["scroll"+i.direction]=a:"Left"===i.direction?r.scrollTo(a,i.alternateValue):r.scrollTo(i.alternateValue,a);else if(V.Normalizations.registered[t]&&"transform"===V.Normalizations.registered[t]("name",e))V.Normalizations.registered[t]("inject",e,a),n="transform",a=s(e).transformCache[t];else{if(V.Hooks.registered[t]){var l=t,u=V.Hooks.getRoot(t);o=o||V.getPropertyValue(e,u),a=V.Hooks.injectValue(l,a,o),t=u}if(V.Normalizations.registered[t]&&(a=V.Normalizations.registered[t]("inject",e,a),t=V.Normalizations.registered[t]("name",e)),n=V.Names.prefixCheck(t)[0],8>=m)try{e.style[n]=a}catch(c){S.debug&&console.log("Browser does not support ["+a+"] for ["+n+"]")}else s(e)&&s(e).isSVG&&V.Names.SVGAttribute(t)?e.setAttribute(t,a):e.style[n]=a;S.debug>=2&&console.log("Set "+t+" ("+n+"): "+a)}return[n,a]},flushTransformCache:function(e){function t(t){return parseFloat(V.getPropertyValue(e,t))}var r="";if((m||S.State.isAndroid&&!S.State.isChrome)&&s(e).isSVG){var a={translate:[t("translateX"),t("translateY")],skewX:[t("skewX")],skewY:[t("skewY")],scale:1!==t("scale")?[t("scale"),t("scale")]:[t("scaleX"),t("scaleY")],rotate:[t("rotateZ"),0,0]};$.each(s(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),a[e]&&(r+=e+"("+a[e].join(" ")+") ",delete a[e])})}else{var o,i;$.each(s(e).transformCache,function(t){return o=s(e).transformCache[t],"transformPerspective"===t?(i=o,!0):(9===m&&"rotateZ"===t&&(t="rotate"),void(r+=t+o+" "))}),i&&(r="perspective"+i+" "+r)}V.setPropertyValue(e,"transform",r)}};V.Hooks.register(),V.Normalizations.register();var P=function(){function e(){return f?T.promise||null:g}function t(){function e(e){function f(e,r){var a=o,i=o,s=o;return v.isArray(e)?(a=e[0],!v.isArray(e[1])&&/^[\d-]/.test(e[1])||v.isFunction(e[1])||V.RegEx.isHex.test(e[1])?s=e[1]:(v.isString(e[1])&&!V.RegEx.isHex.test(e[1])||v.isArray(e[1]))&&(i=r?e[1]:u(e[1],n.duration),e[2]!==o&&(s=e[2]))):a=e,r||(i=i||n.easing),v.isFunction(a)&&(a=a.call(t,P,b)),v.isFunction(s)&&(s=s.call(t,P,b)),[a||0,i,s]}function d(e,t){var r,a;return a=(t||0).toString().toLowerCase().replace(/[%A-z]+$/,function(e){return r=e,""}),r||(r=V.Values.getUnitType(e)),[a,r]}function g(){var e={myParent:t.parentNode||a.body,position:V.getPropertyValue(t,"position"),fontSize:V.getPropertyValue(t,"fontSize")},o=e.position===N.lastPosition&&e.myParent===N.lastParent,i=e.fontSize===N.lastFontSize;N.lastParent=e.myParent,N.lastPosition=e.position,N.lastFontSize=e.fontSize;var n=100,l={};if(i&&o)l.emToPx=N.lastEmToPx,l.percentToPxWidth=N.lastPercentToPxWidth,l.percentToPxHeight=N.lastPercentToPxHeight;else{var u=s(t).isSVG?a.createElementNS("http://www.w3.org/2000/svg","rect"):a.createElement("div");S.init(u),e.myParent.appendChild(u),S.CSS.setPropertyValue(u,"position",e.position),S.CSS.setPropertyValue(u,"fontSize",e.fontSize),S.CSS.setPropertyValue(u,"overflow","hidden"),S.CSS.setPropertyValue(u,"overflowX","hidden"),S.CSS.setPropertyValue(u,"overflowY","hidden"),S.CSS.setPropertyValue(u,"boxSizing","content-box"),S.CSS.setPropertyValue(u,"paddingLeft",n+"em"),S.CSS.setPropertyValue(u,"minWidth",n+"%"),S.CSS.setPropertyValue(u,"maxWidth",n+"%"),S.CSS.setPropertyValue(u,"width",n+"%"),S.CSS.setPropertyValue(u,"minHeight",n+"%"),S.CSS.setPropertyValue(u,"maxHeight",n+"%"),S.CSS.setPropertyValue(u,"height",n+"%"),l.percentToPxWidth=N.lastPercentToPxWidth=(parseFloat(V.getPropertyValue(u,"width",null,!0))||1)/n,l.percentToPxHeight=N.lastPercentToPxHeight=(parseFloat(V.getPropertyValue(u,"height",null,!0))||1)/n,l.emToPx=N.lastEmToPx=(parseFloat(V.getPropertyValue(u,"paddingLeft"))||1)/n,e.myParent.removeChild(u)}return null===N.remToPx&&(N.remToPx=parseFloat(V.getPropertyValue(a.body,"fontSize"))||16),null===N.vwToPx&&(N.vwToPx=parseFloat(r.innerWidth)/100,N.vhToPx=parseFloat(r.innerHeight)/100),l.remToPx=N.remToPx,l.vwToPx=N.vwToPx,l.vhToPx=N.vhToPx,S.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),t),l}if(n.begin&&0===P)try{n.begin.call(y,y)}catch(m){setTimeout(function(){throw m},1)}if("scroll"===k){var w=/^x$/i.test(n.axis)?"Left":"Top",C=parseFloat(n.offset)||0,E,F,A;n.container?v.isWrapped(n.container)||v.isNode(n.container)?(n.container=n.container[0]||n.container,E=n.container["scroll"+w],A=E+$(t).position()[w.toLowerCase()]+C):n.container=null:(E=S.State.scrollAnchor[S.State["scrollProperty"+w]],F=S.State.scrollAnchor[S.State["scrollProperty"+("Left"===w?"Top":"Left")]],A=$(t).offset()[w.toLowerCase()]+C),l={scroll:{rootPropertyValue:!1,startValue:E,currentValue:E,endValue:A,unitType:"",easing:n.easing,scrollData:{container:n.container,direction:w,alternateValue:F}},element:t},S.debug&&console.log("tweensContainer (scroll): ",l.scroll,t)}else if("reverse"===k){if(!s(t).tweensContainer)return void $.dequeue(t,n.queue);"none"===s(t).opts.display&&(s(t).opts.display="block"),"hidden"===s(t).opts.visibility&&(s(t).opts.visibility="visible"),s(t).opts.loop=!1,s(t).opts.begin=null,s(t).opts.complete=null,x.easing||delete n.easing,x.duration||delete n.duration,n=$.extend({},s(t).opts,n);var H=$.extend(!0,{},s(t).tweensContainer);for(var L in H)if("element"!==L){var z=H[L].startValue;H[L].startValue=H[L].currentValue=H[L].endValue,H[L].endValue=z,v.isEmptyObject(x)||(H[L].easing=n.easing),S.debug&&console.log("reverse tweensContainer ("+L+"): "+JSON.stringify(H[L]),t)}l=H}else if("start"===k){var H;s(t).tweensContainer&&s(t).isAnimating===!0&&(H=s(t).tweensContainer),$.each(h,function(e,t){if(RegExp("^"+V.Lists.colors.join("$|^")+"$").test(e)){var r=f(t,!0),a=r[0],i=r[1],n=r[2];if(V.RegEx.isHex.test(a)){for(var s=["Red","Green","Blue"],l=V.Values.hexToRgb(a),u=n?V.Values.hexToRgb(n):o,c=0;c1e4&&(S.State.calls=i(S.State.calls)),S.State.calls.push([j,y,n,null,T.resolver]),S.State.isTicking===!1&&(S.State.isTicking=!0,c())):P++)}var t=this,n=$.extend({},S.defaults,x),l={},p;if(s(t)===o&&S.init(t),parseFloat(n.delay)&&n.queue!==!1&&$.queue(t,n.queue,function(e){S.velocityQueueEntryFlag=!0,s(t).delayTimer={setTimeout:setTimeout(e,parseFloat(n.delay)),next:e}}),S.mock===!0)n.duration=1;else switch(n.duration.toString().toLowerCase()){case"fast":n.duration=200;break;case"normal":n.duration=d;break;case"slow":n.duration=600;break;default:n.duration=parseFloat(n.duration)||1}n.easing=u(n.easing,n.duration),n.begin&&!v.isFunction(n.begin)&&(n.begin=null),n.progress&&!v.isFunction(n.progress)&&(n.progress=null),n.complete&&!v.isFunction(n.complete)&&(n.complete=null),n.display&&(n.display=n.display.toString().toLowerCase(),"auto"===n.display&&(n.display=S.CSS.Values.getDisplayType(t))),n.visibility&&(n.visibility=n.visibility.toString().toLowerCase()),n.mobileHA=n.mobileHA&&S.State.isMobile&&!S.State.isGingerbread,n.queue===!1?n.delay?setTimeout(e,n.delay):e():$.queue(t,n.queue,function(t,r){return r===!0?(T.promise&&T.resolver(y),!0):(S.velocityQueueEntryFlag=!0,void e(t))}),""!==n.queue&&"fx"!==n.queue||"inprogress"===$.queue(t)[0]||$.dequeue(t)}var l=arguments[0]&&($.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||v.isString(arguments[0].properties)),f,g,m,y,h,x;if(v.isWrapped(this)?(f=!1,m=0,y=this,g=this):(f=!0,m=1,y=l?arguments[0].elements:arguments[0]),y=v.isWrapped(y)?[].slice.call(y):y){l?(h=arguments[0].properties,x=arguments[0].options):(h=arguments[m],x=arguments[m+1]);var b=v.isArray(y)||v.isNodeList(y)?y.length:1,P=0;if("stop"!==h&&!$.isPlainObject(x)){var w=m+1;x={};for(var C=w;CM;M++){var R={delay:L.delay};M===z-1&&(R.display=L.display,R.visibility=L.visibility,R.complete=L.complete),S(y,"reverse",R)}return e()}};S=$.extend(P,S),S.animate=P,S.State.isMobile||a.hidden===o||a.addEventListener("visibilitychange",function(){a.hidden?(h=function(e){return setTimeout(function(){e(!0)},16)},c()):h=r.requestAnimationFrame||y});var w;return e&&e.fn!==o?w=e:r.Zepto&&(w=r.Zepto),(w||r).Velocity=S,w&&(w.fn.velocity=P,w.fn.velocity.defaults=S.defaults),$.each(["Down","Up"],function(e,t){S.Sequences["slide"+t]=function(e,r,a,o,i,n){var s=$.extend({},r),l={height:null,marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null,overflow:null,overflowX:null,overflowY:null},u=s.begin,c=s.complete,p=!1;null!==s.display&&(s.display="Down"===t?s.display||"auto":s.display||"none"),s.begin=function(){function r(){l.height=parseFloat(S.CSS.getPropertyValue(e,"height")),e.style.height="auto",parseFloat(S.CSS.getPropertyValue(e,"height"))===l.height&&(p=!0),S.CSS.setPropertyValue(e,"height",l.height+"px")}if("Down"===t){l.overflow=[S.CSS.getPropertyValue(e,"overflow"),0],l.overflowX=[S.CSS.getPropertyValue(e,"overflowX"),0],l.overflowY=[S.CSS.getPropertyValue(e,"overflowY"),0],e.style.overflow="hidden",e.style.overflowX="visible",e.style.overflowY="hidden",r();for(var a in l)if(!/^overflow/.test(a)){var o=S.CSS.getPropertyValue(e,a);"height"===a&&(o=parseFloat(o)),l[a]=[o,0]}}else{r();for(var a in l){var o=S.CSS.getPropertyValue(e,a);"height"===a&&(o=parseFloat(o)),l[a]=[0,o]}e.style.overflow="hidden",e.style.overflowX="visible",e.style.overflowY="hidden"}u&&u.call(e,e)},s.complete=function(e){var r="Down"===t?0:1;p===!0?l.height[r]="auto":l.height[r]+="px";for(var a in l)e.style[a]=l[a][r];c&&c.call(e,e),n&&n.resolver(i||e)},S(e,l,s)}}),$.each(["In","Out"],function(e,t){S.Sequences["fade"+t]=function(e,r,a,o,i,n){var s=$.extend({},r),l={opacity:"In"===t?1:0};if(a!==o-1)s.complete=s.begin=null;else{var u=s.complete;s.complete=function(){u&&u.call(e,e),n&&n.resolver(i||e)}}null!==s.display&&(s.display=s.display||("In"===t?"auto":"none")),S(this,l,s)}}),S}(e||window,window,document)}); \ No newline at end of file +/*! VelocityJS.org (0.11.8). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ +!function(e){"object"==typeof module&&"object"==typeof module.exports?module.exports=e(window.Velocity?window.jQuery:require("jquery")):"function"==typeof define&&define.amd?window.Velocity?define(e):define(["jquery"],e):e(window.jQuery)}(function(e){return function(t,r,a,i){function o(e){for(var t=-1,r=e?e.length:0,a=[];++ti;++i){var o=u(r,e,a);if(0===o)return r;var n=l(r,e,a)-t;r-=n/o}return r}function p(){for(var t=0;x>t;++t)P[t]=l(t*b,e,a)}function d(t,r,i){var o,n,s=0;do n=r+(i-r)/2,o=l(n,e,a)-t,o>0?i=n:r=n;while(Math.abs(o)>h&&++s=y?c(t,s):0==l?s:d(t,r,r+b)}function g(){w=!0,(e!=t||a!=i)&&p()}var m=4,y=.001,h=1e-7,v=10,x=11,b=1/(x-1),S="Float32Array"in r;if(4!==arguments.length)return!1;for(var V=0;4>V;++V)if("number"!=typeof arguments[V]||isNaN(arguments[V])||!isFinite(arguments[V]))return!1;e=Math.min(e,1),a=Math.min(a,1),e=Math.max(e,0),a=Math.max(a,0);var P=S?new Float32Array(x):new Array(x),w=!1,C=function(r){return w||g(),e===t&&a===i?r:0===r?0:1===r?1:l(f(r),t,i)};C.getControlPoints=function(){return[{x:e,y:t},{x:a,y:i}]};var T="generateBezier("+[e,t,a,i]+")";return C.toString=function(){return T},C}function c(e,t){var r=e;return y.isString(e)?x.Easings[e]||(r=!1):r=y.isArray(e)&&1===e.length?l.apply(null,e):y.isArray(e)&&2===e.length?b.apply(null,e.concat([t])):y.isArray(e)&&4===e.length?u.apply(null,e):!1,r===!1&&(r=x.Easings[x.defaults.easing]?x.defaults.easing:v),r}function p(e){if(e)for(var t=(new Date).getTime(),r=0,a=x.State.calls.length;a>r;r++)if(x.State.calls[r]){var o=x.State.calls[r],n=o[0],l=o[2],u=o[3];u||(u=x.State.calls[r][3]=t-16);for(var c=Math.min((t-u)/l.duration,1),g=0,h=n.length;h>g;g++){var v=n[g],b=v.element;if(s(b)){var V=!1;l.display!==i&&null!==l.display&&"none"!==l.display&&("flex"===l.display&&S.setPropertyValue(b,"display",(f?"-ms-":"-webkit-")+l.display),S.setPropertyValue(b,"display",l.display)),l.visibility&&"hidden"!==l.visibility&&S.setPropertyValue(b,"visibility",l.visibility);for(var P in v)if("element"!==P){var w=v[P],C,T=y.isString(w.easing)?x.Easings[w.easing]:w.easing;if(C=1===c?w.endValue:w.startValue+(w.endValue-w.startValue)*T(c),w.currentValue=C,S.Hooks.registered[P]){var k=S.Hooks.getRoot(P),A=s(b).rootPropertyValueCache[k];A&&(w.rootPropertyValue=A)}var E=S.setPropertyValue(b,P,w.currentValue+(0===parseFloat(C)?"":w.unitType),w.rootPropertyValue,w.scrollData);S.Hooks.registered[P]&&(s(b).rootPropertyValueCache[k]=S.Normalizations.registered[k]?S.Normalizations.registered[k]("extract",null,E[1]):E[1]),"transform"===E[0]&&(V=!0)}l.mobileHA&&s(b).transformCache.translate3d===i&&(s(b).transformCache.translate3d="(0px, 0px, 0px)",V=!0),V&&S.flushTransformCache(b)}}l.display!==i&&"none"!==l.display&&(x.State.calls[r][2].display=!1),l.visibility&&"hidden"!==l.visibility&&(x.State.calls[r][2].visibility=!1),l.progress&&l.progress.call(o[1],o[1],c,Math.max(0,u+l.duration-t),u),1===c&&d(r)}x.State.isTicking&&m(p)}function d(e,t){if(!x.State.calls[e])return!1;for(var r=x.State.calls[e][0],a=x.State.calls[e][1],o=x.State.calls[e][2],n=x.State.calls[e][4],l=!1,u=0,c=r.length;c>u;u++){var p=r[u].element;if(t||o.loop||("none"===o.display&&S.setPropertyValue(p,"display",o.display),"hidden"===o.visibility&&S.setPropertyValue(p,"visibility",o.visibility)),($.queue(p)[1]===i||!/\.velocityQueueEntryFlag/i.test($.queue(p)[1]))&&s(p)){s(p).isAnimating=!1,s(p).rootPropertyValueCache={};var d=!1;$.each(S.Lists.transforms3D,function(e,t){var r=/^scale/.test(t)?1:0,a=s(p).transformCache[t];s(p).transformCache[t]!==i&&new RegExp("^\\("+r+"[^.]").test(a)&&(d=!0,delete s(p).transformCache[t])}),o.mobileHA&&(d=!0,delete s(p).transformCache.translate3d),d&&S.flushTransformCache(p),S.Values.removeClass(p,"velocity-animating")}if(!t&&o.complete&&!o.loop&&u===c-1)try{o.complete.call(a,a)}catch(f){setTimeout(function(){throw f},1)}n&&o.loop!==!0&&n(a),o.loop!==!0||t||x(p,"reverse",{loop:!0,delay:o.delay}),o.queue!==!1&&$.dequeue(p,o.queue)}x.State.calls[e]=!1;for(var g=0,m=x.State.calls.length;m>g;g++)if(x.State.calls[g]!==!1){l=!0;break}l===!1&&(x.State.isTicking=!1,delete x.State.calls,x.State.calls=[])}var f=function(){if(a.documentMode)return a.documentMode;for(var e=7;e>4;e--){var t=a.createElement("div");if(t.innerHTML="",t.getElementsByTagName("span").length)return t=null,e}return i}(),g=function(){var e=0;return r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||function(t){var r=(new Date).getTime(),a;return a=Math.max(0,16-(r-e)),e=r+a,setTimeout(function(){t(r+a)},a)}}(),m=r.requestAnimationFrame||g,y={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&e.length!==i&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||r.Zepto&&r.Zepto.zepto.isZ(e))},isSVG:function(e){return r.SVGElement&&e instanceof SVGElement},isEmptyObject:function(e){var t;for(t in e)return!1;return!0}},$;if(e&&e.fn!==i?$=e:r.Velocity&&r.Velocity.Utilities&&($=r.Velocity.Utilities),!$)throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.");if(t.Velocity!==i&&t.Velocity.Utilities==i)throw new Error("Velocity: Namespace is occupied.");if(7>=f){if(e)return void(e.fn.velocity=e.fn.animate);throw new Error("Velocity: In IE<=7, Velocity falls back to jQuery, which must first be loaded.")}if(8===f&&!e)throw new Error("Velocity: In IE8, Velocity requires jQuery proper to be loaded; Velocity's jQuery shim does not work with IE8.");var h=400,v="swing",x={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:r.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:a.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:$,Sequences:{},Easings:{},Promise:r.Promise,defaults:{queue:"",duration:h,easing:v,begin:null,complete:null,progress:null,display:i,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){$.data(e,"velocity",{isSVG:y.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},animate:null,hook:null,mock:!1,version:{major:0,minor:11,patch:8},debug:!1};r.pageYOffset!==i?(x.State.scrollAnchor=r,x.State.scrollPropertyLeft="pageXOffset",x.State.scrollPropertyTop="pageYOffset"):(x.State.scrollAnchor=a.documentElement||a.body.parentNode||a.body,x.State.scrollPropertyLeft="scrollLeft",x.State.scrollPropertyTop="scrollTop");var b=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,a){var i={x:t.x+a.dx*r,v:t.v+a.dv*r,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function r(r,a){var i={dx:r.v,dv:e(r)},o=t(r,.5*a,i),n=t(r,.5*a,o),s=t(r,a,n),l=1/6*(i.dx+2*(o.dx+n.dx)+s.dx),u=1/6*(i.dv+2*(o.dv+n.dv)+s.dv);return r.x=r.x+l*a,r.v=r.v+u*a,r}return function a(e,t,i){var o={x:-1,v:0,tension:null,friction:null},n=[0],s=0,l=1e-4,u=.016,c,p,d;for(e=parseFloat(e)||500,t=parseFloat(t)||20,i=i||null,o.tension=e,o.friction=t,c=null!==i,c?(s=a(e,t),p=s/i*u):p=u;;)if(d=r(d||o,p),n.push(1+d.x),s+=16,!(Math.abs(d.x)>l&&Math.abs(d.v)>l))break;return c?function(e){return n[e*(n.length-1)|0]}:s}}();x.Easings={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}},$.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(e,t){x.Easings[t[0]]=u.apply(null,t[1])});var S=x.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e=f)switch(e){case"name":return"filter";case"extract":var a=r.toString().match(/alpha\(opacity=(.*)\)/i);return r=a?a[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(r)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(r),10)+")"}else switch(e){case"name":return"opacity";case"extract":return r;case"inject":return r}}},register:function(){9>=f||x.State.isGingerbread||(S.Lists.transformsBase=S.Lists.transformsBase.concat(S.Lists.transforms3D));for(var e=0;ea&&(a=1),o=!/(\d)$/i.test(a);break;case"skew":o=!/(deg|\d)$/i.test(a);break;case"rotate":o=!/(deg|\d)$/i.test(a)}return o||(s(r).transformCache[t]="("+a+")"),s(r).transformCache[t]}}}();for(var e=0;e=f||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=f?4===a.split(" ").length&&(a=a.split(/\s+/).slice(0,3).join(" ")):3===a.split(" ").length&&(a+=" 1"),(8>=f?"rgb":"rgba")+"("+a.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(f||x.State.isAndroid&&!x.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")$","i").test(e)},prefixCheck:function(e){if(x.State.prefixMatches[e])return[x.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],r=0,a=t.length;a>r;r++){var i;if(i=0===r?e:t[r]+e.replace(/^\w/,function(e){return e.toUpperCase()}),y.isString(x.State.prefixElement.style[i]))return x.State.prefixMatches[e]=i,[i,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,a;return e=e.replace(t,function(e,t,r,a){return t+t+r+r+a+a}),a=r.exec(e),a?[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t)?"inline":/^(li)$/i.test(t)?"list-item":/^(tr)$/i.test(t)?"table-row":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,t,a,o){function n(e,t){function a(){u&&S.setPropertyValue(e,"display","none")}var l=0;if(8>=f)l=$.css(e,t);else{var u=!1;if(/^(width|height)$/.test(t)&&0===S.getPropertyValue(e,"display")&&(u=!0,S.setPropertyValue(e,"display",S.Values.getDisplayType(e))),!o){if("height"===t&&"border-box"!==S.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var c=e.offsetHeight-(parseFloat(S.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(S.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(S.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(S.getPropertyValue(e,"paddingBottom"))||0);return a(),c}if("width"===t&&"border-box"!==S.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetWidth-(parseFloat(S.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(S.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(S.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(S.getPropertyValue(e,"paddingRight"))||0);return a(),p}}var d;d=s(e)===i?r.getComputedStyle(e,null):s(e).computedStyle?s(e).computedStyle:s(e).computedStyle=r.getComputedStyle(e,null),(f||x.State.isFirefox)&&"borderColor"===t&&(t="borderTopColor"),l=9===f&&"filter"===t?d.getPropertyValue(t):d[t],(""===l||null===l)&&(l=e.style[t]),a()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(t)){var g=n(e,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(t))&&(l=$(e).position()[t]+"px")}return l}var l;if(S.Hooks.registered[t]){var u=t,c=S.Hooks.getRoot(u);a===i&&(a=S.getPropertyValue(e,S.Names.prefixCheck(c)[0])),S.Normalizations.registered[c]&&(a=S.Normalizations.registered[c]("extract",e,a)),l=S.Hooks.extractValue(u,a)}else if(S.Normalizations.registered[t]){var p,d;p=S.Normalizations.registered[t]("name",e),"transform"!==p&&(d=n(e,S.Names.prefixCheck(p)[0]),S.Values.isCSSNullValue(d)&&S.Hooks.templates[t]&&(d=S.Hooks.templates[t][1])),l=S.Normalizations.registered[t]("extract",e,d)}return/^[\d-]/.test(l)||(l=s(e)&&s(e).isSVG&&S.Names.SVGAttribute(t)?/^(height|width)$/i.test(t)?e.getBBox()[t]:e.getAttribute(t):n(e,S.Names.prefixCheck(t)[0])),S.Values.isCSSNullValue(l)&&(l=0),x.debug>=2&&console.log("Get "+t+": "+l),l},setPropertyValue:function(e,t,a,i,o){var n=t;if("scroll"===t)o.container?o.container["scroll"+o.direction]=a:"Left"===o.direction?r.scrollTo(a,o.alternateValue):r.scrollTo(o.alternateValue,a);else if(S.Normalizations.registered[t]&&"transform"===S.Normalizations.registered[t]("name",e))S.Normalizations.registered[t]("inject",e,a),n="transform",a=s(e).transformCache[t];else{if(S.Hooks.registered[t]){var l=t,u=S.Hooks.getRoot(t);i=i||S.getPropertyValue(e,u),a=S.Hooks.injectValue(l,a,i),t=u}if(S.Normalizations.registered[t]&&(a=S.Normalizations.registered[t]("inject",e,a),t=S.Normalizations.registered[t]("name",e)),n=S.Names.prefixCheck(t)[0],8>=f)try{e.style[n]=a}catch(c){x.debug&&console.log("Browser does not support ["+a+"] for ["+n+"]")}else s(e)&&s(e).isSVG&&S.Names.SVGAttribute(t)?e.setAttribute(t,a):e.style[n]=a;x.debug>=2&&console.log("Set "+t+" ("+n+"): "+a)}return[n,a]},flushTransformCache:function(e){function t(t){return parseFloat(S.getPropertyValue(e,t))}var r="";if((f||x.State.isAndroid&&!x.State.isChrome)&&s(e).isSVG){var a={translate:[t("translateX"),t("translateY")],skewX:[t("skewX")],skewY:[t("skewY")],scale:1!==t("scale")?[t("scale"),t("scale")]:[t("scaleX"),t("scaleY")],rotate:[t("rotateZ"),0,0]};$.each(s(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),a[e]&&(r+=e+"("+a[e].join(" ")+") ",delete a[e])})}else{var i,o;$.each(s(e).transformCache,function(t){return i=s(e).transformCache[t],"transformPerspective"===t?(o=i,!0):(9===f&&"rotateZ"===t&&(t="rotate"),void(r+=t+i+" "))}),o&&(r="perspective"+o+" "+r)}S.setPropertyValue(e,"transform",r)}};S.Hooks.register(),S.Normalizations.register(),x.hook=function(e,t,r){var a=i;return y.isWrapped(e)&&(e=[].slice.call(e)),$.each(n(e),function(e,o){if(s(o)===i&&x.init(o),r===i)a===i&&(a=x.CSS.getPropertyValue(o,t));else{var n=x.CSS.setPropertyValue(o,t,r);"transform"===n[0]&&x.CSS.flushTransformCache(o),a=n}}),a};var V=function(){function e(){return u?T.promise||null:f}function t(){function e(e){function d(e,r){var a=i,o=i,s=i;return y.isArray(e)?(a=e[0],!y.isArray(e[1])&&/^[\d-]/.test(e[1])||y.isFunction(e[1])||S.RegEx.isHex.test(e[1])?s=e[1]:(y.isString(e[1])&&!S.RegEx.isHex.test(e[1])||y.isArray(e[1]))&&(o=r?e[1]:c(e[1],n.duration),e[2]!==i&&(s=e[2]))):a=e,r||(o=o||n.easing),y.isFunction(a)&&(a=a.call(t,P,V)),y.isFunction(s)&&(s=s.call(t,P,V)),[a||0,o,s]}function f(e,t){var r,a;return a=(t||0).toString().toLowerCase().replace(/[%A-z]+$/,function(e){return r=e,""}),r||(r=S.Values.getUnitType(e)),[a,r]}function g(){var e={myParent:t.parentNode||a.body,position:S.getPropertyValue(t,"position"),fontSize:S.getPropertyValue(t,"fontSize")},i=e.position===N.lastPosition&&e.myParent===N.lastParent,o=e.fontSize===N.lastFontSize;N.lastParent=e.myParent,N.lastPosition=e.position,N.lastFontSize=e.fontSize;var n=100,l={};if(o&&i)l.emToPx=N.lastEmToPx,l.percentToPxWidth=N.lastPercentToPxWidth,l.percentToPxHeight=N.lastPercentToPxHeight;else{var u=s(t).isSVG?a.createElementNS("http://www.w3.org/2000/svg","rect"):a.createElement("div");x.init(u),e.myParent.appendChild(u),x.CSS.setPropertyValue(u,"position",e.position),x.CSS.setPropertyValue(u,"fontSize",e.fontSize),x.CSS.setPropertyValue(u,"overflow","hidden"),x.CSS.setPropertyValue(u,"overflowX","hidden"),x.CSS.setPropertyValue(u,"overflowY","hidden"),x.CSS.setPropertyValue(u,"boxSizing","content-box"),x.CSS.setPropertyValue(u,"paddingLeft",n+"em"),$.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(e,t){x.CSS.setPropertyValue(u,t,n+"%")}),l.percentToPxWidth=N.lastPercentToPxWidth=(parseFloat(S.getPropertyValue(u,"width",null,!0))||1)/n,l.percentToPxHeight=N.lastPercentToPxHeight=(parseFloat(S.getPropertyValue(u,"height",null,!0))||1)/n,l.emToPx=N.lastEmToPx=(parseFloat(S.getPropertyValue(u,"paddingLeft"))||1)/n,e.myParent.removeChild(u)}return null===N.remToPx&&(N.remToPx=parseFloat(S.getPropertyValue(a.body,"fontSize"))||16),null===N.vwToPx&&(N.vwToPx=parseFloat(r.innerWidth)/100,N.vhToPx=parseFloat(r.innerHeight)/100),l.remToPx=N.remToPx,l.vwToPx=N.vwToPx,l.vhToPx=N.vhToPx,x.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),t),l}if(n.begin&&0===P)try{n.begin.call(m,m)}catch(h){setTimeout(function(){throw h},1)}if("scroll"===k){var w=/^x$/i.test(n.axis)?"Left":"Top",C=parseFloat(n.offset)||0,A,E,F;n.container?y.isWrapped(n.container)||y.isNode(n.container)?(n.container=n.container[0]||n.container,A=n.container["scroll"+w],F=A+$(t).position()[w.toLowerCase()]+C):n.container=null:(A=x.State.scrollAnchor[x.State["scrollProperty"+w]],E=x.State.scrollAnchor[x.State["scrollProperty"+("Left"===w?"Top":"Left")]],F=$(t).offset()[w.toLowerCase()]+C),l={scroll:{rootPropertyValue:!1,startValue:A,currentValue:A,endValue:F,unitType:"",easing:n.easing,scrollData:{container:n.container,direction:w,alternateValue:E}},element:t},x.debug&&console.log("tweensContainer (scroll): ",l.scroll,t)}else if("reverse"===k){if(!s(t).tweensContainer)return void $.dequeue(t,n.queue);"none"===s(t).opts.display&&(s(t).opts.display="auto"),"hidden"===s(t).opts.visibility&&(s(t).opts.visibility="visible"),s(t).opts.loop=!1,s(t).opts.begin=null,s(t).opts.complete=null,b.easing||delete n.easing,b.duration||delete n.duration,n=$.extend({},s(t).opts,n);var H=$.extend(!0,{},s(t).tweensContainer);for(var L in H)if("element"!==L){var z=H[L].startValue;H[L].startValue=H[L].currentValue=H[L].endValue,H[L].endValue=z,y.isEmptyObject(b)||(H[L].easing=n.easing),x.debug&&console.log("reverse tweensContainer ("+L+"): "+JSON.stringify(H[L]),t)}l=H}else if("start"===k){var H;s(t).tweensContainer&&s(t).isAnimating===!0&&(H=s(t).tweensContainer),$.each(v,function(e,t){if(RegExp("^"+S.Lists.colors.join("$|^")+"$").test(e)){var r=d(t,!0),a=r[0],o=r[1],n=r[2];if(S.RegEx.isHex.test(a)){for(var s=["Red","Green","Blue"],l=S.Values.hexToRgb(a),u=n?S.Values.hexToRgb(n):i,c=0;c1e4&&(x.State.calls=o(x.State.calls)),x.State.calls.push([j,m,n,null,T.resolver]),x.State.isTicking===!1&&(x.State.isTicking=!0,p())):P++)}var t=this,n=$.extend({},x.defaults,b),l={},u;if(s(t)===i&&x.init(t),parseFloat(n.delay)&&n.queue!==!1&&$.queue(t,n.queue,function(e){x.velocityQueueEntryFlag=!0,s(t).delayTimer={setTimeout:setTimeout(e,parseFloat(n.delay)),next:e}}),x.mock===!0)n.duration=1;else switch(n.duration.toString().toLowerCase()){case"fast":n.duration=200;break;case"normal":n.duration=h;break;case"slow":n.duration=600;break;default:n.duration=parseFloat(n.duration)||1}n.easing=c(n.easing,n.duration),n.begin&&!y.isFunction(n.begin)&&(n.begin=null),n.progress&&!y.isFunction(n.progress)&&(n.progress=null),n.complete&&!y.isFunction(n.complete)&&(n.complete=null),n.display!==i&&null!==n.display&&(n.display=n.display.toString().toLowerCase(),"auto"===n.display&&(n.display=x.CSS.Values.getDisplayType(t))),n.visibility&&(n.visibility=n.visibility.toString().toLowerCase()),n.mobileHA=n.mobileHA&&x.State.isMobile&&!x.State.isGingerbread,n.queue===!1?n.delay?setTimeout(e,n.delay):e():$.queue(t,n.queue,function(t,r){return r===!0?(T.promise&&T.resolver(m),!0):(x.velocityQueueEntryFlag=!0,void e(t))}),""!==n.queue&&"fx"!==n.queue||"inprogress"===$.queue(t)[0]||$.dequeue(t)}var l=arguments[0]&&($.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||y.isString(arguments[0].properties)),u,f,g,m,v,b;if(y.isWrapped(this)?(u=!1,g=0,m=this,f=this):(u=!0,g=1,m=l?arguments[0].elements:arguments[0]),m=y.isWrapped(m)?[].slice.call(m):m){l?(v=arguments[0].properties,b=arguments[0].options):(v=arguments[g],b=arguments[g+1]);var V=y.isArray(m)||y.isNodeList(m)?m.length:1,P=0;if("stop"!==v&&!$.isPlainObject(b)){var w=g+1;b={};for(var C=w;CR;R++){var q={delay:L.delay};R===z-1&&(q.display=L.display,q.visibility=L.visibility,q.complete=L.complete),x(m,"reverse",q)}return e()}};x=$.extend(V,x),x.animate=V,x.State.isMobile||a.hidden===i||a.addEventListener("visibilitychange",function(){a.hidden?(m=function(e){return setTimeout(function(){e(!0)},16)},p()):m=r.requestAnimationFrame||g});var P;return e&&e.fn!==i?P=e:r.Zepto&&(P=r.Zepto),(P||r).Velocity=x,P&&(P.fn.velocity=V,P.fn.velocity.defaults=x.defaults),$.each(["Down","Up"],function(e,t){x.Sequences["slide"+t]=function(e,r,a,o,n,s){var l=$.extend({},r),u=l.begin,c=l.complete,p={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},d={};l.display===i&&(l.display="Down"===t?"inline"===x.CSS.Values.getDisplayType(e)?"inline-block":"block":"none"),l.begin=function(e){u&&u.call(e,e);for(var r in p){d[r]=e.style[r];var a=x.CSS.getPropertyValue(e,r);p[r]="Down"===t?[a,0]:[0,a]}},l.complete=function(e){for(var t in d)e.style[t]=d[t];c&&c.call(e,e),s&&s.resolver(n||e)},x(e,p,l)}}),$.each(["In","Out"],function(e,t){x.Sequences["fade"+t]=function(e,r,a,o,n,s){var l=$.extend({},r),u={opacity:"In"===t?1:0};if(a!==o-1)l.complete=l.begin=null;else{var c=l.complete;l.complete=function(){c&&c.call(e,e),s&&s.resolver(n||e)}}l.display===i&&(l.display="In"===t?"auto":"none"),x(this,u,l)}}),x}(e||window,window,document)}); \ No newline at end of file diff --git a/packages/velocity/package.json b/packages/velocity/package.json index 809e00c5..ef1471a0 100644 --- a/packages/velocity/package.json +++ b/packages/velocity/package.json @@ -1,6 +1,6 @@ { "name": "velocity-animate", - "version": "0.11.7", + "version": "0.11.8", "description": "Accelerated JavaScript animation.", "keywords": [ "velocity", @@ -42,4 +42,4 @@ "grunt-contrib-requirejs": "~0.4.4", "grunt-contrib-uglify": "~0.2.2" } -} +} \ No newline at end of file diff --git a/packages/velocity/velocity.js b/packages/velocity/velocity.js index 5270ee53..500adaca 100644 --- a/packages/velocity/velocity.js +++ b/packages/velocity/velocity.js @@ -1,4 +1,4 @@ -/*! VelocityJS.org (0.11.7). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ +/*! VelocityJS.org (0.11.8). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ /************************* Velocity jQuery Shim @@ -15,6 +15,11 @@ Setup ***************/ + /* If jQuery is already loaded, there's no point in loading this shim and polluting the window object with Velocity. */ + if (window.jQuery) { + return; + } + if (window.Velocity !== undefined) { throw new Error("Velocity is already loaded. The shim must be loaded BEFORE jquery.velocity.js."); } @@ -274,6 +279,7 @@ } type = (type || "fx") + "queue"; + var q = $.data(elem, type); if (!data) { @@ -290,25 +296,28 @@ }; /* jQuery 1.4.3 */ - $.dequeue = function (elem, type) { - type = type || "fx"; + $.dequeue = function (elems, type) { + /* Custom: Embed element iteration. */ + $.each(elems.nodeType ? [ elems ] : elems, function(i, elem) { + type = type || "fx"; - var queue = $.queue(elem, type), - fn = queue.shift(); + var queue = $.queue(elem, type), + fn = queue.shift(); - if (fn === "inprogress") { - fn = queue.shift(); - } - - if (fn) { - if (type === "fx") { - queue.unshift("inprogress"); + if (fn === "inprogress") { + fn = queue.shift(); } - fn.call(elem, function() { - $.dequeue(elem, type); - }); - } + if (fn) { + if (type === "fx") { + queue.unshift("inprogress"); + } + + fn.call(elem, function() { + $.dequeue(elem, type); + }); + } + }); }; /****************** @@ -329,7 +338,7 @@ }, offset: function () { - /* jQuery altered code: Disconnected DOM node checking and iOS3+BlackBerry support has been dropped. */ + /* jQuery altered code: Dropped disconnected DOM node checking and iOS3+BlackBerry support. */ var box = this[0].getBoundingClientRect(); return { @@ -401,18 +410,18 @@ Velocity.js ******************/ -/*! VelocityJS.org (0.11.7). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ +/*! VelocityJS.org (0.11.8). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ ;(function (factory) { /* CommonJS module. */ if (typeof module === "object" && typeof module.exports === "object") { module.exports = factory(window.Velocity ? window.jQuery : require("jquery")); /* AMD module. */ - } else if (typeof define === "function" && define.amd) { + } else if (typeof define === "function" && define.amd) { if (window.Velocity) { - define("velocity", factory); + define(factory); } else { - define("velocity", [ "jquery" ], factory) + define([ "jquery" ], factory); } /* Browser globals. */ } else { @@ -432,14 +441,6 @@ return function (global, window, document, undefined) { - completeCall(): Handles the cleanup process for each Velocity call. */ - /***************** - Constants - *****************/ - - var NAME = "velocity", - DEFAULT_DURATION = 400, - DEFAULT_EASING = "swing"; - /********************* Helper Functions *********************/ @@ -465,8 +466,8 @@ return function (global, window, document, undefined) { return undefined; })(); - /* rAF polyfill. Gist: https://gist.github.com/julianshapiro/9497513 */ - var rAFPollyfill = (function() { + /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ + var rAFShim = (function() { var timeLast = 0; return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { @@ -482,7 +483,7 @@ return function (global, window, document, undefined) { }; })(); - var ticker = window.requestAnimationFrame || rAFPollyfill; + var ticker = window.requestAnimationFrame || rAFShim; /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ function compactSparseArray (array) { @@ -591,12 +592,19 @@ return function (global, window, document, undefined) { /* Shorthand alias for jQuery's $.data() utility. */ function Data (element) { /* Hardcode a reference to the plugin name. */ - var response = $.data(element, NAME); + var response = $.data(element, "velocity"); /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ return response === null ? undefined : response; }; + /***************** + Constants + *****************/ + + var DURATION_DEFAULT = 400, + EASING_DEFAULT = "swing"; + /************* State *************/ @@ -643,12 +651,12 @@ return function (global, window, document, undefined) { /* Page-wide option defaults, which can be overriden by the user. */ defaults: { queue: "", - duration: DEFAULT_DURATION, - easing: DEFAULT_EASING, + duration: DURATION_DEFAULT, + easing: EASING_DEFAULT, begin: null, complete: null, progress: null, - display: null, + display: undefined, loop: false, delay: false, mobileHA: true, @@ -658,7 +666,7 @@ return function (global, window, document, undefined) { /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache instantiated on it. */ init: function (element) { - $.data(element, NAME, { + $.data(element, "velocity", { /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ isSVG: Type.isSVG(element), /* Keep track of whether the element is currently being animated by Velocity. @@ -680,44 +688,10 @@ return function (global, window, document, undefined) { /* Velocity's core animation method, later aliased to $.fn if a framework (jQuery or Zepto) is detected. */ animate: null, /* Defined below. */ /* A reimplementation of jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ - hook: function (elements, arg2, arg3) { - var value = undefined; - - /* Unwrap jQuery/Zepto objects. */ - if (Type.isWrapped(elements)) { - elements = [].slice.call(elements); - } - - $.each(createElementsArray(elements), function(i, element) { - /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ - if (Data(element) === undefined) { - Velocity.init(element); - } - - /* Get property value. If an element set was passed in, only return the value for the first element. */ - if (arg3 === undefined) { - if (value === undefined) { - value = Velocity.CSS.getPropertyValue(element, arg2); - } - /* Set property value. */ - } else { - /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ - var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); - - /* Transform properties don't automatically set. They have to be flushed to the DOM. */ - if (adjustedSet[0] === "transform") { - Velocity.CSS.flushTransformCache(element); - } - - value = adjustedSet; - } - }); - - return value; - }, + hook: null, /* Defined below. */ /* Set to true to force a duration of 1ms for all animations so that UI testing can be performed without waiting on animations to complete. */ mock: false, - version: { major: 0, minor: 11, patch: 7 }, + version: { major: 0, minor: 11, patch: 8 }, /* Set to 1 or 2 (most verbose) to output debug info to console. */ debug: false }; @@ -745,18 +719,39 @@ return function (global, window, document, undefined) { } /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ - var generateBezier = (function () { - function A (aA1, aA2) { - return 1.0 - 3.0 * aA2 + 3.0 * aA1; + function generateBezier (mX1, mY1, mX2, mY2) { + var NEWTON_ITERATIONS = 4, + NEWTON_MIN_SLOPE = 0.001, + SUBDIVISION_PRECISION = 0.0000001, + SUBDIVISION_MAX_ITERATIONS = 10, + kSplineTableSize = 11, + kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), + float32ArraySupported = "Float32Array" in window; + + /* Must contain four arguments. */ + if (arguments.length !== 4) { + return false; } - function B (aA1, aA2) { - return 3.0 * aA2 - 6.0 * aA1; - } - function C (aA1) { - return 3.0 * aA1; + /* Arguments must be numbers. */ + for (var i = 0; i < 4; ++i) { + if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { + return false; + } } + /* X values must be in the [0, 1] range. */ + mX1 = Math.min(mX1, 1); + mX2 = Math.min(mX2, 1); + mX1 = Math.max(mX1, 0); + mX2 = Math.max(mX2, 0); + + var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + + function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } + function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } + function C (aA1) { return 3.0 * aA1; } + function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; } @@ -765,56 +760,92 @@ return function (global, window, document, undefined) { return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } - return function (mX1, mY1, mX2, mY2) { - /* Must contain four arguments. */ - if (arguments.length !== 4) { - return false; + function newtonRaphsonIterate (aX, aGuessT) { + for (var i = 0; i < NEWTON_ITERATIONS; ++i) { + var currentSlope = getSlope(aGuessT, mX1, mX2); + + if (currentSlope === 0.0) return aGuessT; + + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; } - /* Arguments must be numbers. */ - for (var i = 0; i < 4; ++i) { - if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { - return false; - } + return aGuessT; + } + + function calcSampleValues () { + for (var i = 0; i < kSplineTableSize; ++i) { + mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); } + } - /* X values must be in the [0, 1] range. */ - mX1 = Math.min(mX1, 1); - mX2 = Math.min(mX2, 1); - mX1 = Math.max(mX1, 0); - mX2 = Math.max(mX2, 0); + function binarySubdivide (aX, aA, aB) { + var currentX, currentT, i = 0; - function getTForX (aX) { - var aGuessT = aX; + do { + currentT = aA + (aB - aA) / 2.0; + currentX = calcBezier(currentT, mX1, mX2) - aX; + if (currentX > 0.0) { + aB = currentT; + } else { + aA = currentT; + } + } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); - for (var i = 0; i < 8; ++i) { - var currentSlope = getSlope(aGuessT, mX1, mX2); + return currentT; + } - if (currentSlope === 0.0) { - return aGuessT; - } + function getTForX (aX) { + var intervalStart = 0.0, + currentSample = 1, + lastSample = kSplineTableSize - 1; - var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + for (; currentSample != lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { + intervalStart += kSampleStepSize; + } - aGuessT -= currentX / currentSlope; - } + --currentSample; + + var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]), + guessForT = intervalStart + dist * kSampleStepSize, + initialSlope = getSlope(guessForT, mX1, mX2); - return aGuessT; + if (initialSlope >= NEWTON_MIN_SLOPE) { + return newtonRaphsonIterate(aX, guessForT); + } else if (initialSlope == 0.0) { + return guessForT; + } else { + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); } + } - return function (aX) { - if (mX1 === mY1 && mX2 === mY2) { - return aX; - } else { - return calcBezier(getTForX(aX), mY1, mY2); - } - }; + var _precomputed = false; + + function precompute() { + _precomputed = true; + if (mX1 != mY1 || mX2 != mY2) calcSampleValues(); + } + + var f = function (aX) { + if (!_precomputed) precompute(); + if (mX1 === mY1 && mX2 === mY2) return aX; + if (aX === 0) return 0; + if (aX === 1) return 1; + + return calcBezier(getTForX(aX), mY1, mY2); }; - }()); + + f.getControlPoints = function() { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; + + var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; + f.toString = function () { return str; }; + + return f; + } /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass - then adjusts the time dela -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ + then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ var generateSpringRK4 = (function () { function springAccelerationForState (state) { @@ -900,77 +931,46 @@ return function (global, window, document, undefined) { }; }()); - /* Velocity embeds the named easings from jQuery, jQuery UI, and CSS3 in order to save users from having to include additional libraries on their page. */ - (function () { + /* Easings from jQuery, jQuery UI, and CSS3. */ + Velocity.Easings = { /* jQuery's default named easing types. */ - Velocity.Easings["linear"] = function(p) { - return p; - }; - - Velocity.Easings["swing"] = function(p) { - return 0.5 - Math.cos(p * Math.PI) / 2; - }; - + linear: function(p) { return p; }, + swing: function(p) { return 0.5 - Math.cos( p * Math.PI ) / 2 }, /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ - Velocity.Easings["spring"] = function(p) { - return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); - }; - - /* CSS3's named easing types. */ - Velocity.Easings["ease"] = generateBezier(0.25, 0.1, 0.25, 1.0); - Velocity.Easings["ease-in"] = generateBezier(0.42, 0.0, 1.00, 1.0); - Velocity.Easings["ease-out"] = generateBezier(0.00, 0.0, 0.58, 1.0); - Velocity.Easings["ease-in-out"] = generateBezier(0.42, 0.0, 0.58, 1.0); - - /* jQuery UI's Robert Penner easing equations. Copyright The jQuery Foundation. MIT License: https://jquery.org/license */ - var baseEasings = {}; - - $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(i, name) { - baseEasings[name] = function(p) { - return Math.pow(p, i + 2); - }; - }); - - $.extend(baseEasings, { - Sine: function (p) { - return 1 - Math.cos(p * Math.PI / 2); - }, - - Circ: function (p) { - return 1 - Math.sqrt(1 - p * p); - }, - - Elastic: function(p) { - return p === 0 || p === 1 ? p : - -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15); - }, - - Back: function(p) { - return p * p * (3 * p - 2); - }, - - Bounce: function (p) { - var pow2, - bounce = 4; - - while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {} - return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2); - } - }); - - /* jQuery's easing generator for the object above. */ - $.each(baseEasings, function(name, easeIn) { - Velocity.Easings["easeIn" + name] = easeIn; - Velocity.Easings["easeOut" + name] = function(p) { - return 1 - easeIn(1 - p); - }; - Velocity.Easings["easeInOut" + name] = function(p) { - return p < 0.5 ? - easeIn(p * 2) / 2 : - 1 - easeIn(p * -2 + 2) / 2; - }; + spring: function(p) { return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); } + }; + $.each( + [ + /* CSS3's named easing types. */ + [ "ease", [ 0.25, 0.1, 0.25, 1.0 ] ], + [ "ease-in", [ 0.42, 0.0, 1.00, 1.0 ] ], + [ "ease-out", [ 0.00, 0.0, 0.58, 1.0 ] ], + [ "ease-in-out", [ 0.42, 0.0, 0.58, 1.0 ] ], + /* Robert Penner easing equations. */ + [ "easeInSine", [ 0.47, 0, 0.745, 0.715 ] ], + [ "easeOutSine", [ 0.39, 0.575, 0.565, 1 ] ], + [ "easeInOutSine", [ 0.445, 0.05, 0.55, 0.95 ] ], + [ "easeInQuad", [ 0.55, 0.085, 0.68, 0.53 ] ], + [ "easeOutQuad", [ 0.25, 0.46, 0.45, 0.94 ] ], + [ "easeInOutQuad", [ 0.455, 0.03, 0.515, 0.955 ] ], + [ "easeInCubic", [ 0.55, 0.055, 0.675, 0.19 ] ], + [ "easeOutCubic", [ 0.215, 0.61, 0.355, 1 ] ], + [ "easeInOutCubic", [ 0.645, 0.045, 0.355, 1 ] ], + [ "easeInQuart", [ 0.895, 0.03, 0.685, 0.22 ] ], + [ "easeOutQuart", [ 0.165, 0.84, 0.44, 1 ] ], + [ "easeInOutQuart", [ 0.77, 0, 0.175, 1 ] ], + [ "easeInQuint", [ 0.755, 0.05, 0.855, 0.06 ] ], + [ "easeOutQuint", [ 0.23, 1, 0.32, 1 ] ], + [ "easeInOutQuint", [ 0.86, 0, 0.07, 1 ] ], + [ "easeInExpo", [ 0.95, 0.05, 0.795, 0.035 ] ], + [ "easeOutExpo", [ 0.19, 1, 0.22, 1 ] ], + [ "easeInOutExpo", [ 1, 0, 0, 1 ] ], + [ "easeInCirc", [ 0.6, 0.04, 0.98, 0.335 ] ], + [ "easeOutCirc", [ 0.075, 0.82, 0.165, 1 ] ], + [ "easeInOutCirc", [ 0.785, 0.135, 0.15, 0.86 ] ] + ], function(i, easingArray) { + Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); }); - })(); /* Determine the appropriate easing type given an easing input. */ function getEasing(value, duration) { @@ -1003,7 +1003,7 @@ return function (global, window, document, undefined) { if (Velocity.Easings[Velocity.defaults.easing]) { easing = Velocity.defaults.easing; } else { - easing = DEFAULT_EASING; + easing = EASING_DEFAULT; } } @@ -1608,7 +1608,6 @@ return function (global, window, document, undefined) { element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. We subtract border and padding to get the sum of interior + scrollbar. */ - var computedValue = 0; /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array @@ -1945,6 +1944,43 @@ return function (global, window, document, undefined) { CSS.Hooks.register(); CSS.Normalizations.register(); + /* Allow hook setting in the same fashion as jQuery's $.css(). */ + Velocity.hook = function (elements, arg2, arg3) { + var value = undefined; + + /* Unwrap jQuery/Zepto objects. */ + if (Type.isWrapped(elements)) { + elements = [].slice.call(elements); + } + + $.each(createElementsArray(elements), function(i, element) { + /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ + if (Data(element) === undefined) { + Velocity.init(element); + } + + /* Get property value. If an element set was passed in, only return the value for the first element. */ + if (arg3 === undefined) { + if (value === undefined) { + value = Velocity.CSS.getPropertyValue(element, arg2); + } + /* Set property value. */ + } else { + /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ + var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); + + /* Transform properties don't automatically set. They have to be flushed to the DOM. */ + if (adjustedSet[0] === "transform") { + Velocity.CSS.flushTransformCache(element); + } + + value = adjustedSet; + } + }); + + return value; + }; + /***************** Animation *****************/ @@ -2119,15 +2155,23 @@ return function (global, window, document, undefined) { is stopped, the next item in its animation queue is immediately triggered. */ /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) or a custom queue string can be passed in. */ - /* Stopping is achieved by traversing active calls for those which contain the targeted element. */ /* Note: The stop command runs prior to Queueing since its behavior is intended to take effect *immediately*, regardless of the element's current queue state. */ + + /* Iterate through every active call. */ $.each(Velocity.State.calls, function(i, activeCall) { /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ if (activeCall) { - /* If we're operating on a single element, wrap it in an array so that $.each() can iterate over it. */ + /* Iterate through the active call's targeted elements. */ $.each(createElementsArray(activeCall[1]), function(k, activeElement) { - $.each(createElementsArray(elements), function(l, element) { + var queueName = Type.isString(options) ? options : ""; + + if (options !== undefined && activeCall[2].queue !== queueName) { + return true; + } + + /* Iterate through the calls targeted by the stop command. */ + $.each(createElementsArray(elements), function(l, element) { /* Check that this call was applied to the target element. */ if (element === activeElement) { if (Data(element)) { @@ -2138,13 +2182,10 @@ return function (global, window, document, undefined) { }); } - /* Clear the remaining queued calls. */ - if (options === true || Type.isString(options)) { - /* The options argument can be overriden with a custom queue's name. */ - var queueName = Type.isString(options) ? options : ""; - + /* Optionally clear the remaining queued calls. */ + if (options !== undefined) { /* Iterate through the items in the element's queue. */ - $.each($.queue(element, queueName), function(i, item) { + $.each($.queue(element, queueName), function(_, item) { /* The queue array can contain an "inprogress" string, which we skip. */ if (Type.isFunction(item)) { /* Pass the item's callback a flag indicating that we want to abort from the queue call. @@ -2210,7 +2251,7 @@ return function (global, window, document, undefined) { the duration of each element's animation, using floors to prevent producing very short durations. */ if (options.drag) { /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ - options.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DEFAULT_DURATION); + options.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). @@ -2336,7 +2377,7 @@ return function (global, window, document, undefined) { break; case "normal": - opts.duration = DEFAULT_DURATION; + opts.duration = DURATION_DEFAULT; break; case "slow": @@ -2377,7 +2418,8 @@ return function (global, window, document, undefined) { *********************************/ /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ - if (opts.display) { + /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ + if (opts.display !== undefined && opts.display !== null) { opts.display = opts.display.toString().toLowerCase(); /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ @@ -2516,9 +2558,9 @@ return function (global, window, document, undefined) { *********************/ /* If the element was hidden via the display option in the previous call, - revert display to block prior to reversal so that the element is visible again. */ + revert display to "auto" prior to reversal so that the element is visible again. */ if (Data(element).opts.display === "none") { - Data(element).opts.display = "block"; + Data(element).opts.display = "auto"; } if (Data(element).opts.visibility === "hidden") { @@ -2722,7 +2764,7 @@ return function (global, window, document, undefined) { /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ - if (((opts.display && opts.display !== "none") || (opts.visibility && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { + if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { startValue = 0; } @@ -2814,9 +2856,9 @@ return function (global, window, document, undefined) { startValue = parseFloat(startValue) || 0; endValue = parseFloat(endValue) || 0; - /***************************** - Value & Unit Conversion - *****************************/ + /*************************************** + Property-Specific Value Conversion + ***************************************/ /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ if (endValueUnitType === "%") { @@ -2837,6 +2879,10 @@ return function (global, window, document, undefined) { } } + /*************************** + Unit Ratio Calculation + ***************************/ + /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred @@ -2849,7 +2895,6 @@ return function (global, window, document, undefined) { of batching the SETs and GETs together upfront outweights the potential overhead of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ - function calculateUnitRatios () { /************************ @@ -2901,12 +2946,9 @@ return function (global, window, document, undefined) { /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ - Velocity.CSS.setPropertyValue(dummy, "minWidth", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "maxWidth", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "width", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "minHeight", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "maxHeight", measurement + "%"); - Velocity.CSS.setPropertyValue(dummy, "height", measurement + "%"); + $.each([ "minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height" ], function(i, property) { + Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); + }); /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ @@ -2948,6 +2990,10 @@ return function (global, window, document, undefined) { return unitRatios; } + /******************** + Unit Conversion + ********************/ + /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ if (/[\/*]/.test(operator)) { endValueUnitType = startValueUnitType; @@ -3006,9 +3052,9 @@ return function (global, window, document, undefined) { } } - /*********************** - Value Operators - ***********************/ + /********************* + Relative Values + *********************/ /* Operator logic must be performed last since it requires unit-normalized start and end values. */ /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" @@ -3235,7 +3281,7 @@ return function (global, window, document, undefined) { /* The rAF loop has been paused by the browser, so we manually restart the tick. */ tick(); } else { - ticker = window.requestAnimationFrame || rAFPollyfill; + ticker = window.requestAnimationFrame || rAFShim; } }); } @@ -3317,7 +3363,12 @@ return function (global, window, document, undefined) { /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ - if (opts.display && opts.display !== "none") { + if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { + /* Popular versions of major browsers only support the prefixed value of flex. */ + if (opts.display === "flex") { + CSS.setPropertyValue(element, "display", (IE ? "-ms-" : "-webkit-") + opts.display); + } + CSS.setPropertyValue(element, "display", opts.display); } @@ -3433,7 +3484,7 @@ return function (global, window, document, undefined) { /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ - if (opts.display && opts.display !== "none") { + if (opts.display !== undefined && opts.display !== "none") { Velocity.State.calls[i][2].display = false; } @@ -3650,132 +3701,45 @@ return function (global, window, document, undefined) { $.each([ "Down", "Up" ], function(i, direction) { Velocity.Sequences["slide" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { var opts = $.extend({}, options), - originalValues = { - height: null, - marginTop: null, - marginBottom: null, - paddingTop: null, - paddingBottom: null, - overflow: null, - overflowX: null, - overflowY: null - }, - /* Since the slide functions make use of the begin and complete callbacks, the user's custom callbacks are stored - upfront for triggering once slideDown/Up's own callback logic is complete. */ begin = opts.begin, complete = opts.complete, - isHeightAuto = false; - - /* Allow the user to set display to null to bypass display toggling. */ - if (opts.display !== null) { - /* Unless the user is overriding the display value, show the element before slideDown begins and hide the element after slideUp completes. */ - if (direction === "Down") { - /* All sliding elements are set to the "block" display value (as opposed to an element-appropriate block/inline distinction) - because inline elements cannot actually have their dimensions modified. */ - opts.display = opts.display || "auto"; - } else { - opts.display = opts.display || "none"; - } - } - - /* Begin callback. */ - opts.begin = function () { - /* Check for height: "auto" so we can revert back to it when the sliding animation is complete. */ - function checkHeightAuto() { - originalValues.height = parseFloat(Velocity.CSS.getPropertyValue(element, "height")); - - /* Determine if height was originally "auto" by checking if the computed "auto" value is identical to the original value. */ - element.style.height = "auto"; - if (parseFloat(Velocity.CSS.getPropertyValue(element, "height")) === originalValues.height) { - isHeightAuto = true; - } - - /* Revert to the computed value before sliding begins to prevent vertical popping due to scrollbars. */ - Velocity.CSS.setPropertyValue(element, "height", originalValues.height + "px"); - } - - if (direction === "Down") { - originalValues.overflow = [ Velocity.CSS.getPropertyValue(element, "overflow"), 0 ]; - originalValues.overflowX = [ Velocity.CSS.getPropertyValue(element, "overflowX"), 0 ]; - originalValues.overflowY = [ Velocity.CSS.getPropertyValue(element, "overflowY"), 0 ]; - - /* Ensure the element is visible, and temporarily remove vertical scrollbars since animating them is visually unappealing. */ - element.style.overflow = "hidden"; - element.style.overflowX = "visible"; - element.style.overflowY = "hidden"; - - /* With the scrollars no longer affecting sizing, determine whether the element is currently height: "auto". */ - checkHeightAuto(); - - /* Cache the elements' original vertical dimensional values so that we can animate back to them. */ - for (var property in originalValues) { - /* Overflow values have already been cached; do not overwrite them with "hidden". */ - if (/^overflow/.test(property)) { - continue; - } + computedValues = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" }, + inlineValues = {}; - var propertyValue = Velocity.CSS.getPropertyValue(element, property); - - if (property === "height") { - propertyValue = parseFloat(propertyValue); - } - - /* Use forcefeeding to animate slideDown properties from 0. */ - originalValues[property] = [ propertyValue, 0 ]; - } - } else { - checkHeightAuto(); - - for (var property in originalValues) { - var propertyValue = Velocity.CSS.getPropertyValue(element, property); - - if (property === "height") { - propertyValue = parseFloat(propertyValue); - } + if (opts.display === undefined) { + /* Show the element before slideDown begins and hide the element after slideUp completes. */ + /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ + opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); + } - /* Use forcefeeding to animate slideUp properties toward 0. */ - originalValues[property] = [ 0, propertyValue ]; - } + opts.begin = function (element) { + /* If the user passed in a begin callback, fire it now. */ + begin && begin.call(element, element); - /* Both directions hide scrollbars since scrollbar height tweening looks unappealing. */ - element.style.overflow = "hidden"; - element.style.overflowX = "visible"; - element.style.overflowY = "hidden"; - } + /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ + for (var property in computedValues) { + /* Cache all inline values, we reset to upon animation completion. */ + inlineValues[property] = element.style[property]; - /* If the user passed in a begin callback, fire it now. */ - if (begin) { - begin.call(element, element); + /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, + use forcefeeding to start from computed values and animate down to 0. */ + var propertyValue = Velocity.CSS.getPropertyValue(element, property); + computedValues[property] = (direction === "Down") ? [ propertyValue, 0 ] : [ 0, propertyValue ]; } } - /* Complete callback. */ opts.complete = function (element) { - var propertyValuePosition = (direction === "Down") ? 0 : 1; - - if (isHeightAuto === true) { - /* If the element's height was originally set to auto, overwrite the computed value with "auto". */ - originalValues.height[propertyValuePosition] = "auto"; - } else { - originalValues.height[propertyValuePosition] += "px"; - } - - /* Reset element to its original values once its slide animation is complete: For slideDown, overflow - values are reset. For slideUp, all values are reset (since they were animated to 0).) */ - for (var property in originalValues) { - element.style[property] = originalValues[property][propertyValuePosition]; + /* Reset element to its pre-slide inline values once its slide animation is complete. */ + for (var property in inlineValues) { + element.style[property] = inlineValues[property]; } /* If the user passed in a complete callback, fire it now. */ - if (complete) { - complete.call(element, element); - } - + complete && complete.call(element, element); promiseData && promiseData.resolver(elements || element); }; - /* Animation triggering. */ - Velocity(element, originalValues, opts); + Velocity(element, computedValues, opts); }; }); @@ -3805,8 +3769,8 @@ return function (global, window, document, undefined) { /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ /* Note: We allow users to pass in "null" to skip display setting altogether. */ - if (opts.display !== null) { - opts.display = opts.display || ((direction === "In") ? "auto" : "none"); + if (opts.display === undefined) { + opts.display = (direction === "In" ? "auto" : "none"); } Velocity(this, propertiesMap, opts); @@ -3822,8 +3786,7 @@ return function (global, window, document, undefined) { ******************/ /* When animating height/width to a % value on an element *without* box-sizing:border-box and *with* visible scrollbars - on *both* axes, the opposite axis (e.g. height vs width) will be shortened by the height/width of its scrollbar. */ - +on *both* axes, the opposite axis (e.g. height vs width) will be shortened by the height/width of its scrollbar. */ /* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. - Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties - will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ \ No newline at end of file +Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties +will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ \ No newline at end of file diff --git a/packages/velocity/velocity.min.js b/packages/velocity/velocity.min.js index 38e96167..aae36031 100644 --- a/packages/velocity/velocity.min.js +++ b/packages/velocity/velocity.min.js @@ -1,4 +1,4 @@ -/*! VelocityJS.org (0.11.7). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ +/*! VelocityJS.org (0.11.8). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ /*! VelocityJS.org jQuery Shim (1.0.0-rc1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ -!function(e){function t(e){var t=e.length,r=$.type(e);return"function"===r||$.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}if(void 0!==e.Velocity)throw new Error("Velocity is already loaded. The shim must be loaded BEFORE jquery.velocity.js.");var $=function(e,t){return new $.fn.init(e,t)};$.isWindow=function(e){return null!=e&&e==e.window},$.type=function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?o[n.call(e)]||"object":typeof e},$.isArray=Array.isArray||function(e){return"array"===$.type(e)},$.isPlainObject=function(e){var t;if(!e||"object"!==$.type(e)||e.nodeType||$.isWindow(e))return!1;try{if(e.constructor&&!a.call(e,"constructor")&&!a.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(t in e);return void 0===t||a.call(e,t)},$.each=function(e,r,o){var a,n=0,i=e.length,s=t(e);if(o){if(s)for(;i>n&&(a=r.apply(e[n],o),a!==!1);n++);else for(n in e)if(a=r.apply(e[n],o),a===!1)break}else if(s)for(;i>n&&(a=r.call(e[n],n,e[n]),a!==!1);n++);else for(n in e)if(a=r.call(e[n],n,e[n]),a===!1)break;return e},$.data=function(e,t,o){if(void 0===o){var a=e[$.expando],n=a&&r[a];if(void 0===t)return n;if(n&&t in n)return n[t]}else if(void 0!==t){var a=e[$.expando]||(e[$.expando]=++$.uuid);return r[a]=r[a]||{},r[a][t]=o,o}},$.removeData=function(e,t){var o=e[$.expando],a=o&&r[o];a&&$.each(t,function(e,t){delete a[t]})},$.extend=function(){var e,t,r,o,a,n,i=arguments[0]||{},s=1,l=arguments.length,u=!1;for("boolean"==typeof i&&(u=i,i=arguments[s]||{},s++),"object"!=typeof i&&"function"!==$.type(i)&&(i={}),s===l&&(i=this,s--);l>s;s++)if(null!=(a=arguments[s]))for(o in a)e=i[o],r=a[o],i!==r&&(u&&r&&($.isPlainObject(r)||(t=$.isArray(r)))?(t?(t=!1,n=e&&$.isArray(e)?e:[]):n=e&&$.isPlainObject(e)?e:{},i[o]=$.extend(u,n,r)):void 0!==r&&(i[o]=r));return i},$.queue=function(e,r,o){function a(e,r){var o=r||[];return null!=e&&(t(Object(e))?!function(e,t){for(var r=+t.length,o=0,a=e.length;r>o;)e[a++]=t[o++];if(r!==r)for(;void 0!==t[o];)e[a++]=t[o++];return e.length=a,e}(o,"string"==typeof e?[e]:e):[].push.call(o,e)),o}if(e){r=(r||"fx")+"queue";var n=$.data(e,r);return o?(!n||$.isArray(o)?n=$.data(e,r,a(o)):n.push(o),n):n||[]}},$.dequeue=function(e,t){t=t||"fx";var r=$.queue(e,t),o=r.shift();"inprogress"===o&&(o=r.shift()),o&&("fx"===t&&r.unshift("inprogress"),o.call(e,function(){$.dequeue(e,t)}))},$.fn=$.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw new Error("Not a DOM node.")},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+(e.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:t.left+(e.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function e(){for(var e=this.offsetParent||document;e&&"html"===!e.nodeType.toLowerCase&&"static"===e.style.position;)e=e.offsetParent;return e||document}var t=this[0],e=e.apply(t),r=this.offset(),o=/^(?:body|html)$/i.test(e.nodeName)?{top:0,left:0}:$(e).offset();return r.top-=parseFloat(t.style.marginTop)||0,r.left-=parseFloat(t.style.marginLeft)||0,e.style&&(o.top+=parseFloat(e.style.borderTopWidth)||0,o.left+=parseFloat(e.style.borderLeftWidth)||0),{top:r.top-o.top,left:r.left-o.left}}};var r={};$.expando="velocity"+(new Date).getTime(),$.uuid=0;for(var o={},a=o.hasOwnProperty,n=o.toString,i="Boolean Number String Function Array Date RegExp Object Error".split(" "),s=0;sr;r++)if(S.State.calls[r]){var n=S.State.calls[r],i=n[0],l=n[2],u=n[3];u||(u=S.State.calls[r][3]=t-16);for(var f=Math.min((t-u)/l.duration,1),d=0,g=i.length;g>d;d++){var y=i[d],m=y.element;if(s(m)){var b=!1;l.display&&"none"!==l.display&&w.setPropertyValue(m,"display",l.display),l.visibility&&"hidden"!==l.visibility&&w.setPropertyValue(m,"visibility",l.visibility);for(var x in y)if("element"!==x){var P=y[x],V,C=v.isString(P.easing)?S.Easings[P.easing]:P.easing;if(V=1===f?P.endValue:P.startValue+(P.endValue-P.startValue)*C(f),P.currentValue=V,w.Hooks.registered[x]){var T=w.Hooks.getRoot(x),k=s(m).rootPropertyValueCache[T];k&&(P.rootPropertyValue=k)}var E=w.setPropertyValue(m,x,P.currentValue+(0===parseFloat(V)?"":P.unitType),P.rootPropertyValue,P.scrollData);w.Hooks.registered[x]&&(s(m).rootPropertyValueCache[T]=w.Normalizations.registered[T]?w.Normalizations.registered[T]("extract",null,E[1]):E[1]),"transform"===E[0]&&(b=!0)}l.mobileHA&&s(m).transformCache.translate3d===a&&(s(m).transformCache.translate3d="(0px, 0px, 0px)",b=!0),b&&w.flushTransformCache(m)}}l.display&&"none"!==l.display&&(S.State.calls[r][2].display=!1),l.visibility&&"hidden"!==l.visibility&&(S.State.calls[r][2].visibility=!1),l.progress&&l.progress.call(n[1],n[1],f,Math.max(0,u+l.duration-t),u),1===f&&p(r)}S.State.isTicking&&h(c)}function p(e,t){if(!S.State.calls[e])return!1;for(var r=S.State.calls[e][0],o=S.State.calls[e][1],n=S.State.calls[e][2],i=S.State.calls[e][4],l=!1,u=0,c=r.length;c>u;u++){var p=r[u].element;if(t||n.loop||("none"===n.display&&w.setPropertyValue(p,"display",n.display),"hidden"===n.visibility&&w.setPropertyValue(p,"visibility",n.visibility)),($.queue(p)[1]===a||!/\.velocityQueueEntryFlag/i.test($.queue(p)[1]))&&s(p)){s(p).isAnimating=!1,s(p).rootPropertyValueCache={};var f=!1;$.each(w.Lists.transforms3D,function(e,t){var r=/^scale/.test(t)?1:0,o=s(p).transformCache[t];s(p).transformCache[t]!==a&&new RegExp("^\\("+r+"[^.]").test(o)&&(f=!0,delete s(p).transformCache[t])}),n.mobileHA&&(f=!0,delete s(p).transformCache.translate3d),f&&w.flushTransformCache(p),w.Values.removeClass(p,"velocity-animating")}if(!t&&n.complete&&!n.loop&&u===c-1)try{n.complete.call(o,o)}catch(d){setTimeout(function(){throw d},1)}i&&n.loop!==!0&&i(o),n.loop!==!0||t||S(p,"reverse",{loop:!0,delay:n.delay}),n.queue!==!1&&$.dequeue(p,n.queue)}S.State.calls[e]=!1;for(var g=0,y=S.State.calls.length;y>g;g++)if(S.State.calls[g]!==!1){l=!0;break}l===!1&&(S.State.isTicking=!1,delete S.State.calls,S.State.calls=[])}var f="velocity",d=400,g="swing",y=function(){if(o.documentMode)return o.documentMode;for(var e=7;e>4;e--){var t=o.createElement("div");if(t.innerHTML="",t.getElementsByTagName("span").length)return t=null,e}return a}(),m=function(){var e=0;return r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||function(t){var r=(new Date).getTime(),o;return o=Math.max(0,16-(r-e)),e=r+o,setTimeout(function(){t(r+o)},o)}}(),h=r.requestAnimationFrame||m,v={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&e.length!==a&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||r.Zepto&&r.Zepto.zepto.isZ(e))},isSVG:function(e){return r.SVGElement&&e instanceof SVGElement},isEmptyObject:function(e){var t;for(t in e)return!1;return!0}},$;if(e&&e.fn!==a?$=e:r.Velocity&&r.Velocity.Utilities&&($=r.Velocity.Utilities),!$)throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.");if(t.Velocity!==a&&t.Velocity.Utilities==a)throw new Error("Velocity: Namespace is occupied.");if(7>=y){if(e)return void(e.fn.velocity=e.fn.animate);throw new Error("Velocity: In IE<=7, Velocity falls back to jQuery, which must first be loaded.")}if(8===y&&!e)throw new Error("Velocity: In IE8, Velocity requires jQuery proper to be loaded; Velocity's jQuery shim does not work with IE8.");var S={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:r.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:o.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:$,Sequences:{},Easings:{},Promise:r.Promise,defaults:{queue:"",duration:d,easing:g,begin:null,complete:null,progress:null,display:null,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){$.data(e,f,{isSVG:v.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},animate:null,hook:function(e,t,r){var o=a;return v.isWrapped(e)&&(e=[].slice.call(e)),$.each(i(e),function(e,n){if(s(n)===a&&S.init(n),r===a)o===a&&(o=S.CSS.getPropertyValue(n,t));else{var i=S.CSS.setPropertyValue(n,t,r);"transform"===i[0]&&S.CSS.flushTransformCache(n),o=i}}),o},mock:!1,version:{major:0,minor:11,patch:7},debug:!1};r.pageYOffset!==a?(S.State.scrollAnchor=r,S.State.scrollPropertyLeft="pageXOffset",S.State.scrollPropertyTop="pageYOffset"):(S.State.scrollAnchor=o.documentElement||o.body.parentNode||o.body,S.State.scrollPropertyLeft="scrollLeft",S.State.scrollPropertyTop="scrollTop");var b=function(){function e(e,t){return 1-3*t+3*e}function t(e,t){return 3*t-6*e}function r(e){return 3*e}function o(o,a,n){return((e(a,n)*o+t(a,n))*o+r(a))*o}function a(o,a,n){return 3*e(a,n)*o*o+2*t(a,n)*o+r(a)}return function(e,t,r,n){function i(t){for(var n=t,i=0;8>i;++i){var s=a(n,e,r);if(0===s)return n;var l=o(n,e,r)-t;n-=l/s}return n}if(4!==arguments.length)return!1;for(var s=0;4>s;++s)if("number"!=typeof arguments[s]||isNaN(arguments[s])||!isFinite(arguments[s]))return!1;return e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0),function(a){return e===t&&r===n?a:o(i(a),t,n)}}}(),x=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,o){var a={x:t.x+o.dx*r,v:t.v+o.dv*r,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function r(r,o){var a={dx:r.v,dv:e(r)},n=t(r,.5*o,a),i=t(r,.5*o,n),s=t(r,o,i),l=1/6*(a.dx+2*(n.dx+i.dx)+s.dx),u=1/6*(a.dv+2*(n.dv+i.dv)+s.dv);return r.x=r.x+l*o,r.v=r.v+u*o,r}return function o(e,t,a){var n={x:-1,v:0,tension:null,friction:null},i=[0],s=0,l=1e-4,u=.016,c,p,f;for(e=parseFloat(e)||500,t=parseFloat(t)||20,a=a||null,n.tension=e,n.friction=t,c=null!==a,c?(s=o(e,t),p=s/a*u):p=u;;)if(f=r(f||n,p),i.push(1+f.x),s+=16,!(Math.abs(f.x)>l&&Math.abs(f.v)>l))break;return c?function(e){return i[e*(i.length-1)|0]}:s}}();!function(){S.Easings.linear=function(e){return e},S.Easings.swing=function(e){return.5-Math.cos(e*Math.PI)/2},S.Easings.spring=function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)},S.Easings.ease=b(.25,.1,.25,1),S.Easings["ease-in"]=b(.42,0,1,1),S.Easings["ease-out"]=b(0,0,.58,1),S.Easings["ease-in-out"]=b(.42,0,.58,1);var e={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,r){e[r]=function(e){return Math.pow(e,t+2)}}),$.extend(e,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,r=4;e<((t=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((3*t-2)/22-e,2)}}),$.each(e,function(e,t){S.Easings["easeIn"+e]=t,S.Easings["easeOut"+e]=function(e){return 1-t(1-e)},S.Easings["easeInOut"+e]=function(e){return.5>e?t(2*e)/2:1-t(-2*e+2)/2}})}();var w=S.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e=y)switch(e){case"name":return"filter";case"extract":var o=r.toString().match(/alpha\(opacity=(.*)\)/i);return r=o?o[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(r)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(r),10)+")"}else switch(e){case"name":return"opacity";case"extract":return r;case"inject":return r}}},register:function(){9>=y||S.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var e=0;eo&&(o=1),n=!/(\d)$/i.test(o);break;case"skew":n=!/(deg|\d)$/i.test(o);break;case"rotate":n=!/(deg|\d)$/i.test(o)}return n||(s(r).transformCache[t]="("+o+")"),s(r).transformCache[t]}}}();for(var e=0;e=y||3!==n.split(" ").length||(n+=" 1"),n;case"inject":return 8>=y?4===o.split(" ").length&&(o=o.split(/\s+/).slice(0,3).join(" ")):3===o.split(" ").length&&(o+=" 1"),(8>=y?"rgb":"rgba")+"("+o.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(y||S.State.isAndroid&&!S.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")$","i").test(e)},prefixCheck:function(e){if(S.State.prefixMatches[e])return[S.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],r=0,o=t.length;o>r;r++){var a;if(a=0===r?e:t[r]+e.replace(/^\w/,function(e){return e.toUpperCase()}),v.isString(S.State.prefixElement.style[a]))return S.State.prefixMatches[e]=a,[a,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,o;return e=e.replace(t,function(e,t,r,o){return t+t+r+r+o+o}),o=r.exec(e),o?[parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t)?"inline":/^(li)$/i.test(t)?"list-item":/^(tr)$/i.test(t)?"table-row":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,t,o,n){function i(e,t){function o(){u&&w.setPropertyValue(e,"display","none")}var l=0;if(8>=y)l=$.css(e,t);else{var u=!1;if(/^(width|height)$/.test(t)&&0===w.getPropertyValue(e,"display")&&(u=!0,w.setPropertyValue(e,"display",w.Values.getDisplayType(e))),!n){if("height"===t&&"border-box"!==w.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var c=e.offsetHeight-(parseFloat(w.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(e,"paddingBottom"))||0);return o(),c}if("width"===t&&"border-box"!==w.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetWidth-(parseFloat(w.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(e,"paddingRight"))||0);return o(),p}}var f;f=s(e)===a?r.getComputedStyle(e,null):s(e).computedStyle?s(e).computedStyle:s(e).computedStyle=r.getComputedStyle(e,null),(y||S.State.isFirefox)&&"borderColor"===t&&(t="borderTopColor"),l=9===y&&"filter"===t?f.getPropertyValue(t):f[t],(""===l||null===l)&&(l=e.style[t]),o()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(t)){var d=i(e,"position");("fixed"===d||"absolute"===d&&/top|left/i.test(t))&&(l=$(e).position()[t]+"px")}return l}var l;if(w.Hooks.registered[t]){var u=t,c=w.Hooks.getRoot(u);o===a&&(o=w.getPropertyValue(e,w.Names.prefixCheck(c)[0])),w.Normalizations.registered[c]&&(o=w.Normalizations.registered[c]("extract",e,o)),l=w.Hooks.extractValue(u,o)}else if(w.Normalizations.registered[t]){var p,f;p=w.Normalizations.registered[t]("name",e),"transform"!==p&&(f=i(e,w.Names.prefixCheck(p)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[t]&&(f=w.Hooks.templates[t][1])),l=w.Normalizations.registered[t]("extract",e,f)}return/^[\d-]/.test(l)||(l=s(e)&&s(e).isSVG&&w.Names.SVGAttribute(t)?/^(height|width)$/i.test(t)?e.getBBox()[t]:e.getAttribute(t):i(e,w.Names.prefixCheck(t)[0])),w.Values.isCSSNullValue(l)&&(l=0),S.debug>=2&&console.log("Get "+t+": "+l),l},setPropertyValue:function(e,t,o,a,n){var i=t;if("scroll"===t)n.container?n.container["scroll"+n.direction]=o:"Left"===n.direction?r.scrollTo(o,n.alternateValue):r.scrollTo(n.alternateValue,o);else if(w.Normalizations.registered[t]&&"transform"===w.Normalizations.registered[t]("name",e))w.Normalizations.registered[t]("inject",e,o),i="transform",o=s(e).transformCache[t];else{if(w.Hooks.registered[t]){var l=t,u=w.Hooks.getRoot(t);a=a||w.getPropertyValue(e,u),o=w.Hooks.injectValue(l,o,a),t=u}if(w.Normalizations.registered[t]&&(o=w.Normalizations.registered[t]("inject",e,o),t=w.Normalizations.registered[t]("name",e)),i=w.Names.prefixCheck(t)[0],8>=y)try{e.style[i]=o}catch(c){S.debug&&console.log("Browser does not support ["+o+"] for ["+i+"]")}else s(e)&&s(e).isSVG&&w.Names.SVGAttribute(t)?e.setAttribute(t,o):e.style[i]=o;S.debug>=2&&console.log("Set "+t+" ("+i+"): "+o)}return[i,o]},flushTransformCache:function(e){function t(t){return parseFloat(w.getPropertyValue(e,t))}var r="";if((y||S.State.isAndroid&&!S.State.isChrome)&&s(e).isSVG){var o={translate:[t("translateX"),t("translateY")],skewX:[t("skewX")],skewY:[t("skewY")],scale:1!==t("scale")?[t("scale"),t("scale")]:[t("scaleX"),t("scaleY")],rotate:[t("rotateZ"),0,0]};$.each(s(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),o[e]&&(r+=e+"("+o[e].join(" ")+") ",delete o[e])})}else{var a,n;$.each(s(e).transformCache,function(t){return a=s(e).transformCache[t],"transformPerspective"===t?(n=a,!0):(9===y&&"rotateZ"===t&&(t="rotate"),void(r+=t+a+" "))}),n&&(r="perspective"+n+" "+r)}w.setPropertyValue(e,"transform",r)}};w.Hooks.register(),w.Normalizations.register();var P=function(){function e(){return f?T.promise||null:g}function t(){function e(e){function f(e,r){var o=a,n=a,s=a;return v.isArray(e)?(o=e[0],!v.isArray(e[1])&&/^[\d-]/.test(e[1])||v.isFunction(e[1])||w.RegEx.isHex.test(e[1])?s=e[1]:(v.isString(e[1])&&!w.RegEx.isHex.test(e[1])||v.isArray(e[1]))&&(n=r?e[1]:u(e[1],i.duration),e[2]!==a&&(s=e[2]))):o=e,r||(n=n||i.easing),v.isFunction(o)&&(o=o.call(t,P,x)),v.isFunction(s)&&(s=s.call(t,P,x)),[o||0,n,s]}function d(e,t){var r,o;return o=(t||0).toString().toLowerCase().replace(/[%A-z]+$/,function(e){return r=e,""}),r||(r=w.Values.getUnitType(e)),[o,r]}function g(){var e={myParent:t.parentNode||o.body,position:w.getPropertyValue(t,"position"),fontSize:w.getPropertyValue(t,"fontSize")},a=e.position===N.lastPosition&&e.myParent===N.lastParent,n=e.fontSize===N.lastFontSize;N.lastParent=e.myParent,N.lastPosition=e.position,N.lastFontSize=e.fontSize;var i=100,l={};if(n&&a)l.emToPx=N.lastEmToPx,l.percentToPxWidth=N.lastPercentToPxWidth,l.percentToPxHeight=N.lastPercentToPxHeight;else{var u=s(t).isSVG?o.createElementNS("http://www.w3.org/2000/svg","rect"):o.createElement("div");S.init(u),e.myParent.appendChild(u),S.CSS.setPropertyValue(u,"position",e.position),S.CSS.setPropertyValue(u,"fontSize",e.fontSize),S.CSS.setPropertyValue(u,"overflow","hidden"),S.CSS.setPropertyValue(u,"overflowX","hidden"),S.CSS.setPropertyValue(u,"overflowY","hidden"),S.CSS.setPropertyValue(u,"boxSizing","content-box"),S.CSS.setPropertyValue(u,"paddingLeft",i+"em"),S.CSS.setPropertyValue(u,"minWidth",i+"%"),S.CSS.setPropertyValue(u,"maxWidth",i+"%"),S.CSS.setPropertyValue(u,"width",i+"%"),S.CSS.setPropertyValue(u,"minHeight",i+"%"),S.CSS.setPropertyValue(u,"maxHeight",i+"%"),S.CSS.setPropertyValue(u,"height",i+"%"),l.percentToPxWidth=N.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(u,"width",null,!0))||1)/i,l.percentToPxHeight=N.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(u,"height",null,!0))||1)/i,l.emToPx=N.lastEmToPx=(parseFloat(w.getPropertyValue(u,"paddingLeft"))||1)/i,e.myParent.removeChild(u)}return null===N.remToPx&&(N.remToPx=parseFloat(w.getPropertyValue(o.body,"fontSize"))||16),null===N.vwToPx&&(N.vwToPx=parseFloat(r.innerWidth)/100,N.vhToPx=parseFloat(r.innerHeight)/100),l.remToPx=N.remToPx,l.vwToPx=N.vwToPx,l.vhToPx=N.vhToPx,S.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),t),l}if(i.begin&&0===P)try{i.begin.call(m,m)}catch(y){setTimeout(function(){throw y},1)}if("scroll"===k){var V=/^x$/i.test(i.axis)?"Left":"Top",C=parseFloat(i.offset)||0,E,F,A;i.container?v.isWrapped(i.container)||v.isNode(i.container)?(i.container=i.container[0]||i.container,E=i.container["scroll"+V],A=E+$(t).position()[V.toLowerCase()]+C):i.container=null:(E=S.State.scrollAnchor[S.State["scrollProperty"+V]],F=S.State.scrollAnchor[S.State["scrollProperty"+("Left"===V?"Top":"Left")]],A=$(t).offset()[V.toLowerCase()]+C),l={scroll:{rootPropertyValue:!1,startValue:E,currentValue:E,endValue:A,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:V,alternateValue:F}},element:t},S.debug&&console.log("tweensContainer (scroll): ",l.scroll,t)}else if("reverse"===k){if(!s(t).tweensContainer)return void $.dequeue(t,i.queue);"none"===s(t).opts.display&&(s(t).opts.display="block"),"hidden"===s(t).opts.visibility&&(s(t).opts.visibility="visible"),s(t).opts.loop=!1,s(t).opts.begin=null,s(t).opts.complete=null,b.easing||delete i.easing,b.duration||delete i.duration,i=$.extend({},s(t).opts,i);var j=$.extend(!0,{},s(t).tweensContainer);for(var L in j)if("element"!==L){var q=j[L].startValue;j[L].startValue=j[L].currentValue=j[L].endValue,j[L].endValue=q,v.isEmptyObject(b)||(j[L].easing=i.easing),S.debug&&console.log("reverse tweensContainer ("+L+"): "+JSON.stringify(j[L]),t)}l=j}else if("start"===k){var j;s(t).tweensContainer&&s(t).isAnimating===!0&&(j=s(t).tweensContainer),$.each(h,function(e,t){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var r=f(t,!0),o=r[0],n=r[1],i=r[2];if(w.RegEx.isHex.test(o)){for(var s=["Red","Green","Blue"],l=w.Values.hexToRgb(o),u=i?w.Values.hexToRgb(i):a,c=0;c1e4&&(S.State.calls=n(S.State.calls)),S.State.calls.push([H,m,i,null,T.resolver]),S.State.isTicking===!1&&(S.State.isTicking=!0,c())):P++)}var t=this,i=$.extend({},S.defaults,b),l={},p;if(s(t)===a&&S.init(t),parseFloat(i.delay)&&i.queue!==!1&&$.queue(t,i.queue,function(e){S.velocityQueueEntryFlag=!0,s(t).delayTimer={setTimeout:setTimeout(e,parseFloat(i.delay)),next:e}}),S.mock===!0)i.duration=1;else switch(i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=d;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}i.easing=u(i.easing,i.duration),i.begin&&!v.isFunction(i.begin)&&(i.begin=null),i.progress&&!v.isFunction(i.progress)&&(i.progress=null),i.complete&&!v.isFunction(i.complete)&&(i.complete=null),i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=S.CSS.Values.getDisplayType(t))),i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&S.State.isMobile&&!S.State.isGingerbread,i.queue===!1?i.delay?setTimeout(e,i.delay):e():$.queue(t,i.queue,function(t,r){return r===!0?(T.promise&&T.resolver(m),!0):(S.velocityQueueEntryFlag=!0,void e(t))}),""!==i.queue&&"fx"!==i.queue||"inprogress"===$.queue(t)[0]||$.dequeue(t)}var l=arguments[0]&&($.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||v.isString(arguments[0].properties)),f,g,y,m,h,b;if(v.isWrapped(this)?(f=!1,y=0,m=this,g=this):(f=!0,y=1,m=l?arguments[0].elements:arguments[0]),m=v.isWrapped(m)?[].slice.call(m):m){l?(h=arguments[0].properties,b=arguments[0].options):(h=arguments[y],b=arguments[y+1]);var x=v.isArray(m)||v.isNodeList(m)?m.length:1,P=0;if("stop"!==h&&!$.isPlainObject(b)){var V=y+1;b={};for(var C=V;Cz;z++){var R={delay:L.delay};z===q-1&&(R.display=L.display,R.visibility=L.visibility,R.complete=L.complete),S(m,"reverse",R) -}return e()}};S=$.extend(P,S),S.animate=P,S.State.isMobile||o.hidden===a||o.addEventListener("visibilitychange",function(){o.hidden?(h=function(e){return setTimeout(function(){e(!0)},16)},c()):h=r.requestAnimationFrame||m});var V;return e&&e.fn!==a?V=e:r.Zepto&&(V=r.Zepto),(V||r).Velocity=S,V&&(V.fn.velocity=P,V.fn.velocity.defaults=S.defaults),$.each(["Down","Up"],function(e,t){S.Sequences["slide"+t]=function(e,r,o,a,n,i){var s=$.extend({},r),l={height:null,marginTop:null,marginBottom:null,paddingTop:null,paddingBottom:null,overflow:null,overflowX:null,overflowY:null},u=s.begin,c=s.complete,p=!1;null!==s.display&&(s.display="Down"===t?s.display||"auto":s.display||"none"),s.begin=function(){function r(){l.height=parseFloat(S.CSS.getPropertyValue(e,"height")),e.style.height="auto",parseFloat(S.CSS.getPropertyValue(e,"height"))===l.height&&(p=!0),S.CSS.setPropertyValue(e,"height",l.height+"px")}if("Down"===t){l.overflow=[S.CSS.getPropertyValue(e,"overflow"),0],l.overflowX=[S.CSS.getPropertyValue(e,"overflowX"),0],l.overflowY=[S.CSS.getPropertyValue(e,"overflowY"),0],e.style.overflow="hidden",e.style.overflowX="visible",e.style.overflowY="hidden",r();for(var o in l)if(!/^overflow/.test(o)){var a=S.CSS.getPropertyValue(e,o);"height"===o&&(a=parseFloat(a)),l[o]=[a,0]}}else{r();for(var o in l){var a=S.CSS.getPropertyValue(e,o);"height"===o&&(a=parseFloat(a)),l[o]=[0,a]}e.style.overflow="hidden",e.style.overflowX="visible",e.style.overflowY="hidden"}u&&u.call(e,e)},s.complete=function(e){var r="Down"===t?0:1;p===!0?l.height[r]="auto":l.height[r]+="px";for(var o in l)e.style[o]=l[o][r];c&&c.call(e,e),i&&i.resolver(n||e)},S(e,l,s)}}),$.each(["In","Out"],function(e,t){S.Sequences["fade"+t]=function(e,r,o,a,n,i){var s=$.extend({},r),l={opacity:"In"===t?1:0};if(o!==a-1)s.complete=s.begin=null;else{var u=s.complete;s.complete=function(){u&&u.call(e,e),i&&i.resolver(n||e)}}null!==s.display&&(s.display=s.display||("In"===t?"auto":"none")),S(this,l,s)}}),S}(e||window,window,document)}); \ No newline at end of file +!function(e){function t(e){var t=e.length,r=$.type(e);return"function"===r||$.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e}if(!e.jQuery){if(void 0!==e.Velocity)throw new Error("Velocity is already loaded. The shim must be loaded BEFORE jquery.velocity.js.");var $=function(e,t){return new $.fn.init(e,t)};$.isWindow=function(e){return null!=e&&e==e.window},$.type=function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?a[n.call(e)]||"object":typeof e},$.isArray=Array.isArray||function(e){return"array"===$.type(e)},$.isPlainObject=function(e){var t;if(!e||"object"!==$.type(e)||e.nodeType||$.isWindow(e))return!1;try{if(e.constructor&&!o.call(e,"constructor")&&!o.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(t in e);return void 0===t||o.call(e,t)},$.each=function(e,r,a){var o,n=0,i=e.length,s=t(e);if(a){if(s)for(;i>n&&(o=r.apply(e[n],a),o!==!1);n++);else for(n in e)if(o=r.apply(e[n],a),o===!1)break}else if(s)for(;i>n&&(o=r.call(e[n],n,e[n]),o!==!1);n++);else for(n in e)if(o=r.call(e[n],n,e[n]),o===!1)break;return e},$.data=function(e,t,a){if(void 0===a){var o=e[$.expando],n=o&&r[o];if(void 0===t)return n;if(n&&t in n)return n[t]}else if(void 0!==t){var o=e[$.expando]||(e[$.expando]=++$.uuid);return r[o]=r[o]||{},r[o][t]=a,a}},$.removeData=function(e,t){var a=e[$.expando],o=a&&r[a];o&&$.each(t,function(e,t){delete o[t]})},$.extend=function(){var e,t,r,a,o,n,i=arguments[0]||{},s=1,l=arguments.length,u=!1;for("boolean"==typeof i&&(u=i,i=arguments[s]||{},s++),"object"!=typeof i&&"function"!==$.type(i)&&(i={}),s===l&&(i=this,s--);l>s;s++)if(null!=(o=arguments[s]))for(a in o)e=i[a],r=o[a],i!==r&&(u&&r&&($.isPlainObject(r)||(t=$.isArray(r)))?(t?(t=!1,n=e&&$.isArray(e)?e:[]):n=e&&$.isPlainObject(e)?e:{},i[a]=$.extend(u,n,r)):void 0!==r&&(i[a]=r));return i},$.queue=function(e,r,a){function o(e,r){var a=r||[];return null!=e&&(t(Object(e))?!function(e,t){for(var r=+t.length,a=0,o=e.length;r>a;)e[o++]=t[a++];if(r!==r)for(;void 0!==t[a];)e[o++]=t[a++];return e.length=o,e}(a,"string"==typeof e?[e]:e):[].push.call(a,e)),a}if(e){r=(r||"fx")+"queue";var n=$.data(e,r);return a?(!n||$.isArray(a)?n=$.data(e,r,o(a)):n.push(a),n):n||[]}},$.dequeue=function(e,t){$.each(e.nodeType?[e]:e,function(e,r){t=t||"fx";var a=$.queue(r,t),o=a.shift();"inprogress"===o&&(o=a.shift()),o&&("fx"===t&&a.unshift("inprogress"),o.call(r,function(){$.dequeue(r,t)}))})},$.fn=$.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw new Error("Not a DOM node.")},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+(e.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:t.left+(e.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function e(){for(var e=this.offsetParent||document;e&&"html"===!e.nodeType.toLowerCase&&"static"===e.style.position;)e=e.offsetParent;return e||document}var t=this[0],e=e.apply(t),r=this.offset(),a=/^(?:body|html)$/i.test(e.nodeName)?{top:0,left:0}:$(e).offset();return r.top-=parseFloat(t.style.marginTop)||0,r.left-=parseFloat(t.style.marginLeft)||0,e.style&&(a.top+=parseFloat(e.style.borderTopWidth)||0,a.left+=parseFloat(e.style.borderLeftWidth)||0),{top:r.top-a.top,left:r.left-a.left}}};var r={};$.expando="velocity"+(new Date).getTime(),$.uuid=0;for(var a={},o=a.hasOwnProperty,n=a.toString,i="Boolean Number String Function Array Date RegExp Object Error".split(" "),s=0;so;++o){var n=u(r,e,a);if(0===n)return r;var i=l(r,e,a)-t;r-=i/n}return r}function p(){for(var t=0;b>t;++t)w[t]=l(t*x,e,a)}function f(t,r,o){var n,i,s=0;do i=r+(o-r)/2,n=l(i,e,a)-t,n>0?o=i:r=i;while(Math.abs(n)>h&&++s=m?c(t,s):0==l?s:f(t,r,r+x)}function g(){V=!0,(e!=t||a!=o)&&p()}var y=4,m=.001,h=1e-7,v=10,b=11,x=1/(b-1),S="Float32Array"in r;if(4!==arguments.length)return!1;for(var P=0;4>P;++P)if("number"!=typeof arguments[P]||isNaN(arguments[P])||!isFinite(arguments[P]))return!1;e=Math.min(e,1),a=Math.min(a,1),e=Math.max(e,0),a=Math.max(a,0);var w=S?new Float32Array(b):new Array(b),V=!1,C=function(r){return V||g(),e===t&&a===o?r:0===r?0:1===r?1:l(d(r),t,o)};C.getControlPoints=function(){return[{x:e,y:t},{x:a,y:o}]};var T="generateBezier("+[e,t,a,o]+")";return C.toString=function(){return T},C}function c(e,t){var r=e;return m.isString(e)?b.Easings[e]||(r=!1):r=m.isArray(e)&&1===e.length?l.apply(null,e):m.isArray(e)&&2===e.length?x.apply(null,e.concat([t])):m.isArray(e)&&4===e.length?u.apply(null,e):!1,r===!1&&(r=b.Easings[b.defaults.easing]?b.defaults.easing:v),r}function p(e){if(e)for(var t=(new Date).getTime(),r=0,a=b.State.calls.length;a>r;r++)if(b.State.calls[r]){var n=b.State.calls[r],i=n[0],l=n[2],u=n[3];u||(u=b.State.calls[r][3]=t-16);for(var c=Math.min((t-u)/l.duration,1),g=0,h=i.length;h>g;g++){var v=i[g],x=v.element;if(s(x)){var P=!1;l.display!==o&&null!==l.display&&"none"!==l.display&&("flex"===l.display&&S.setPropertyValue(x,"display",(d?"-ms-":"-webkit-")+l.display),S.setPropertyValue(x,"display",l.display)),l.visibility&&"hidden"!==l.visibility&&S.setPropertyValue(x,"visibility",l.visibility);for(var w in v)if("element"!==w){var V=v[w],C,T=m.isString(V.easing)?b.Easings[V.easing]:V.easing;if(C=1===c?V.endValue:V.startValue+(V.endValue-V.startValue)*T(c),V.currentValue=C,S.Hooks.registered[w]){var k=S.Hooks.getRoot(w),A=s(x).rootPropertyValueCache[k];A&&(V.rootPropertyValue=A)}var E=S.setPropertyValue(x,w,V.currentValue+(0===parseFloat(C)?"":V.unitType),V.rootPropertyValue,V.scrollData);S.Hooks.registered[w]&&(s(x).rootPropertyValueCache[k]=S.Normalizations.registered[k]?S.Normalizations.registered[k]("extract",null,E[1]):E[1]),"transform"===E[0]&&(P=!0)}l.mobileHA&&s(x).transformCache.translate3d===o&&(s(x).transformCache.translate3d="(0px, 0px, 0px)",P=!0),P&&S.flushTransformCache(x)}}l.display!==o&&"none"!==l.display&&(b.State.calls[r][2].display=!1),l.visibility&&"hidden"!==l.visibility&&(b.State.calls[r][2].visibility=!1),l.progress&&l.progress.call(n[1],n[1],c,Math.max(0,u+l.duration-t),u),1===c&&f(r)}b.State.isTicking&&y(p)}function f(e,t){if(!b.State.calls[e])return!1;for(var r=b.State.calls[e][0],a=b.State.calls[e][1],n=b.State.calls[e][2],i=b.State.calls[e][4],l=!1,u=0,c=r.length;c>u;u++){var p=r[u].element;if(t||n.loop||("none"===n.display&&S.setPropertyValue(p,"display",n.display),"hidden"===n.visibility&&S.setPropertyValue(p,"visibility",n.visibility)),($.queue(p)[1]===o||!/\.velocityQueueEntryFlag/i.test($.queue(p)[1]))&&s(p)){s(p).isAnimating=!1,s(p).rootPropertyValueCache={};var f=!1;$.each(S.Lists.transforms3D,function(e,t){var r=/^scale/.test(t)?1:0,a=s(p).transformCache[t];s(p).transformCache[t]!==o&&new RegExp("^\\("+r+"[^.]").test(a)&&(f=!0,delete s(p).transformCache[t])}),n.mobileHA&&(f=!0,delete s(p).transformCache.translate3d),f&&S.flushTransformCache(p),S.Values.removeClass(p,"velocity-animating")}if(!t&&n.complete&&!n.loop&&u===c-1)try{n.complete.call(a,a)}catch(d){setTimeout(function(){throw d},1)}i&&n.loop!==!0&&i(a),n.loop!==!0||t||b(p,"reverse",{loop:!0,delay:n.delay}),n.queue!==!1&&$.dequeue(p,n.queue)}b.State.calls[e]=!1;for(var g=0,y=b.State.calls.length;y>g;g++)if(b.State.calls[g]!==!1){l=!0;break}l===!1&&(b.State.isTicking=!1,delete b.State.calls,b.State.calls=[])}var d=function(){if(a.documentMode)return a.documentMode;for(var e=7;e>4;e--){var t=a.createElement("div");if(t.innerHTML="",t.getElementsByTagName("span").length)return t=null,e}return o}(),g=function(){var e=0;return r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||function(t){var r=(new Date).getTime(),a;return a=Math.max(0,16-(r-e)),e=r+a,setTimeout(function(){t(r+a)},a)}}(),y=r.requestAnimationFrame||g,m={isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isNodeList:function(e){return"object"==typeof e&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&e.length!==o&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)},isWrapped:function(e){return e&&(e.jquery||r.Zepto&&r.Zepto.zepto.isZ(e))},isSVG:function(e){return r.SVGElement&&e instanceof SVGElement},isEmptyObject:function(e){var t;for(t in e)return!1;return!0}},$;if(e&&e.fn!==o?$=e:r.Velocity&&r.Velocity.Utilities&&($=r.Velocity.Utilities),!$)throw new Error("Velocity: Either jQuery or Velocity's jQuery shim must first be loaded.");if(t.Velocity!==o&&t.Velocity.Utilities==o)throw new Error("Velocity: Namespace is occupied.");if(7>=d){if(e)return void(e.fn.velocity=e.fn.animate);throw new Error("Velocity: In IE<=7, Velocity falls back to jQuery, which must first be loaded.")}if(8===d&&!e)throw new Error("Velocity: In IE8, Velocity requires jQuery proper to be loaded; Velocity's jQuery shim does not work with IE8.");var h=400,v="swing",b={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:r.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:a.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:$,Sequences:{},Easings:{},Promise:r.Promise,defaults:{queue:"",duration:h,easing:v,begin:null,complete:null,progress:null,display:o,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(e){$.data(e,"velocity",{isSVG:m.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},animate:null,hook:null,mock:!1,version:{major:0,minor:11,patch:8},debug:!1};r.pageYOffset!==o?(b.State.scrollAnchor=r,b.State.scrollPropertyLeft="pageXOffset",b.State.scrollPropertyTop="pageYOffset"):(b.State.scrollAnchor=a.documentElement||a.body.parentNode||a.body,b.State.scrollPropertyLeft="scrollLeft",b.State.scrollPropertyTop="scrollTop");var x=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,a){var o={x:t.x+a.dx*r,v:t.v+a.dv*r,tension:t.tension,friction:t.friction};return{dx:o.v,dv:e(o)}}function r(r,a){var o={dx:r.v,dv:e(r)},n=t(r,.5*a,o),i=t(r,.5*a,n),s=t(r,a,i),l=1/6*(o.dx+2*(n.dx+i.dx)+s.dx),u=1/6*(o.dv+2*(n.dv+i.dv)+s.dv);return r.x=r.x+l*a,r.v=r.v+u*a,r}return function a(e,t,o){var n={x:-1,v:0,tension:null,friction:null},i=[0],s=0,l=1e-4,u=.016,c,p,f;for(e=parseFloat(e)||500,t=parseFloat(t)||20,o=o||null,n.tension=e,n.friction=t,c=null!==o,c?(s=a(e,t),p=s/o*u):p=u;;)if(f=r(f||n,p),i.push(1+f.x),s+=16,!(Math.abs(f.x)>l&&Math.abs(f.v)>l))break;return c?function(e){return i[e*(i.length-1)|0]}:s}}();b.Easings={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}},$.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(e,t){b.Easings[t[0]]=u.apply(null,t[1])});var S=b.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e=d)switch(e){case"name":return"filter";case"extract":var a=r.toString().match(/alpha\(opacity=(.*)\)/i);return r=a?a[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(r)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(r),10)+")"}else switch(e){case"name":return"opacity";case"extract":return r;case"inject":return r}}},register:function(){9>=d||b.State.isGingerbread||(S.Lists.transformsBase=S.Lists.transformsBase.concat(S.Lists.transforms3D));for(var e=0;ea&&(a=1),n=!/(\d)$/i.test(a);break;case"skew":n=!/(deg|\d)$/i.test(a);break;case"rotate":n=!/(deg|\d)$/i.test(a)}return n||(s(r).transformCache[t]="("+a+")"),s(r).transformCache[t]}}}();for(var e=0;e=d||3!==n.split(" ").length||(n+=" 1"),n;case"inject":return 8>=d?4===a.split(" ").length&&(a=a.split(/\s+/).slice(0,3).join(" ")):3===a.split(" ").length&&(a+=" 1"),(8>=d?"rgb":"rgba")+"("+a.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(d||b.State.isAndroid&&!b.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")$","i").test(e)},prefixCheck:function(e){if(b.State.prefixMatches[e])return[b.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],r=0,a=t.length;a>r;r++){var o;if(o=0===r?e:t[r]+e.replace(/^\w/,function(e){return e.toUpperCase()}),m.isString(b.State.prefixElement.style[o]))return b.State.prefixMatches[e]=o,[o,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,a;return e=e.replace(t,function(e,t,r,a){return t+t+r+r+a+a}),a=r.exec(e),a?[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]:[0,0,0]},isCSSNullValue:function(e){return 0==e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t)?"inline":/^(li)$/i.test(t)?"list-item":/^(tr)$/i.test(t)?"table-row":"block"},addClass:function(e,t){e.classList?e.classList.add(t):e.className+=(e.className.length?" ":"")+t},removeClass:function(e,t){e.classList?e.classList.remove(t):e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(e,t,a,n){function i(e,t){function a(){u&&S.setPropertyValue(e,"display","none")}var l=0;if(8>=d)l=$.css(e,t);else{var u=!1;if(/^(width|height)$/.test(t)&&0===S.getPropertyValue(e,"display")&&(u=!0,S.setPropertyValue(e,"display",S.Values.getDisplayType(e))),!n){if("height"===t&&"border-box"!==S.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var c=e.offsetHeight-(parseFloat(S.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(S.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(S.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(S.getPropertyValue(e,"paddingBottom"))||0);return a(),c}if("width"===t&&"border-box"!==S.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var p=e.offsetWidth-(parseFloat(S.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(S.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(S.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(S.getPropertyValue(e,"paddingRight"))||0);return a(),p}}var f;f=s(e)===o?r.getComputedStyle(e,null):s(e).computedStyle?s(e).computedStyle:s(e).computedStyle=r.getComputedStyle(e,null),(d||b.State.isFirefox)&&"borderColor"===t&&(t="borderTopColor"),l=9===d&&"filter"===t?f.getPropertyValue(t):f[t],(""===l||null===l)&&(l=e.style[t]),a()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(t)){var g=i(e,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(t))&&(l=$(e).position()[t]+"px")}return l}var l;if(S.Hooks.registered[t]){var u=t,c=S.Hooks.getRoot(u);a===o&&(a=S.getPropertyValue(e,S.Names.prefixCheck(c)[0])),S.Normalizations.registered[c]&&(a=S.Normalizations.registered[c]("extract",e,a)),l=S.Hooks.extractValue(u,a)}else if(S.Normalizations.registered[t]){var p,f;p=S.Normalizations.registered[t]("name",e),"transform"!==p&&(f=i(e,S.Names.prefixCheck(p)[0]),S.Values.isCSSNullValue(f)&&S.Hooks.templates[t]&&(f=S.Hooks.templates[t][1])),l=S.Normalizations.registered[t]("extract",e,f)}return/^[\d-]/.test(l)||(l=s(e)&&s(e).isSVG&&S.Names.SVGAttribute(t)?/^(height|width)$/i.test(t)?e.getBBox()[t]:e.getAttribute(t):i(e,S.Names.prefixCheck(t)[0])),S.Values.isCSSNullValue(l)&&(l=0),b.debug>=2&&console.log("Get "+t+": "+l),l},setPropertyValue:function(e,t,a,o,n){var i=t;if("scroll"===t)n.container?n.container["scroll"+n.direction]=a:"Left"===n.direction?r.scrollTo(a,n.alternateValue):r.scrollTo(n.alternateValue,a);else if(S.Normalizations.registered[t]&&"transform"===S.Normalizations.registered[t]("name",e))S.Normalizations.registered[t]("inject",e,a),i="transform",a=s(e).transformCache[t];else{if(S.Hooks.registered[t]){var l=t,u=S.Hooks.getRoot(t);o=o||S.getPropertyValue(e,u),a=S.Hooks.injectValue(l,a,o),t=u}if(S.Normalizations.registered[t]&&(a=S.Normalizations.registered[t]("inject",e,a),t=S.Normalizations.registered[t]("name",e)),i=S.Names.prefixCheck(t)[0],8>=d)try{e.style[i]=a}catch(c){b.debug&&console.log("Browser does not support ["+a+"] for ["+i+"]")}else s(e)&&s(e).isSVG&&S.Names.SVGAttribute(t)?e.setAttribute(t,a):e.style[i]=a;b.debug>=2&&console.log("Set "+t+" ("+i+"): "+a)}return[i,a]},flushTransformCache:function(e){function t(t){return parseFloat(S.getPropertyValue(e,t))}var r="";if((d||b.State.isAndroid&&!b.State.isChrome)&&s(e).isSVG){var a={translate:[t("translateX"),t("translateY")],skewX:[t("skewX")],skewY:[t("skewY")],scale:1!==t("scale")?[t("scale"),t("scale")]:[t("scaleX"),t("scaleY")],rotate:[t("rotateZ"),0,0]};$.each(s(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),a[e]&&(r+=e+"("+a[e].join(" ")+") ",delete a[e])})}else{var o,n;$.each(s(e).transformCache,function(t){return o=s(e).transformCache[t],"transformPerspective"===t?(n=o,!0):(9===d&&"rotateZ"===t&&(t="rotate"),void(r+=t+o+" "))}),n&&(r="perspective"+n+" "+r)}S.setPropertyValue(e,"transform",r)}};S.Hooks.register(),S.Normalizations.register(),b.hook=function(e,t,r){var a=o;return m.isWrapped(e)&&(e=[].slice.call(e)),$.each(i(e),function(e,n){if(s(n)===o&&b.init(n),r===o)a===o&&(a=b.CSS.getPropertyValue(n,t));else{var i=b.CSS.setPropertyValue(n,t,r);"transform"===i[0]&&b.CSS.flushTransformCache(n),a=i}}),a};var P=function(){function e(){return u?T.promise||null:d}function t(){function e(e){function f(e,r){var a=o,n=o,s=o;return m.isArray(e)?(a=e[0],!m.isArray(e[1])&&/^[\d-]/.test(e[1])||m.isFunction(e[1])||S.RegEx.isHex.test(e[1])?s=e[1]:(m.isString(e[1])&&!S.RegEx.isHex.test(e[1])||m.isArray(e[1]))&&(n=r?e[1]:c(e[1],i.duration),e[2]!==o&&(s=e[2]))):a=e,r||(n=n||i.easing),m.isFunction(a)&&(a=a.call(t,w,P)),m.isFunction(s)&&(s=s.call(t,w,P)),[a||0,n,s]}function d(e,t){var r,a;return a=(t||0).toString().toLowerCase().replace(/[%A-z]+$/,function(e){return r=e,""}),r||(r=S.Values.getUnitType(e)),[a,r]}function g(){var e={myParent:t.parentNode||a.body,position:S.getPropertyValue(t,"position"),fontSize:S.getPropertyValue(t,"fontSize")},o=e.position===N.lastPosition&&e.myParent===N.lastParent,n=e.fontSize===N.lastFontSize;N.lastParent=e.myParent,N.lastPosition=e.position,N.lastFontSize=e.fontSize;var i=100,l={};if(n&&o)l.emToPx=N.lastEmToPx,l.percentToPxWidth=N.lastPercentToPxWidth,l.percentToPxHeight=N.lastPercentToPxHeight;else{var u=s(t).isSVG?a.createElementNS("http://www.w3.org/2000/svg","rect"):a.createElement("div");b.init(u),e.myParent.appendChild(u),b.CSS.setPropertyValue(u,"position",e.position),b.CSS.setPropertyValue(u,"fontSize",e.fontSize),b.CSS.setPropertyValue(u,"overflow","hidden"),b.CSS.setPropertyValue(u,"overflowX","hidden"),b.CSS.setPropertyValue(u,"overflowY","hidden"),b.CSS.setPropertyValue(u,"boxSizing","content-box"),b.CSS.setPropertyValue(u,"paddingLeft",i+"em"),$.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(e,t){b.CSS.setPropertyValue(u,t,i+"%")}),l.percentToPxWidth=N.lastPercentToPxWidth=(parseFloat(S.getPropertyValue(u,"width",null,!0))||1)/i,l.percentToPxHeight=N.lastPercentToPxHeight=(parseFloat(S.getPropertyValue(u,"height",null,!0))||1)/i,l.emToPx=N.lastEmToPx=(parseFloat(S.getPropertyValue(u,"paddingLeft"))||1)/i,e.myParent.removeChild(u)}return null===N.remToPx&&(N.remToPx=parseFloat(S.getPropertyValue(a.body,"fontSize"))||16),null===N.vwToPx&&(N.vwToPx=parseFloat(r.innerWidth)/100,N.vhToPx=parseFloat(r.innerHeight)/100),l.remToPx=N.remToPx,l.vwToPx=N.vwToPx,l.vhToPx=N.vhToPx,b.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),t),l}if(i.begin&&0===w)try{i.begin.call(y,y)}catch(h){setTimeout(function(){throw h},1)}if("scroll"===k){var V=/^x$/i.test(i.axis)?"Left":"Top",C=parseFloat(i.offset)||0,A,E,F;i.container?m.isWrapped(i.container)||m.isNode(i.container)?(i.container=i.container[0]||i.container,A=i.container["scroll"+V],F=A+$(t).position()[V.toLowerCase()]+C):i.container=null:(A=b.State.scrollAnchor[b.State["scrollProperty"+V]],E=b.State.scrollAnchor[b.State["scrollProperty"+("Left"===V?"Top":"Left")]],F=$(t).offset()[V.toLowerCase()]+C),l={scroll:{rootPropertyValue:!1,startValue:A,currentValue:A,endValue:F,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:V,alternateValue:E}},element:t},b.debug&&console.log("tweensContainer (scroll): ",l.scroll,t)}else if("reverse"===k){if(!s(t).tweensContainer)return void $.dequeue(t,i.queue);"none"===s(t).opts.display&&(s(t).opts.display="auto"),"hidden"===s(t).opts.visibility&&(s(t).opts.visibility="visible"),s(t).opts.loop=!1,s(t).opts.begin=null,s(t).opts.complete=null,x.easing||delete i.easing,x.duration||delete i.duration,i=$.extend({},s(t).opts,i);var j=$.extend(!0,{},s(t).tweensContainer);for(var L in j)if("element"!==L){var O=j[L].startValue;j[L].startValue=j[L].currentValue=j[L].endValue,j[L].endValue=O,m.isEmptyObject(x)||(j[L].easing=i.easing),b.debug&&console.log("reverse tweensContainer ("+L+"): "+JSON.stringify(j[L]),t)}l=j}else if("start"===k){var j;s(t).tweensContainer&&s(t).isAnimating===!0&&(j=s(t).tweensContainer),$.each(v,function(e,t){if(RegExp("^"+S.Lists.colors.join("$|^")+"$").test(e)){var r=f(t,!0),a=r[0],n=r[1],i=r[2];if(S.RegEx.isHex.test(a)){for(var s=["Red","Green","Blue"],l=S.Values.hexToRgb(a),u=i?S.Values.hexToRgb(i):o,c=0;c1e4&&(b.State.calls=n(b.State.calls)),b.State.calls.push([H,y,i,null,T.resolver]),b.State.isTicking===!1&&(b.State.isTicking=!0,p())):w++)}var t=this,i=$.extend({},b.defaults,x),l={},u;if(s(t)===o&&b.init(t),parseFloat(i.delay)&&i.queue!==!1&&$.queue(t,i.queue,function(e){b.velocityQueueEntryFlag=!0,s(t).delayTimer={setTimeout:setTimeout(e,parseFloat(i.delay)),next:e}}),b.mock===!0)i.duration=1;else switch(i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=h;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}i.easing=c(i.easing,i.duration),i.begin&&!m.isFunction(i.begin)&&(i.begin=null),i.progress&&!m.isFunction(i.progress)&&(i.progress=null),i.complete&&!m.isFunction(i.complete)&&(i.complete=null),i.display!==o&&null!==i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=b.CSS.Values.getDisplayType(t))),i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&b.State.isMobile&&!b.State.isGingerbread,i.queue===!1?i.delay?setTimeout(e,i.delay):e():$.queue(t,i.queue,function(t,r){return r===!0?(T.promise&&T.resolver(y),!0):(b.velocityQueueEntryFlag=!0,void e(t))}),""!==i.queue&&"fx"!==i.queue||"inprogress"===$.queue(t)[0]||$.dequeue(t)}var l=arguments[0]&&($.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||m.isString(arguments[0].properties)),u,d,g,y,v,x;if(m.isWrapped(this)?(u=!1,g=0,y=this,d=this):(u=!0,g=1,y=l?arguments[0].elements:arguments[0]),y=m.isWrapped(y)?[].slice.call(y):y){l?(v=arguments[0].properties,x=arguments[0].options):(v=arguments[g],x=arguments[g+1]);var P=m.isArray(y)||m.isNodeList(y)?y.length:1,w=0;if("stop"!==v&&!$.isPlainObject(x)){var V=g+1;x={};for(var C=V;Cq;q++){var z={delay:L.delay};q===O-1&&(z.display=L.display,z.visibility=L.visibility,z.complete=L.complete),b(y,"reverse",z)}return e()}};b=$.extend(P,b),b.animate=P,b.State.isMobile||a.hidden===o||a.addEventListener("visibilitychange",function(){a.hidden?(y=function(e){return setTimeout(function(){e(!0)},16)},p()):y=r.requestAnimationFrame||g});var w;return e&&e.fn!==o?w=e:r.Zepto&&(w=r.Zepto),(w||r).Velocity=b,w&&(w.fn.velocity=P,w.fn.velocity.defaults=b.defaults),$.each(["Down","Up"],function(e,t){b.Sequences["slide"+t]=function(e,r,a,n,i,s){var l=$.extend({},r),u=l.begin,c=l.complete,p={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},f={};l.display===o&&(l.display="Down"===t?"inline"===b.CSS.Values.getDisplayType(e)?"inline-block":"block":"none"),l.begin=function(e){u&&u.call(e,e);for(var r in p){f[r]=e.style[r];var a=b.CSS.getPropertyValue(e,r);p[r]="Down"===t?[a,0]:[0,a]}},l.complete=function(e){for(var t in f)e.style[t]=f[t];c&&c.call(e,e),s&&s.resolver(i||e)},b(e,p,l)}}),$.each(["In","Out"],function(e,t){b.Sequences["fade"+t]=function(e,r,a,n,i,s){var l=$.extend({},r),u={opacity:"In"===t?1:0};if(a!==n-1)l.complete=l.begin=null;else{var c=l.complete;l.complete=function(){c&&c.call(e,e),s&&s.resolver(i||e)}}l.display===o&&(l.display="In"===t?"auto":"none"),b(this,u,l)}}),b}(e||window,window,document)}); \ No newline at end of file