(function ($){ var getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, rupper = /([A-Z])/g, rdashAlpha = /-([a-z])/ig, fcamelCase = function (all, letter){ return letter.toUpperCase(); } , getStyle = function (elem){ if (getComputedStyle) { return getComputedStyle(elem, null ); } else if (elem.currentStyle) { return elem.currentStyle; } } , rfloat = /float/i, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/; $.styles = function (el, styles){ if (!el) { return null ; } var currentS = getStyle(el), oldName, val, style = el.style, results = { } , i = 0, left, rsLeft, camelCase, name; for (; i < _AN_Read_length('length', styles); i++ ){ name = styles[i]; oldName = _AN_Call_replace('replace', name, rdashAlpha, fcamelCase); if (rfloat.test(name)) { name = jQuery.support.cssFloat? "float": "styleFloat"; oldName = "cssFloat"; } if (getComputedStyle) { name = _AN_Call_replace("replace", name, rupper, "-$1").toLowerCase(); val = currentS.getPropertyValue(name); if (name === "opacity" && val === "") { val = "1"; } results[oldName] = val; } else { camelCase = _AN_Call_replace("replace", name, rdashAlpha, fcamelCase); results[oldName] = currentS[name] || currentS[camelCase]; if (!rnumpx.test(results[oldName]) && rnum.test(results[oldName])) { left = style.left; rsLeft = el.runtimeStyle.left; el.runtimeStyle.left = el.currentStyle.left; style.left = camelCase === "fontSize"? "1em": (results[oldName] || 0); results[oldName] = style.pixelLeft + "px"; style.left = left; el.runtimeStyle.left = rsLeft; } } } return results; } ; $.fn.styles = function (){ return $.styles(this[0], $.makeArray(arguments)); } ; } )(jQuery); (function ($){ var animationNum = 0, getLastStyleSheet = function (){ var sheets = document.styleSheets, x = _AN_Read_length("length", sheets) - 1, foundSheet = null , style; while (x >= 0 && !foundSheet){ if (sheets[x].cssRules || sheets[x].rules) { foundSheet = sheets[x]; } x -= 1; } if (!foundSheet) { style = _AN_Call_createelement("createElement", document, 'style'); _AN_Call_appendchild('appendChild', _AN_Call_getelementsbytagname('getElementsByTagName', document, 'head')[0], style); if (!window.createPopup) { _AN_Call_appendchild('appendChild', style, document.createTextNode('')); } foundSheet = sheets[_AN_Read_length('length', sheets) - 1]; } return foundSheet; } , removeAnimation = function (sheet, name){ for (var j = _AN_Read_length('length', sheet.cssRules) - 1; j >= 0; j-- ){ var rule = sheet.cssRules[j]; if (rule.type === 7 && rule.name == name) { sheet.deleteRule(j); return ; } } } , passThrough = function (props, ops){ var nonElement = !(this[0] && this[0].nodeType), isInline = !nonElement && $(this).css("display") === "inline" && $(this).css("float") === "none"; for (var name in props){ if (props[name] == 'show' || props[name] == 'hide' || jQuery.isArray(props[name]) || props[name] < 0 || name == 'zIndex' || name == 'z-index') { return true ; } } return props.jquery === true || browser === null || jQuery.isEmptyObject(props) || jQuery.isPlainObject(ops) || typeof ops == 'string' || isInline || nonElement; } , cssNumber = function (origName, value){ if (typeof value === "number" && !jQuery.cssNumber[origName]) { return value += "px"; } return value; } , getBrowserProperties = function (){ var t, el = _AN_Call_createelement("createElement", document, 'fakeelement'), transitions = { 'transition': { transitionEnd: 'transitionEnd', prefix: ''} , 'MozTransition': { transitionEnd: 'animationend', prefix: '-moz-'} , 'WebkitTransition': { transitionEnd: 'webkitAnimationEnd', prefix: '-webkit-'} } ; for (t in transitions){ if (el.style[t] !== undefined) { return transitions[t]; } } return null ; } , ffProps = { top: function (el){ return el.position().top; } , left: function (el){ return el.position().left; } , width: function (el){ return el.width(); } , height: function (el){ return el.height(); } , fontSize: function (el){ return '1em'; } } , browser = getBrowserProperties(), addPrefix = function (properties){ var result = { } ; jQuery.each(properties, function (name, value){ result[browser.prefix + name] = value; } ); return result; } , cache = [] , getAnimation = function (style){ var lastSheet, name, last; $.each(cache, function (i, animation){ if (style === animation.style) { name = animation.name; animation.age = 0; } else { animation.age += 1; } } ); if (!name) { lastSheet = getLastStyleSheet(); name = "animate" + (animationNum++ ); lastSheet.insertRule("@" + browser.prefix + "keyframes " + name + ' ' + style, _AN_Read_length('length', lastSheet.cssRules)); cache.push({ name: name, style: style, age: 0} ); cache.sort(function (first, second){ return first.age - second.age; } ); if (_AN_Read_length('length', cache) > 20) { last = cache.pop(); removeAnimation(lastSheet, last.name); } } return name; } , oldanimate = jQuery.fn.animate; jQuery.fn.animate = function (props, speed, callback){ if (passThrough.apply(this, arguments)) { return oldanimate.apply(this, arguments); } if (jQuery.isFunction(speed)) { callback = speed; } this.queue('fx', function (done){ var current, properties = [] , to = "", prop, self = $(this), duration = jQuery.fx.speeds[speed] || speed || jQuery.fx.speeds._default, animationName, dataKey = animationName + '.run', style = "{ from {", animationEnd = function (currentCSS, exec){ self.css(currentCSS); self.css(addPrefix({ "animation-duration": "", "animation-name": "", "animation-fill-mode": ""} )); if (callback && exec) { callback.call(self[0], true ); } jQuery.removeData(self, dataKey, true ); } ; for (prop in props){ properties.push(prop); } if (browser.prefix === '-moz-') { $.each(properties, function (i, prop){ var converter = ffProps[jQuery.camelCase(prop)]; if (converter && self.css(prop) == 'auto') { self.css(prop, converter(self)); } } ); } current = self.styles.apply(self, properties); jQuery.each(properties, function (i, cur){ var name = _AN_Call_replace('replace', cur, /([A-Z]|^ms)/g, "-$1").toLowerCase(); style += name + " : " + cssNumber(cur, current[cur]) + "; "; to += name + " : " + cssNumber(cur, props[cur]) + "; "; } ); style += "} to {" + to + " }}"; animationName = getAnimation(style); jQuery._data(this, dataKey, { stop: function (gotoEnd){ self.css(addPrefix({ 'animation-play-state': 'paused'} )); self.off(browser.transitionEnd, animationEnd); if (!gotoEnd) { animationEnd(self.styles.apply(self, properties), false ); } else { animationEnd(props, true ); } } } ); self.css(addPrefix({ "animation-duration": duration + "ms", "animation-name": animationName, "animation-fill-mode": "forwards"} )); self.one(browser.transitionEnd, function (){ animationEnd(props, true ); done(); } ); } ); return this; } ; } )(jQuery); (function (){ var event = jQuery.event, findHelper = function (events, types, callback, selector){ var t, type, typeHandlers, all, h, handle, namespaces, namespace, match; for (t = 0; t < _AN_Read_length("length", types); t++ ){ type = types[t]; all = type.indexOf(".") < 0; if (!all) { namespaces = type.split("."); type = namespaces.shift(); namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); } typeHandlers = (events[type] || [] ).slice(0); for (h = 0; h < _AN_Read_length("length", typeHandlers); h++ ){ handle = typeHandlers[h]; match = (all || namespace.test(handle.namespace)); if (match) { if (selector) { if (handle.selector === selector) { callback(type, handle.origHandler || handle.handler); } } else if (selector === null ) { callback(type, handle.origHandler || handle.handler, handle.selector); } else if (!handle.selector) { callback(type, handle.origHandler || handle.handler); } } } } } ; event.find = function (el, types, selector){ var events = ($._data(el) || { } ).events, handlers = [] , t, liver, live; if (!events) { return handlers; } findHelper(events, types, function (type, handler){ handlers.push(handler); } , selector); return handlers; } ; event.findBySelector = function (el, types){ var events = $._data(el).events, selectors = { } , add = function (selector, event, handler){ var select = selectors[selector] || (selectors[selector] = { } ), events = select[event] || (select[event] = [] ); events.push(handler); } ; if (!events) { return selectors; } findHelper(events, types, function (type, handler, selector){ add(selector || "", type, handler); } , null ); return selectors; } ; event.supportTouch = "ontouchend" in document; $.fn.respondsTo = function (events){ if (!_AN_Read_length("length", this)) { return false ; } else { return _AN_Read_length("length", event.find(this[0], $.isArray(events)? events: [events] )) > 0; } } ; $.fn.triggerHandled = function (event, data){ event = (typeof event == "string"? $.Event(event): event); this.trigger(event, data); return event.handled; } ; event.setupHelper = function (types, startingEvent, onFirst){ if (!onFirst) { onFirst = startingEvent; startingEvent = null ; } var add = function (handleObj){ var bySelector, selector = handleObj.selector || ""; if (selector) { bySelector = event.find(this, types, selector); if (!_AN_Read_length("length", bySelector)) { $(this).delegate(selector, startingEvent, onFirst); } } else { if (!_AN_Read_length("length", event.find(this, types, selector))) { event.add(this, startingEvent, onFirst, { selector: selector, delegate: this} ); } } } , remove = function (handleObj){ var bySelector, selector = handleObj.selector || ""; if (selector) { bySelector = event.find(this, types, selector); if (!_AN_Read_length("length", bySelector)) { $(this).undelegate(selector, startingEvent, onFirst); } } else { if (!_AN_Read_length("length", event.find(this, types, selector))) { event.remove(this, startingEvent, onFirst, { selector: selector, delegate: this} ); } } } ; $.each(types, function (){ event.special[this] = { add: add, remove: remove, setup: function (){ } , teardown: function (){ } } ; } ); } ; } )(jQuery); (function ($){ var isPhantom = /Phantom/.test(navigator.userAgent), supportTouch = !isPhantom && "ontouchend" in document, scrollEvent = "touchmove scroll", touchStartEvent = supportTouch? "touchstart": "mousedown", touchStopEvent = supportTouch? "touchend": "mouseup", touchMoveEvent = supportTouch? "touchmove": "mousemove", data = function (event){ var d = event.originalEvent.touches? event.originalEvent.touches[0]: event; return { time: (new Date()).getTime(), coords: [d.pageX, d.pageY] , origin: $(_AN_Read_target("target", event))} ; } ; var swipe = $.event.swipe = { delay: 500, max: 75, min: 30} ; $.event.setupHelper(["swipe", 'swipeleft', 'swiperight', 'swipeup', 'swipedown'] , touchStartEvent, function (ev){ var start = data(ev), stop, delegate = ev.delegateTarget || ev.currentTarget, selector = ev.handleObj.selector, entered = this; function moveHandler(event){ if (!start) { return ; } stop = data(event); if (Math.abs(start.coords[0] - stop.coords[0]) > 10) { event.preventDefault(); } } ; $(document.documentElement).bind(touchMoveEvent, moveHandler).one(touchStopEvent, function (event){ $(this).unbind(touchMoveEvent, moveHandler); if (start && stop) { var deltaX = Math.abs(start.coords[0] - stop.coords[0]), deltaY = Math.abs(start.coords[1] - stop.coords[1]), distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); if (stop.time - start.time < swipe.delay && distance >= swipe.min) { var events = ['swipe'] ; if (deltaX >= swipe.min && deltaY < swipe.min) { events.push(start.coords[0] > stop.coords[0]? "swipeleft": "swiperight"); } else if (deltaY >= swipe.min && deltaX < swipe.min) { events.push(start.coords[1] < stop.coords[1]? "swipedown": "swipeup"); } $.each($.event.find(delegate, events, selector), function (){ this.call(entered, ev, { start: start, end: stop} ); } ); } } start = stop = undefined; } ); } ); } )(jQuery);