/*! * @fileOverview TouchSwipe - jQuery Plugin * @version 1.6.17 * * @author Matt Bryson http://www.github.com/mattbryson * @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin * @see http://labs.rampinteractive.co.uk/touchSwipe/ * @see http://plugins.jquery.com/project/touchSwipe * @license * Copyright (c) 2010-2015 Matt Bryson * Dual licensed under the MIT or GPL Version 2 licenses. * */ ! function(factory) { "function" == typeof define && define.amd && define.amd.jQuery ? define(["jquery"], factory) : factory("undefined" != typeof module && module.exports ? require("jquery") : jQuery) }(function($) { "use strict"; function init(options) { return !options || void 0 !== options.allowPageScroll || void 0 === options.swipe && void 0 === options.swipeStatus || (options.allowPageScroll = NONE), void 0 !== options.click && void 0 === options.tap && (options.tap = options.click), options || (options = {}), options = $.extend({}, $.fn.swipe.defaults, options), this.each(function() { var $this = $(this), plugin = $this.data(PLUGIN_NS); plugin || (plugin = new TouchSwipe(this, options), $this.data(PLUGIN_NS, plugin)) }) } function TouchSwipe(element, options) { function touchStart(jqEvent) { if (!(getTouchInProgress() || $(jqEvent.target).closest(options.excludedElements, $element).length > 0)) { var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; if (!event.pointerType || "mouse" != event.pointerType || 0 != options.fallbackToMouseEvents) { var ret, touches = event.touches, evt = touches ? touches[0] : event; return phase = PHASE_START, touches ? fingerCount = touches.length : options.preventDefaultEvents !== !1 && jqEvent.preventDefault(), distance = 0, direction = null, currentDirection = null, pinchDirection = null, duration = 0, startTouchesDistance = 0, endTouchesDistance = 0, pinchZoom = 1, pinchDistance = 0, maximumsMap = createMaximumsData(), cancelMultiFingerRelease(), createFingerData(0, evt), !touches || fingerCount === options.fingers || options.fingers === ALL_FINGERS || hasPinches() ? (startTime = getTimeStamp(), 2 == fingerCount && (createFingerData(1, touches[1]), startTouchesDistance = endTouchesDistance = calculateTouchesDistance(fingerData[0].start, fingerData[1].start)), (options.swipeStatus || options.pinchStatus) && (ret = triggerHandler(event, phase))) : ret = !1, ret === !1 ? (phase = PHASE_CANCEL, triggerHandler(event, phase), ret) : (options.hold && (holdTimeout = setTimeout($.proxy(function() { $element.trigger("hold", [event.target]), options.hold && (ret = options.hold.call($element, event, event.target)) }, this), options.longTapThreshold)), setTouchInProgress(!0), null) } } } function touchMove(jqEvent) { var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; if (phase !== PHASE_END && phase !== PHASE_CANCEL && !inMultiFingerRelease()) { var ret, touches = event.touches, evt = touches ? touches[0] : event, currentFinger = updateFingerData(evt); if (endTime = getTimeStamp(), touches && (fingerCount = touches.length), options.hold && clearTimeout(holdTimeout), phase = PHASE_MOVE, 2 == fingerCount && (0 == startTouchesDistance ? (createFingerData(1, touches[1]), startTouchesDistance = endTouchesDistance = calculateTouchesDistance(fingerData[0].start, fingerData[1].start)) : (updateFingerData(touches[1]), endTouchesDistance = calculateTouchesDistance(fingerData[0].end, fingerData[1].end), pinchDirection = calculatePinchDirection(fingerData[0].end, fingerData[1].end)), pinchZoom = calculatePinchZoom(startTouchesDistance, endTouchesDistance), pinchDistance = Math.abs(startTouchesDistance - endTouchesDistance)), fingerCount === options.fingers || options.fingers === ALL_FINGERS || !touches || hasPinches()) { if (direction = calculateDirection(currentFinger.start, currentFinger.end), currentDirection = calculateDirection(currentFinger.last, currentFinger.end), validateDefaultEvent(jqEvent, currentDirection), distance = calculateDistance(currentFinger.start, currentFinger.end), duration = calculateDuration(), setMaxDistance(direction, distance), ret = triggerHandler(event, phase), !options.triggerOnTouchEnd || options.triggerOnTouchLeave) { var inBounds = !0; if (options.triggerOnTouchLeave) { var bounds = getbounds(this); inBounds = isInBounds(currentFinger.end, bounds) }!options.triggerOnTouchEnd && inBounds ? phase = getNextPhase(PHASE_MOVE) : options.triggerOnTouchLeave && !inBounds && (phase = getNextPhase(PHASE_END)), phase != PHASE_CANCEL && phase != PHASE_END || triggerHandler(event, phase) } } else phase = PHASE_CANCEL, triggerHandler(event, phase); ret === !1 && (phase = PHASE_CANCEL, triggerHandler(event, phase)) } } function touchEnd(jqEvent) { var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent, touches = event.touches; if (touches) { if (touches.length && !inMultiFingerRelease()) return startMultiFingerRelease(event), !0; if (touches.length && inMultiFingerRelease()) return !0 } return inMultiFingerRelease() && (fingerCount = fingerCountAtRelease), endTime = getTimeStamp(), duration = calculateDuration(), didSwipeBackToCancel() || !validateSwipeDistance() ? (phase = PHASE_CANCEL, triggerHandler(event, phase)) : options.triggerOnTouchEnd || options.triggerOnTouchEnd === !1 && phase === PHASE_MOVE ? (options.preventDefaultEvents !== !1 && jqEvent.preventDefault(), phase = PHASE_END, triggerHandler(event, phase)) : !options.triggerOnTouchEnd && hasTap() ? (phase = PHASE_END, triggerHandlerForGesture(event, phase, TAP)) : phase === PHASE_MOVE && (phase = PHASE_CANCEL, triggerHandler(event, phase)), setTouchInProgress(!1), null } function touchCancel() { fingerCount = 0, endTime = 0, startTime = 0, startTouchesDistance = 0, endTouchesDistance = 0, pinchZoom = 1, cancelMultiFingerRelease(), setTouchInProgress(!1) } function touchLeave(jqEvent) { var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent; options.triggerOnTouchLeave && (phase = getNextPhase(PHASE_END), triggerHandler(event, phase)) } function removeListeners() { $element.unbind(START_EV, touchStart), $element.unbind(CANCEL_EV, touchCancel), $element.unbind(MOVE_EV, touchMove), $element.unbind(END_EV, touchEnd), LEAVE_EV && $element.unbind(LEAVE_EV, touchLeave), setTouchInProgress(!1) } function getNextPhase(currentPhase) { var nextPhase = currentPhase, validTime = validateSwipeTime(), validDistance = validateSwipeDistance(), didCancel = didSwipeBackToCancel(); return !validTime || didCancel ? nextPhase = PHASE_CANCEL : !validDistance || currentPhase != PHASE_MOVE || options.triggerOnTouchEnd && !options.triggerOnTouchLeave ? !validDistance && currentPhase == PHASE_END && options.triggerOnTouchLeave && (nextPhase = PHASE_CANCEL) : nextPhase = PHASE_END, nextPhase } function triggerHandler(event, phase) { var ret, touches = event.touches; return (didSwipe() || hasSwipes()) && (ret = triggerHandlerForGesture(event, phase, SWIPE)), (didPinch() || hasPinches()) && ret !== !1 && (ret = triggerHandlerForGesture(event, phase, PINCH)), didDoubleTap() && ret !== !1 ? ret = triggerHandlerForGesture(event, phase, DOUBLE_TAP) : didLongTap() && ret !== !1 ? ret = triggerHandlerForGesture(event, phase, LONG_TAP) : didTap() && ret !== !1 && (ret = triggerHandlerForGesture(event, phase, TAP)), phase === PHASE_CANCEL && touchCancel(event), phase === PHASE_END && (touches ? touches.length || touchCancel(event) : touchCancel(event)), ret } function triggerHandlerForGesture(event, phase, gesture) { var ret; if (gesture == SWIPE) { if ($element.trigger("swipeStatus", [phase, direction || null, distance || 0, duration || 0, fingerCount, fingerData, currentDirection]), options.swipeStatus && (ret = options.swipeStatus.call($element, event, phase, direction || null, distance || 0, duration || 0, fingerCount, fingerData, currentDirection), ret === !1)) return !1; if (phase == PHASE_END && validateSwipe()) { if (clearTimeout(singleTapTimeout), clearTimeout(holdTimeout), $element.trigger("swipe", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipe && (ret = options.swipe.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection), ret === !1)) return !1; switch (direction) { case LEFT: $element.trigger("swipeLeft", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeLeft && (ret = options.swipeLeft.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); break; case RIGHT: $element.trigger("swipeRight", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeRight && (ret = options.swipeRight.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); break; case UP: $element.trigger("swipeUp", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeUp && (ret = options.swipeUp.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)); break; case DOWN: $element.trigger("swipeDown", [direction, distance, duration, fingerCount, fingerData, currentDirection]), options.swipeDown && (ret = options.swipeDown.call($element, event, direction, distance, duration, fingerCount, fingerData, currentDirection)) } } } if (gesture == PINCH) { if ($element.trigger("pinchStatus", [phase, pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData]), options.pinchStatus && (ret = options.pinchStatus.call($element, event, phase, pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData), ret === !1)) return !1; if (phase == PHASE_END && validatePinch()) switch (pinchDirection) { case IN: $element.trigger("pinchIn", [pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData]), options.pinchIn && (ret = options.pinchIn.call($element, event, pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData)); break; case OUT: $element.trigger("pinchOut", [pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData]), options.pinchOut && (ret = options.pinchOut.call($element, event, pinchDirection || null, pinchDistance || 0, duration || 0, fingerCount, pinchZoom, fingerData)) } } return gesture == TAP ? phase !== PHASE_CANCEL && phase !== PHASE_END || (clearTimeout(singleTapTimeout), clearTimeout(holdTimeout), hasDoubleTap() && !inDoubleTap() ? (doubleTapStartTime = getTimeStamp(), singleTapTimeout = setTimeout($.proxy(function() { doubleTapStartTime = null, $element.trigger("tap", [event.target]), options.tap && (ret = options.tap.call($element, event, event.target)) }, this), options.doubleTapThreshold)) : (doubleTapStartTime = null, $element.trigger("tap", [event.target]), options.tap && (ret = options.tap.call($element, event, event.target)))) : gesture == DOUBLE_TAP ? phase !== PHASE_CANCEL && phase !== PHASE_END || (clearTimeout(singleTapTimeout), clearTimeout(holdTimeout), doubleTapStartTime = null, $element.trigger("doubletap", [event.target]), options.doubleTap && (ret = options.doubleTap.call($element, event, event.target))) : gesture == LONG_TAP && (phase !== PHASE_CANCEL && phase !== PHASE_END || (clearTimeout(singleTapTimeout), doubleTapStartTime = null, $element.trigger("longtap", [event.target]), options.longTap && (ret = options.longTap.call($element, event, event.target)))), ret } function validateSwipeDistance() { var valid = !0; return null !== options.threshold && (valid = distance >= options.threshold), valid } function didSwipeBackToCancel() { var cancelled = !1; return null !== options.cancelThreshold && null !== direction && (cancelled = getMaxDistance(direction) - distance >= options.cancelThreshold), cancelled } function validatePinchDistance() { return null !== options.pinchThreshold ? pinchDistance >= options.pinchThreshold : !0 } function validateSwipeTime() { var result; return result = options.maxTimeThreshold ? !(duration >= options.maxTimeThreshold) : !0 } function validateDefaultEvent(jqEvent, direction) { if (options.preventDefaultEvents !== !1) if (options.allowPageScroll === NONE) jqEvent.preventDefault(); else { var auto = options.allowPageScroll === AUTO; switch (direction) { case LEFT: (options.swipeLeft && auto || !auto && options.allowPageScroll != HORIZONTAL) && jqEvent.preventDefault(); break; case RIGHT: (options.swipeRight && auto || !auto && options.allowPageScroll != HORIZONTAL) && jqEvent.preventDefault(); break; case UP: (options.swipeUp && auto || !auto && options.allowPageScroll != VERTICAL) && jqEvent.preventDefault(); break; case DOWN: (options.swipeDown && auto || !auto && options.allowPageScroll != VERTICAL) && jqEvent.preventDefault(); break; case NONE: } } } function validatePinch() { var hasCorrectFingerCount = validateFingers(), hasEndPoint = validateEndPoint(), hasCorrectDistance = validatePinchDistance(); return hasCorrectFingerCount && hasEndPoint && hasCorrectDistance } function hasPinches() { return !!(options.pinchStatus || options.pinchIn || options.pinchOut) } function didPinch() { return !(!validatePinch() || !hasPinches()) } function validateSwipe() { var hasValidTime = validateSwipeTime(), hasValidDistance = validateSwipeDistance(), hasCorrectFingerCount = validateFingers(), hasEndPoint = validateEndPoint(), didCancel = didSwipeBackToCancel(), valid = !didCancel && hasEndPoint && hasCorrectFingerCount && hasValidDistance && hasValidTime; return valid } function hasSwipes() { return !!(options.swipe || options.swipeStatus || options.swipeLeft || options.swipeRight || options.swipeUp || options.swipeDown) } function didSwipe() { return !(!validateSwipe() || !hasSwipes()) } function validateFingers() { return fingerCount === options.fingers || options.fingers === ALL_FINGERS || !SUPPORTS_TOUCH } function validateEndPoint() { return 0 !== fingerData[0].end.x } function hasTap() { return !!options.tap } function hasDoubleTap() { return !!options.doubleTap } function hasLongTap() { return !!options.longTap } function validateDoubleTap() { if (null == doubleTapStartTime) return !1; var now = getTimeStamp(); return hasDoubleTap() && now - doubleTapStartTime <= options.doubleTapThreshold } function inDoubleTap() { return validateDoubleTap() } function validateTap() { return (1 === fingerCount || !SUPPORTS_TOUCH) && (isNaN(distance) || distance < options.threshold) } function validateLongTap() { return duration > options.longTapThreshold && DOUBLE_TAP_THRESHOLD > distance } function didTap() { return !(!validateTap() || !hasTap()) } function didDoubleTap() { return !(!validateDoubleTap() || !hasDoubleTap()) } function didLongTap() { return !(!validateLongTap() || !hasLongTap()) } function startMultiFingerRelease(event) { previousTouchEndTime = getTimeStamp(), fingerCountAtRelease = event.touches.length + 1 } function cancelMultiFingerRelease() { previousTouchEndTime = 0, fingerCountAtRelease = 0 } function inMultiFingerRelease() { var withinThreshold = !1; if (previousTouchEndTime) { var diff = getTimeStamp() - previousTouchEndTime; diff <= options.fingerReleaseThreshold && (withinThreshold = !0) } return withinThreshold } function getTouchInProgress() { return !($element.data(PLUGIN_NS + "_intouch") !== !0) } function setTouchInProgress(val) { $element && (val === !0 ? ($element.bind(MOVE_EV, touchMove), $element.bind(END_EV, touchEnd), LEAVE_EV && $element.bind(LEAVE_EV, touchLeave)) : ($element.unbind(MOVE_EV, touchMove, !1), $element.unbind(END_EV, touchEnd, !1), LEAVE_EV && $element.unbind(LEAVE_EV, touchLeave, !1)), $element.data(PLUGIN_NS + "_intouch", val === !0)) } function createFingerData(id, evt) { var f = { start: { x: 0, y: 0 }, last: { x: 0, y: 0 }, end: { x: 0, y: 0 } }; return f.start.x = f.last.x = f.end.x = evt.pageX || evt.clientX, f.start.y = f.last.y = f.end.y = evt.pageY || evt.clientY, fingerData[id] = f, f } function updateFingerData(evt) { var id = void 0 !== evt.identifier ? evt.identifier : 0, f = getFingerData(id); return null === f && (f = createFingerData(id, evt)), f.last.x = f.end.x, f.last.y = f.end.y, f.end.x = evt.pageX || evt.clientX, f.end.y = evt.pageY || evt.clientY, f } function getFingerData(id) { return fingerData[id] || null } function setMaxDistance(direction, distance) { direction != NONE && (distance = Math.max(distance, getMaxDistance(direction)), maximumsMap[direction].distance = distance) } function getMaxDistance(direction) { return maximumsMap[direction] ? maximumsMap[direction].distance : void 0 } function createMaximumsData() { var maxData = {}; return maxData[LEFT] = createMaximumVO(LEFT), maxData[RIGHT] = createMaximumVO(RIGHT), maxData[UP] = createMaximumVO(UP), maxData[DOWN] = createMaximumVO(DOWN), maxData } function createMaximumVO(dir) { return { direction: dir, distance: 0 } } function calculateDuration() { return endTime - startTime } function calculateTouchesDistance(startPoint, endPoint) { var diffX = Math.abs(startPoint.x - endPoint.x), diffY = Math.abs(startPoint.y - endPoint.y); return Math.round(Math.sqrt(diffX * diffX + diffY * diffY)) } function calculatePinchZoom(startDistance, endDistance) { var percent = endDistance / startDistance * 1; return percent.toFixed(2) } function calculatePinchDirection() { return 1 > pinchZoom ? OUT : IN } function calculateDistance(startPoint, endPoint) { return Math.round(Math.sqrt(Math.pow(endPoint.x - startPoint.x, 2) + Math.pow(endPoint.y - startPoint.y, 2))) } function calculateAngle(startPoint, endPoint) { var x = startPoint.x - endPoint.x, y = endPoint.y - startPoint.y, r = Math.atan2(y, x), angle = Math.round(180 * r / Math.PI); return 0 > angle && (angle = 360 - Math.abs(angle)), angle } function calculateDirection(startPoint, endPoint) { if (comparePoints(startPoint, endPoint)) return NONE; var angle = calculateAngle(startPoint, endPoint); return 45 >= angle && angle >= 0 ? LEFT : 360 >= angle && angle >= 315 ? LEFT : angle >= 135 && 225 >= angle ? RIGHT : angle > 45 && 135 > angle ? DOWN : UP } function getTimeStamp() { var now = new Date; return now.getTime() } function getbounds(el) { el = $(el); var offset = el.offset(), bounds = { left: offset.left, right: offset.left + el.outerWidth(), top: offset.top, bottom: offset.top + el.outerHeight() }; return bounds } function isInBounds(point, bounds) { return point.x > bounds.left && point.x < bounds.right && point.y > bounds.top && point.y < bounds.bottom } function comparePoints(pointA, pointB) { return pointA.x == pointB.x && pointA.y == pointB.y } var options = $.extend({}, options), useTouchEvents = SUPPORTS_TOUCH || SUPPORTS_POINTER || !options.fallbackToMouseEvents, START_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerDown" : "pointerdown" : "touchstart" : "mousedown", MOVE_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerMove" : "pointermove" : "touchmove" : "mousemove", END_EV = useTouchEvents ? SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerUp" : "pointerup" : "touchend" : "mouseup", LEAVE_EV = useTouchEvents ? SUPPORTS_POINTER ? "mouseleave" : null : "mouseleave", CANCEL_EV = SUPPORTS_POINTER ? SUPPORTS_POINTER_IE10 ? "MSPointerCancel" : "pointercancel" : "touchcancel", distance = 0, direction = null, currentDirection = null, duration = 0, startTouchesDistance = 0, endTouchesDistance = 0, pinchZoom = 1, pinchDistance = 0, pinchDirection = 0, maximumsMap = null, $element = $(element), phase = "start", fingerCount = 0, fingerData = {}, startTime = 0, endTime = 0, previousTouchEndTime = 0, fingerCountAtRelease = 0, doubleTapStartTime = 0, singleTapTimeout = null, holdTimeout = null; try { $element.bind(START_EV, touchStart), $element.bind(CANCEL_EV, touchCancel) } catch (e) { $.error("events not supported " + START_EV + "," + CANCEL_EV + " on jQuery.swipe") } this.enable = function() { return this.disable(), $element.bind(START_EV, touchStart), $element.bind(CANCEL_EV, touchCancel), $element }, this.disable = function() { return removeListeners(), $element }, this.destroy = function() { removeListeners(), $element.data(PLUGIN_NS, null), $element = null }, this.option = function(property, value) { if ("object" == typeof property) options = $.extend(options, property); else if (void 0 !== options[property]) { if (void 0 === value) return options[property]; options[property] = value } else { if (!property) return options; $.error("Option " + property + " does not exist on jQuery.swipe.options") } return null } } var VERSION = "1.6.17", LEFT = "left", RIGHT = "right", UP = "up", DOWN = "down", IN = "in", OUT = "out", NONE = "none", AUTO = "auto", SWIPE = "swipe", PINCH = "pinch", TAP = "tap", DOUBLE_TAP = "doubletap", LONG_TAP = "longtap", HORIZONTAL = "horizontal", VERTICAL = "vertical", ALL_FINGERS = "all", DOUBLE_TAP_THRESHOLD = 10, PHASE_START = "start", PHASE_MOVE = "move", PHASE_END = "end", PHASE_CANCEL = "cancel", SUPPORTS_TOUCH = "ontouchstart" in window, SUPPORTS_POINTER_IE10 = window.navigator.msPointerEnabled && !window.navigator.pointerEnabled && !SUPPORTS_TOUCH, SUPPORTS_POINTER = (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) && !SUPPORTS_TOUCH, PLUGIN_NS = "TouchSwipe", defaults = { fingers: 1, threshold: 75, cancelThreshold: null, pinchThreshold: 20, maxTimeThreshold: null, fingerReleaseThreshold: 250, longTapThreshold: 500, doubleTapThreshold: 200, swipe: null, swipeLeft: null, swipeRight: null, swipeUp: null, swipeDown: null, swipeStatus: null, pinchIn: null, pinchOut: null, pinchStatus: null, click: null, tap: null, doubleTap: null, longTap: null, hold: null, triggerOnTouchEnd: !0, triggerOnTouchLeave: !1, allowPageScroll: "auto", fallbackToMouseEvents: !0, excludedElements: ".noSwipe", preventDefaultEvents: !0 }; $.fn.swipe = function(method) { var $this = $(this), plugin = $this.data(PLUGIN_NS); if (plugin && "string" == typeof method) { if (plugin[method]) return plugin[method].apply(plugin, Array.prototype.slice.call(arguments, 1)); $.error("Method " + method + " does not exist on jQuery.swipe") } else if (plugin && "object" == typeof method) plugin.option.apply(plugin, arguments); else if (!(plugin || "object" != typeof method && method)) return init.apply(this, arguments); return $this }, $.fn.swipe.version = VERSION, $.fn.swipe.defaults = defaults, $.fn.swipe.phases = { PHASE_START: PHASE_START, PHASE_MOVE: PHASE_MOVE, PHASE_END: PHASE_END, PHASE_CANCEL: PHASE_CANCEL }, $.fn.swipe.directions = { LEFT: LEFT, RIGHT: RIGHT, UP: UP, DOWN: DOWN, IN: IN, OUT: OUT }, $.fn.swipe.pageScroll = { NONE: NONE, HORIZONTAL: HORIZONTAL, VERTICAL: VERTICAL, AUTO: AUTO }, $.fn.swipe.fingers = { ONE: 1, TWO: 2, THREE: 3, FOUR: 4, FIVE: 5, ALL: ALL_FINGERS } });; /*! * jScrollPane - v2.0.23 - 2016-01-28 * http://jscrollpane.kelvinluck.com/ * * Copyright (c) 2014 Kelvin Luck * Dual licensed under the MIT or GPL licenses. */ ! function(a) { "function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof exports ? module.exports = a(require("jquery")) : a(jQuery) }(function(a) { a.fn.jScrollPane = function(b) { function c(b, c) { function d(c) { var f, h, j, k, l, o, p = !1, q = !1; if (N = c, void 0 === O) l = b.scrollTop(), o = b.scrollLeft(), b.css({ overflow: "hidden", padding: 0 }), P = b.innerWidth() + rb, Q = b.innerHeight(), b.width(P), O = a('
').css("padding", qb).append(b.children()), R = a('
').css({ width: P + "px", height: Q + "px" }).append(O).appendTo(b); else { if (b.css("width", ""), p = N.stickToBottom && A(), q = N.stickToRight && B(), k = b.innerWidth() + rb != P || b.outerHeight() != Q, k && (P = b.innerWidth() + rb, Q = b.innerHeight(), R.css({ width: P + "px", height: Q + "px" })), !k && sb == S && O.outerHeight() == T) return void b.width(P); sb = S, O.css("width", ""), b.width(P), R.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end() } O.css("overflow", "auto"), S = c.contentWidth ? c.contentWidth : O[0].scrollWidth, T = O[0].scrollHeight, O.css("overflow", ""), U = S / P, V = T / Q, W = V > 1, X = U > 1, X || W ? (b.addClass("jspScrollable"), f = N.maintainPosition && ($ || bb), f && (h = y(), j = z()), e(), g(), i(), f && (w(q ? S - P : h, !1), v(p ? T - Q : j, !1)), F(), C(), L(), N.enableKeyboardNavigation && H(), N.clickOnTrack && m(), J(), N.hijackInternalLinks && K()) : (b.removeClass("jspScrollable"), O.css({ top: 0, left: 0, width: R.width() - rb }), D(), G(), I(), n()), N.autoReinitialise && !pb ? pb = setInterval(function() { d(N) }, N.autoReinitialiseDelay) : !N.autoReinitialise && pb && clearInterval(pb), l && b.scrollTop(0) && v(l, !1), o && b.scrollLeft(0) && w(o, !1), b.trigger("jsp-initialised", [X || W]) } function e() { W && (R.append(a('
').append(a('
'), a('
').append(a('
').append(a('
'), a('
'))), a('
'))), cb = R.find(">.jspVerticalBar"), db = cb.find(">.jspTrack"), Y = db.find(">.jspDrag"), N.showArrows && (hb = a('').bind("mousedown.jsp", k(0, -1)).bind("click.jsp", E), ib = a('').bind("mousedown.jsp", k(0, 1)).bind("click.jsp", E), N.arrowScrollOnHover && (hb.bind("mouseover.jsp", k(0, -1, hb)), ib.bind("mouseover.jsp", k(0, 1, ib))), j(db, N.verticalArrowPositions, hb, ib)), fb = Q, R.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function() { fb -= a(this).outerHeight() }), Y.hover(function() { Y.addClass("jspHover") }, function() { Y.removeClass("jspHover") }).bind("mousedown.jsp", function(b) { a("html").bind("dragstart.jsp selectstart.jsp", E), Y.addClass("jspActive"); var c = b.pageY - Y.position().top; return a("html").bind("mousemove.jsp", function(a) { p(a.pageY - c, !1) }).bind("mouseup.jsp mouseleave.jsp", o), !1 }), f()) } function f() { db.height(fb + "px"), $ = 0, eb = N.verticalGutter + db.outerWidth(), O.width(P - eb - rb); try { 0 === cb.position().left && O.css("margin-left", eb + "px") } catch (a) {} } function g() { X && (R.append(a('
').append(a('
'), a('
').append(a('
').append(a('
'), a('
'))), a('
'))), jb = R.find(">.jspHorizontalBar"), kb = jb.find(">.jspTrack"), _ = kb.find(">.jspDrag"), N.showArrows && (nb = a('').bind("mousedown.jsp", k(-1, 0)).bind("click.jsp", E), ob = a('').bind("mousedown.jsp", k(1, 0)).bind("click.jsp", E), N.arrowScrollOnHover && (nb.bind("mouseover.jsp", k(-1, 0, nb)), ob.bind("mouseover.jsp", k(1, 0, ob))), j(kb, N.horizontalArrowPositions, nb, ob)), _.hover(function() { _.addClass("jspHover") }, function() { _.removeClass("jspHover") }).bind("mousedown.jsp", function(b) { a("html").bind("dragstart.jsp selectstart.jsp", E), _.addClass("jspActive"); var c = b.pageX - _.position().left; return a("html").bind("mousemove.jsp", function(a) { r(a.pageX - c, !1) }).bind("mouseup.jsp mouseleave.jsp", o), !1 }), lb = R.innerWidth(), h()) } function h() { R.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function() { lb -= a(this).outerWidth() }), kb.width(lb + "px"), bb = 0 } function i() { if (X && W) { var b = kb.outerHeight(), c = db.outerWidth(); fb -= b, a(jb).find(">.jspCap:visible,>.jspArrow").each(function() { lb += a(this).outerWidth() }), lb -= c, Q -= c, P -= b, kb.parent().append(a('
').css("width", b + "px")), f(), h() } X && O.width(R.outerWidth() - rb + "px"), T = O.outerHeight(), V = T / Q, X && (mb = Math.ceil(1 / U * lb), mb > N.horizontalDragMaxWidth ? mb = N.horizontalDragMaxWidth : mb < N.horizontalDragMinWidth && (mb = N.horizontalDragMinWidth), _.width(mb + "px"), ab = lb - mb, s(bb)), W && (gb = Math.ceil(1 / V * fb), gb > N.verticalDragMaxHeight ? gb = N.verticalDragMaxHeight : gb < N.verticalDragMinHeight && (gb = N.verticalDragMinHeight), Y.height(gb + "px"), Z = fb - gb, q($)) } function j(a, b, c, d) { var e, f = "before", g = "after"; "os" == b && (b = /Mac/.test(navigator.platform) ? "after" : "split"), b == f ? g = b : b == g && (f = b, e = c, c = d, d = e), a[f](c)[g](d) } function k(a, b, c) { return function() { return l(a, b, this, c), this.blur(), !1 } } function l(b, c, d, e) { d = a(d).addClass("jspActive"); var f, g, h = !0, i = function() { 0 !== b && tb.scrollByX(b * N.arrowButtonSpeed), 0 !== c && tb.scrollByY(c * N.arrowButtonSpeed), g = setTimeout(i, h ? N.initialDelay : N.arrowRepeatFreq), h = !1 }; i(), f = e ? "mouseout.jsp" : "mouseup.jsp", e = e || a("html"), e.bind(f, function() { d.removeClass("jspActive"), g && clearTimeout(g), g = null, e.unbind(f) }) } function m() { n(), W && db.bind("mousedown.jsp", function(b) { if (void 0 === b.originalTarget || b.originalTarget == b.currentTarget) { var c, d = a(this), e = d.offset(), f = b.pageY - e.top - $, g = !0, h = function() { var a = d.offset(), e = b.pageY - a.top - gb / 2, j = Q * N.scrollPagePercent, k = Z * j / (T - Q); if (0 > f) $ - k > e ? tb.scrollByY(-j) : p(e); else { if (!(f > 0)) return void i(); e > $ + k ? tb.scrollByY(j) : p(e) } c = setTimeout(h, g ? N.initialDelay : N.trackClickRepeatFreq), g = !1 }, i = function() { c && clearTimeout(c), c = null, a(document).unbind("mouseup.jsp", i) }; return h(), a(document).bind("mouseup.jsp", i), !1 } }), X && kb.bind("mousedown.jsp", function(b) { if (void 0 === b.originalTarget || b.originalTarget == b.currentTarget) { var c, d = a(this), e = d.offset(), f = b.pageX - e.left - bb, g = !0, h = function() { var a = d.offset(), e = b.pageX - a.left - mb / 2, j = P * N.scrollPagePercent, k = ab * j / (S - P); if (0 > f) bb - k > e ? tb.scrollByX(-j) : r(e); else { if (!(f > 0)) return void i(); e > bb + k ? tb.scrollByX(j) : r(e) } c = setTimeout(h, g ? N.initialDelay : N.trackClickRepeatFreq), g = !1 }, i = function() { c && clearTimeout(c), c = null, a(document).unbind("mouseup.jsp", i) }; return h(), a(document).bind("mouseup.jsp", i), !1 } }) } function n() { kb && kb.unbind("mousedown.jsp"), db && db.unbind("mousedown.jsp") } function o() { a("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"), Y && Y.removeClass("jspActive"), _ && _.removeClass("jspActive") } function p(c, d) { if (W) { 0 > c ? c = 0 : c > Z && (c = Z); var e = new a.Event("jsp-will-scroll-y"); if (b.trigger(e, [c]), !e.isDefaultPrevented()) { var f = c || 0, g = 0 === f, h = f == Z, i = c / Z, j = -i * (T - Q); void 0 === d && (d = N.animateScroll), d ? tb.animate(Y, "top", c, q, function() { b.trigger("jsp-user-scroll-y", [-j, g, h]) }) : (Y.css("top", c), q(c), b.trigger("jsp-user-scroll-y", [-j, g, h])) } } } function q(a) { void 0 === a && (a = Y.position().top), R.scrollTop(0), $ = a || 0; var c = 0 === $, d = $ == Z, e = a / Z, f = -e * (T - Q); (ub != c || wb != d) && (ub = c, wb = d, b.trigger("jsp-arrow-change", [ub, wb, vb, xb])), t(c, d), O.css("top", f), b.trigger("jsp-scroll-y", [-f, c, d]).trigger("scroll") } function r(c, d) { if (X) { 0 > c ? c = 0 : c > ab && (c = ab); var e = new a.Event("jsp-will-scroll-x"); if (b.trigger(e, [c]), !e.isDefaultPrevented()) { var f = c || 0, g = 0 === f, h = f == ab, i = c / ab, j = -i * (S - P); void 0 === d && (d = N.animateScroll), d ? tb.animate(_, "left", c, s, function() { b.trigger("jsp-user-scroll-x", [-j, g, h]) }) : (_.css("left", c), s(c), b.trigger("jsp-user-scroll-x", [-j, g, h])) } } } function s(a) { void 0 === a && (a = _.position().left), R.scrollTop(0), bb = a || 0; var c = 0 === bb, d = bb == ab, e = a / ab, f = -e * (S - P); (vb != c || xb != d) && (vb = c, xb = d, b.trigger("jsp-arrow-change", [ub, wb, vb, xb])), u(c, d), O.css("left", f), b.trigger("jsp-scroll-x", [-f, c, d]).trigger("scroll") } function t(a, b) { N.showArrows && (hb[a ? "addClass" : "removeClass"]("jspDisabled"), ib[b ? "addClass" : "removeClass"]("jspDisabled")) } function u(a, b) { N.showArrows && (nb[a ? "addClass" : "removeClass"]("jspDisabled"), ob[b ? "addClass" : "removeClass"]("jspDisabled")) } function v(a, b) { var c = a / (T - Q); p(c * Z, b) } function w(a, b) { var c = a / (S - P); r(c * ab, b) } function x(b, c, d) { var e, f, g, h, i, j, k, l, m, n = 0, o = 0; try { e = a(b) } catch (p) { return } for (f = e.outerHeight(), g = e.outerWidth(), R.scrollTop(0), R.scrollLeft(0); !e.is(".jspPane");) if (n += e.position().top, o += e.position().left, e = e.offsetParent(), /^body|html$/i.test(e[0].nodeName)) return; h = z(), j = h + Q, h > n || c ? l = n - N.horizontalGutter : n + f > j && (l = n - Q + f + N.horizontalGutter), isNaN(l) || v(l, d), i = y(), k = i + P, i > o || c ? m = o - N.horizontalGutter : o + g > k && (m = o - P + g + N.horizontalGutter), isNaN(m) || w(m, d) } function y() { return -O.position().left } function z() { return -O.position().top } function A() { var a = T - Q; return a > 20 && a - z() < 10 } function B() { var a = S - P; return a > 20 && a - y() < 10 } function C() { R.unbind(zb).bind(zb, function(a, b, c, d) { bb || (bb = 0), $ || ($ = 0); var e = bb, f = $, g = a.deltaFactor || N.mouseWheelSpeed; return tb.scrollBy(c * g, -d * g, !1), e == bb && f == $ }) } function D() { R.unbind(zb) } function E() { return !1 } function F() { O.find(":input,a").unbind("focus.jsp").bind("focus.jsp", function(a) { x(a.target, !1) }) } function G() { O.find(":input,a").unbind("focus.jsp") } function H() { function c() { var a = bb, b = $; switch (d) { case 40: tb.scrollByY(N.keyboardSpeed, !1); break; case 38: tb.scrollByY(-N.keyboardSpeed, !1); break; case 34: case 32: tb.scrollByY(Q * N.scrollPagePercent, !1); break; case 33: tb.scrollByY(-Q * N.scrollPagePercent, !1); break; case 39: tb.scrollByX(N.keyboardSpeed, !1); break; case 37: tb.scrollByX(-N.keyboardSpeed, !1) } return e = a != bb || b != $ } var d, e, f = []; X && f.push(jb[0]), W && f.push(cb[0]), O.bind("focus.jsp", function() { b.focus() }), b.attr("tabindex", 0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp", function(b) { if (b.target === this || f.length && a(b.target).closest(f).length) { var g = bb, h = $; switch (b.keyCode) { case 40: case 38: case 34: case 32: case 33: case 39: case 37: d = b.keyCode, c(); break; case 35: v(T - Q), d = null; break; case 36: v(0), d = null } return e = b.keyCode == d && g != bb || h != $, !e } }).bind("keypress.jsp", function(b) { return b.keyCode == d && c(), b.target === this || f.length && a(b.target).closest(f).length ? !e : void 0 }), N.hideFocus ? (b.css("outline", "none"), "hideFocus" in R[0] && b.attr("hideFocus", !0)) : (b.css("outline", ""), "hideFocus" in R[0] && b.attr("hideFocus", !1)) } function I() { b.attr("tabindex", "-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp"), O.unbind(".jsp") } function J() { if (location.hash && location.hash.length > 1) { var b, c, d = escape(location.hash.substr(1)); try { b = a("#" + d + ', a[name="' + d + '"]') } catch (e) { return } b.length && O.find(d) && (0 === R.scrollTop() ? c = setInterval(function() { R.scrollTop() > 0 && (x(b, !0), a(document).scrollTop(R.position().top), clearInterval(c)) }, 50) : (x(b, !0), a(document).scrollTop(R.position().top))) } } function K() { a(document.body).data("jspHijack") || (a(document.body).data("jspHijack", !0), a(document.body).delegate('a[href*="#"]', "click", function(b) { var c, d, e, f, g, h, i = this.href.substr(0, this.href.indexOf("#")), j = location.href; if (-1 !== location.href.indexOf("#") && (j = location.href.substr(0, location.href.indexOf("#"))), i === j) { c = escape(this.href.substr(this.href.indexOf("#") + 1)); try { d = a("#" + c + ', a[name="' + c + '"]') } catch (k) { return } d.length && (e = d.closest(".jspScrollable"), f = e.data("jsp"), f.scrollToElement(d, !0), e[0].scrollIntoView && (g = a(window).scrollTop(), h = d.offset().top, (g > h || h > g + a(window).height()) && e[0].scrollIntoView()), b.preventDefault()) } })) } function L() { var a, b, c, d, e, f = !1; R.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp", function(g) { var h = g.originalEvent.touches[0]; a = y(), b = z(), c = h.pageX, d = h.pageY, e = !1, f = !0 }).bind("touchmove.jsp", function(g) { if (f) { var h = g.originalEvent.touches[0], i = bb, j = $; return tb.scrollTo(a + c - h.pageX, b + d - h.pageY), e = e || Math.abs(c - h.pageX) > 5 || Math.abs(d - h.pageY) > 5, i == bb && j == $ } }).bind("touchend.jsp", function() { f = !1 }).bind("click.jsp-touchclick", function() { return e ? (e = !1, !1) : void 0 }) } function M() { var a = z(), c = y(); b.removeClass("jspScrollable").unbind(".jsp"), O.unbind(".jsp"), b.replaceWith(yb.append(O.children())), yb.scrollTop(a), yb.scrollLeft(c), pb && clearInterval(pb) } var N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $, _, ab, bb, cb, db, eb, fb, gb, hb, ib, jb, kb, lb, mb, nb, ob, pb, qb, rb, sb, tb = this, ub = !0, vb = !0, wb = !1, xb = !1, yb = b.clone(!1, !1).empty(), zb = a.fn.mwheelIntent ? "mwheelIntent.jsp" : "mousewheel.jsp"; "border-box" === b.css("box-sizing") ? (qb = 0, rb = 0) : (qb = b.css("paddingTop") + " " + b.css("paddingRight") + " " + b.css("paddingBottom") + " " + b.css("paddingLeft"), rb = (parseInt(b.css("paddingLeft"), 10) || 0) + (parseInt(b.css("paddingRight"), 10) || 0)), a.extend(tb, { reinitialise: function(b) { b = a.extend({}, N, b), d(b) }, scrollToElement: function(a, b, c) { x(a, b, c) }, scrollTo: function(a, b, c) { w(a, c), v(b, c) }, scrollToX: function(a, b) { w(a, b) }, scrollToY: function(a, b) { v(a, b) }, scrollToPercentX: function(a, b) { w(a * (S - P), b) }, scrollToPercentY: function(a, b) { v(a * (T - Q), b) }, scrollBy: function(a, b, c) { tb.scrollByX(a, c), tb.scrollByY(b, c) }, scrollByX: function(a, b) { var c = y() + Math[0 > a ? "floor" : "ceil"](a), d = c / (S - P); r(d * ab, b) }, scrollByY: function(a, b) { var c = z() + Math[0 > a ? "floor" : "ceil"](a), d = c / (T - Q); p(d * Z, b) }, positionDragX: function(a, b) { r(a, b) }, positionDragY: function(a, b) { p(a, b) }, animate: function(a, b, c, d, e) { var f = {}; f[b] = c, a.animate(f, { duration: N.animateDuration, easing: N.animateEase, queue: !1, step: d, complete: e }) }, getContentPositionX: function() { return y() }, getContentPositionY: function() { return z() }, getContentWidth: function() { return S }, getContentHeight: function() { return T }, getPercentScrolledX: function() { return y() / (S - P) }, getPercentScrolledY: function() { return z() / (T - Q) }, getIsScrollableH: function() { return X }, getIsScrollableV: function() { return W }, getContentPane: function() { return O }, scrollToBottom: function(a) { p(Z, a) }, hijackInternalLinks: a.noop, destroy: function() { M() } }), d(c) } return b = a.extend({}, a.fn.jScrollPane.defaults, b), a.each(["arrowButtonSpeed", "trackClickSpeed", "keyboardSpeed"], function() { b[this] = b[this] || b.speed }), this.each(function() { var d = a(this), e = d.data("jsp"); e ? e.reinitialise(b) : (a("script", d).filter('[type="text/javascript"],:not([type])').remove(), e = new c(d, b), d.data("jsp", e)) }) }, a.fn.jScrollPane.defaults = { showArrows: !1, maintainPosition: !0, stickToBottom: !1, stickToRight: !1, clickOnTrack: !0, autoReinitialise: !1, autoReinitialiseDelay: 500, verticalDragMinHeight: 0, verticalDragMaxHeight: 99999, horizontalDragMinWidth: 0, horizontalDragMaxWidth: 99999, contentWidth: void 0, animateScroll: !1, animateDuration: 300, animateEase: "linear", hijackInternalLinks: !1, verticalGutter: 4, horizontalGutter: 4, mouseWheelSpeed: 3, arrowButtonSpeed: 0, arrowRepeatFreq: 50, arrowScrollOnHover: !1, trackClickSpeed: 0, trackClickRepeatFreq: 70, verticalArrowPositions: "split", horizontalArrowPositions: "split", enableKeyboardNavigation: !0, hideFocus: !1, keyboardSpeed: 0, initialDelay: 300, speed: 30, scrollPagePercent: .8 } });; /*! * jQuery Mousewheel 3.1.12 * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ (function(factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { module.exports = factory; } else { factory(jQuery); } }(function($) { var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], toBind = ('onwheel' in document || document.documentMode >= 9) ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], slice = Array.prototype.slice, nullLowestDeltaTimeout, lowestDelta; if ($.event.fixHooks) { for (var i = toFix.length; i;) { $.event.fixHooks[toFix[--i]] = $.event.mouseHooks; } } var special = $.event.special.mousewheel = { version: '3.1.12', setup: function() { if (this.addEventListener) { for (var i = toBind.length; i;) { this.addEventListener(toBind[--i], handler, false); } } else { this.onmousewheel = handler; } $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function() { if (this.removeEventListener) { for (var i = toBind.length; i;) { this.removeEventListener(toBind[--i], handler, false); } } else { this.onmousewheel = null; } $.removeData(this, 'mousewheel-line-height'); $.removeData(this, 'mousewheel-page-height'); }, getLineHeight: function(elem) { var $elem = $(elem), $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); if (!$parent.length) { $parent = $('body'); } return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; }, getPageHeight: function(elem) { return $(elem).height(); }, settings: { adjustOldDeltas: true, normalizeOffset: true } }; $.fn.extend({ mousewheel: function(fn) { return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); }, unmousewheel: function(fn) { return this.unbind('mousewheel', fn); } }); function handler(event) { var orgEvent = event || window.event, args = slice.call(arguments, 1), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, offsetX = 0, offsetY = 0; event = $.event.fix(orgEvent); event.type = 'mousewheel'; if ('detail' in orgEvent) { deltaY = orgEvent.detail * -1; } if ('wheelDelta' in orgEvent) { deltaY = orgEvent.wheelDelta; } if ('wheelDeltaY' in orgEvent) { deltaY = orgEvent.wheelDeltaY; } if ('wheelDeltaX' in orgEvent) { deltaX = orgEvent.wheelDeltaX * -1; } if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) { deltaX = deltaY * -1; deltaY = 0; } delta = deltaY === 0 ? deltaX : deltaY; if ('deltaY' in orgEvent) { deltaY = orgEvent.deltaY * -1; delta = deltaY; } if ('deltaX' in orgEvent) { deltaX = orgEvent.deltaX; if (deltaY === 0) { delta = deltaX * -1; } } if (deltaY === 0 && deltaX === 0) { return; } if (orgEvent.deltaMode === 1) { var lineHeight = $.data(this, 'mousewheel-line-height'); delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if (orgEvent.deltaMode === 2) { var pageHeight = $.data(this, 'mousewheel-page-height'); delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight; } absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX)); if (!lowestDelta || absDelta < lowestDelta) { lowestDelta = absDelta; if (shouldAdjustOldDeltas(orgEvent, absDelta)) { lowestDelta /= 40; } } if (shouldAdjustOldDeltas(orgEvent, absDelta)) { delta /= 40; deltaX /= 40; deltaY /= 40; } delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta); deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta); deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta); if (special.settings.normalizeOffset && this.getBoundingClientRect) { var boundingRect = this.getBoundingClientRect(); offsetX = event.clientX - boundingRect.left; offsetY = event.clientY - boundingRect.top; } event.deltaX = deltaX; event.deltaY = deltaY; event.deltaFactor = lowestDelta; event.offsetX = offsetX; event.offsetY = offsetY; event.deltaMode = 0; args.unshift(event, delta, deltaX, deltaY); if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); return ($.event.dispatch || $.event.handle).apply(this, args); } function nullLowestDelta() { lowestDelta = null; } function shouldAdjustOldDeltas(orgEvent, absDelta) { return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; } }));; /** * Owl Carousel v2.2.0 * Copyright 2013-2016 David Deutsch * Licensed under MIT (https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE) */ ! function(a, b, c, d) { function e(b, c) { this.settings = null, this.options = a.extend({}, e.Defaults, c), this.$element = a(b), this._handlers = {}, this._plugins = {}, this._supress = {}, this._current = null, this._speed = null, this._coordinates = [], this._breakpoint = null, this._width = null, this._items = [], this._clones = [], this._mergers = [], this._widths = [], this._invalidated = {}, this._pipe = [], this._drag = { time: null, target: null, pointer: null, stage: { start: null, current: null }, direction: null }, this._states = { current: {}, tags: { initializing: ["busy"], animating: ["busy"], dragging: ["interacting"] } }, a.each(["onResize", "onThrottledResize"], a.proxy(function(b, c) { this._handlers[c] = a.proxy(this[c], this) }, this)), a.each(e.Plugins, a.proxy(function(a, b) { this._plugins[a.charAt(0).toLowerCase() + a.slice(1)] = new b(this) }, this)), a.each(e.Workers, a.proxy(function(b, c) { this._pipe.push({ filter: c.filter, run: a.proxy(c.run, this) }) }, this)), this.setup(), this.initialize() } e.Defaults = { items: 8, loop: !1, center: !1, rewind: !1, mouseDrag: !0, touchDrag: !0, pullDrag: !0, freeDrag: !1, margin: 0, stagePadding: 0, merge: !1, mergeFit: !0, autoWidth: !1, startPosition: 0, rtl: !1, smartSpeed: 250, fluidSpeed: !1, dragEndSpeed: !1, responsive: {}, responsiveRefreshRate: 200, responsiveBaseElement: b, fallbackEasing: "swing", info: !1, nestedItemSelector: !1, itemElement: "div", stageElement: "div", refreshClass: "owl-refresh", loadedClass: "owl-loaded", loadingClass: "owl-loading", rtlClass: "owl-rtl", responsiveClass: "owl-responsive", dragClass: "owl-drag", itemClass: "owl-item", stageClass: "owl-stage", stageOuterClass: "owl-stage-outer", grabClass: "owl-grab" }, e.Width = { Default: "default", Inner: "inner", Outer: "outer" }, e.Type = { Event: "event", State: "state" }, e.Plugins = {}, e.Workers = [{ filter: ["width", "settings"], run: function() { this._width = this.$element.width() } }, { filter: ["width", "items", "settings"], run: function(a) { a.current = this._items && this._items[this.relative(this._current)] } }, { filter: ["items", "settings"], run: function() { this.$stage.children(".cloned").remove() } }, { filter: ["width", "items", "settings"], run: function(a) { var b = this.settings.margin || "", c = !this.settings.autoWidth, d = this.settings.rtl, e = { width: "auto", "margin-left": d ? b : "", "margin-right": d ? "" : b }; !c && this.$stage.children().css(e), a.css = e } }, { filter: ["width", "items", "settings"], run: function(a) { var b = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, c = null, d = this._items.length, e = !this.settings.autoWidth, f = []; for (a.items = { merge: !1, width: b }; d--;) c = this._mergers[d], c = this.settings.mergeFit && Math.min(c, this.settings.items) || c, a.items.merge = c > 1 || a.items.merge, f[d] = e ? b * c : this._items[d].width(); this._widths = f } }, { filter: ["items", "settings"], run: function() { var b = [], c = this._items, d = this.settings, e = Math.max(2 * d.items, 4), f = 2 * Math.ceil(c.length / 2), g = d.loop && c.length ? d.rewind ? e : Math.max(e, f) : 0, h = "", i = ""; for (g /= 2; g--;) b.push(this.normalize(b.length / 2, !0)), h += c[b[b.length - 1]][0].outerHTML, b.push(this.normalize(c.length - 1 - (b.length - 1) / 2, !0)), i = c[b[b.length - 1]][0].outerHTML + i; this._clones = b, a(h).addClass("cloned").appendTo(this.$stage), a(i).addClass("cloned").prependTo(this.$stage) } }, { filter: ["width", "items", "settings"], run: function() { for (var a = this.settings.rtl ? 1 : -1, b = this._clones.length + this._items.length, c = -1, d = 0, e = 0, f = []; ++c < b;) d = f[c - 1] || 0, e = this._widths[this.relative(c)] + this.settings.margin, f.push(d + e * a); this._coordinates = f } }, { filter: ["width", "items", "settings"], run: function() { var a = this.settings.stagePadding, b = this._coordinates, c = { width: Math.ceil(Math.abs(b[b.length - 1])) + 2 * a, "padding-left": a || "", "padding-right": a || "" }; this.$stage.css(c) } }, { filter: ["width", "items", "settings"], run: function(a) { var b = this._coordinates.length, c = !this.settings.autoWidth, d = this.$stage.children(); if (c && a.items.merge) for (; b--;) a.css.width = this._widths[this.relative(b)], d.eq(b).css(a.css); else c && (a.css.width = a.items.width, d.css(a.css)) } }, { filter: ["items"], run: function() { this._coordinates.length < 1 && this.$stage.removeAttr("style") } }, { filter: ["width", "items", "settings"], run: function(a) { a.current = a.current ? this.$stage.children().index(a.current) : 0, a.current = Math.max(this.minimum(), Math.min(this.maximum(), a.current)), this.reset(a.current) } }, { filter: ["position"], run: function() { this.animate(this.coordinates(this._current)) } }, { filter: ["width", "position", "items", "settings"], run: function() { var a, b, c, d, e = this.settings.rtl ? 1 : -1, f = 2 * this.settings.stagePadding, g = this.coordinates(this.current()) + f, h = g + this.width() * e, i = []; for (c = 0, d = this._coordinates.length; d > c; c++) a = this._coordinates[c - 1] || 0, b = Math.abs(this._coordinates[c]) + f * e, (this.op(a, "<=", g) && this.op(a, ">", h) || this.op(b, "<", g) && this.op(b, ">", h)) && i.push(c); this.$stage.children(".active").removeClass("active"), this.$stage.children(":eq(" + i.join("), :eq(") + ")").addClass("active"), this.settings.center && (this.$stage.children(".center").removeClass("center"), this.$stage.children().eq(this.current()).addClass("center")) } }], e.prototype.initialize = function() { if (this.enter("initializing"), this.trigger("initialize"), this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl), this.settings.autoWidth && !this.is("pre-loading")) { var b, c, e; b = this.$element.find("img"), c = this.settings.nestedItemSelector ? "." + this.settings.nestedItemSelector : d, e = this.$element.children(c).width(), b.length && 0 >= e && this.preloadAutoWidthImages(b) } this.$element.addClass(this.options.loadingClass), this.$stage = a("<" + this.settings.stageElement + ' class="' + this.settings.stageClass + '"/>').wrap('
'), this.$element.append(this.$stage.parent()), this.replace(this.$element.children().not(this.$stage.parent())), this.$element.is(":visible") ? this.refresh() : this.invalidate("width"), this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass), this.registerEventHandlers(), this.leave("initializing"), this.trigger("initialized") }, e.prototype.setup = function() { var b = this.viewport(), c = this.options.responsive, d = -1, e = null; c ? (a.each(c, function(a) { b >= a && a > d && (d = Number(a)) }), e = a.extend({}, this.options, c[d]), "function" == typeof e.stagePadding && (e.stagePadding = e.stagePadding()), delete e.responsive, e.responsiveClass && this.$element.attr("class", this.$element.attr("class").replace(new RegExp("(" + this.options.responsiveClass + "-)\\S+\\s", "g"), "$1" + d))) : e = a.extend({}, this.options), this.trigger("change", { property: { name: "settings", value: e } }), this._breakpoint = d, this.settings = e, this.invalidate("settings"), this.trigger("changed", { property: { name: "settings", value: this.settings } }) }, e.prototype.optionsLogic = function() { this.settings.autoWidth && (this.settings.stagePadding = !1, this.settings.merge = !1) }, e.prototype.prepare = function(b) { var c = this.trigger("prepare", { content: b }); return c.data || (c.data = a("<" + this.settings.itemElement + "/>").addClass(this.options.itemClass).append(b)), this.trigger("prepared", { content: c.data }), c.data }, e.prototype.update = function() { for (var b = 0, c = this._pipe.length, d = a.proxy(function(a) { return this[a] }, this._invalidated), e = {}; c > b;)(this._invalidated.all || a.grep(this._pipe[b].filter, d).length > 0) && this._pipe[b].run(e), b++; this._invalidated = {}, !this.is("valid") && this.enter("valid") }, e.prototype.width = function(a) { switch (a = a || e.Width.Default) { case e.Width.Inner: case e.Width.Outer: return this._width; default: return this._width - 2 * this.settings.stagePadding + this.settings.margin } }, e.prototype.refresh = function() { this.enter("refreshing"), this.trigger("refresh"), this.setup(), this.optionsLogic(), this.$element.addClass(this.options.refreshClass), this.update(), this.$element.removeClass(this.options.refreshClass), this.leave("refreshing"), this.trigger("refreshed") }, e.prototype.onThrottledResize = function() { b.clearTimeout(this.resizeTimer), this.resizeTimer = b.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate) }, e.prototype.onResize = function() { return this._items.length ? this._width === this.$element.width() ? !1 : this.$element.is(":visible") ? (this.enter("resizing"), this.trigger("resize").isDefaultPrevented() ? (this.leave("resizing"), !1) : (this.invalidate("width"), this.refresh(), this.leave("resizing"), void this.trigger("resized"))) : !1 : !1 }, e.prototype.registerEventHandlers = function() { a.support.transition && this.$stage.on(a.support.transition.end + ".owl.core", a.proxy(this.onTransitionEnd, this)), this.settings.responsive !== !1 && this.on(b, "resize", this._handlers.onThrottledResize), this.settings.mouseDrag && (this.$element.addClass(this.options.dragClass), this.$stage.on("mousedown.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("dragstart.owl.core selectstart.owl.core", function() { return !1 })), this.settings.touchDrag && (this.$stage.on("touchstart.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("touchcancel.owl.core", a.proxy(this.onDragEnd, this))) }, e.prototype.onDragStart = function(b) { var d = null; 3 !== b.which && (a.support.transform ? (d = this.$stage.css("transform").replace(/.*\(|\)| /g, "").split(","), d = { x: d[16 === d.length ? 12 : 4], y: d[16 === d.length ? 13 : 5] }) : (d = this.$stage.position(), d = { x: this.settings.rtl ? d.left + this.$stage.width() - this.width() + this.settings.margin : d.left, y: d.top }), this.is("animating") && (a.support.transform ? this.animate(d.x) : this.$stage.stop(), this.invalidate("position")), this.$element.toggleClass(this.options.grabClass, "mousedown" === b.type), this.speed(0), this._drag.time = (new Date).getTime(), this._drag.target = a(b.target), this._drag.stage.start = d, this._drag.stage.current = d, this._drag.pointer = this.pointer(b), a(c).on("mouseup.owl.core touchend.owl.core", a.proxy(this.onDragEnd, this)), a(c).one("mousemove.owl.core touchmove.owl.core", a.proxy(function(b) { var d = this.difference(this._drag.pointer, this.pointer(b)); a(c).on("mousemove.owl.core touchmove.owl.core", a.proxy(this.onDragMove, this)), Math.abs(d.x) < Math.abs(d.y) && this.is("valid") || (b.preventDefault(), this.enter("dragging"), this.trigger("drag")) }, this))) }, e.prototype.onDragMove = function(a) { var b = null, c = null, d = null, e = this.difference(this._drag.pointer, this.pointer(a)), f = this.difference(this._drag.stage.start, e); this.is("dragging") && (a.preventDefault(), this.settings.loop ? (b = this.coordinates(this.minimum()), c = this.coordinates(this.maximum() + 1) - b, f.x = ((f.x - b) % c + c) % c + b) : (b = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()), c = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()), d = this.settings.pullDrag ? -1 * e.x / 5 : 0, f.x = Math.max(Math.min(f.x, b + d), c + d)), this._drag.stage.current = f, this.animate(f.x)) }, e.prototype.onDragEnd = function(b) { var d = this.difference(this._drag.pointer, this.pointer(b)), e = this._drag.stage.current, f = d.x > 0 ^ this.settings.rtl ? "left" : "right"; a(c).off(".owl.core"), this.$element.removeClass(this.options.grabClass), (0 !== d.x && this.is("dragging") || !this.is("valid")) && (this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed), this.current(this.closest(e.x, 0 !== d.x ? f : this._drag.direction)), this.invalidate("position"), this.update(), this._drag.direction = f, (Math.abs(d.x) > 3 || (new Date).getTime() - this._drag.time > 300) && this._drag.target.one("click.owl.core", function() { return !1 })), this.is("dragging") && (this.leave("dragging"), this.trigger("dragged")) }, e.prototype.closest = function(b, c) { var d = -1, e = 30, f = this.width(), g = this.coordinates(); return this.settings.freeDrag || a.each(g, a.proxy(function(a, h) { return "left" === c && b > h - e && h + e > b ? d = a : "right" === c && b > h - f - e && h - f + e > b ? d = a + 1 : this.op(b, "<", h) && this.op(b, ">", g[a + 1] || h - f) && (d = "left" === c ? a + 1 : a), -1 === d }, this)), this.settings.loop || (this.op(b, ">", g[this.minimum()]) ? d = b = this.minimum() : this.op(b, "<", g[this.maximum()]) && (d = b = this.maximum())), d }, e.prototype.animate = function(b) { var c = this.speed() > 0; this.is("animating") && this.onTransitionEnd(), c && (this.enter("animating"), this.trigger("translate")), a.support.transform3d && a.support.transition ? this.$stage.css({ transform: "translate3d(" + b + "px,0px,0px)", transition: this.speed() / 1e3 + "s" }) : c ? this.$stage.animate({ left: b + "px" }, this.speed(), this.settings.fallbackEasing, a.proxy(this.onTransitionEnd, this)) : this.$stage.css({ left: b + "px" }) }, e.prototype.is = function(a) { return this._states.current[a] && this._states.current[a] > 0 }, e.prototype.current = function(a) { if (a === d) return this._current; if (0 === this._items.length) return d; if (a = this.normalize(a), this._current !== a) { var b = this.trigger("change", { property: { name: "position", value: a } }); b.data !== d && (a = this.normalize(b.data)), this._current = a, this.invalidate("position"), this.trigger("changed", { property: { name: "position", value: this._current } }) } return this._current }, e.prototype.invalidate = function(b) { return "string" === a.type(b) && (this._invalidated[b] = !0, this.is("valid") && this.leave("valid")), a.map(this._invalidated, function(a, b) { return b }) }, e.prototype.reset = function(a) { a = this.normalize(a), a !== d && (this._speed = 0, this._current = a, this.suppress(["translate", "translated"]), this.animate(this.coordinates(a)), this.release(["translate", "translated"])) }, e.prototype.normalize = function(a, b) { var c = this._items.length, e = b ? 0 : this._clones.length; return !this.isNumeric(a) || 1 > c ? a = d : (0 > a || a >= c + e) && (a = ((a - e / 2) % c + c) % c + e / 2), a }, e.prototype.relative = function(a) { return a -= this._clones.length / 2, this.normalize(a, !0) }, e.prototype.maximum = function(a) { var b, c, d, e = this.settings, f = this._coordinates.length; if (e.loop) f = this._clones.length / 2 + this._items.length - 1; else if (e.autoWidth || e.merge) { for (b = this._items.length, c = this._items[--b].width(), d = this.$element.width(); b-- && (c += this._items[b].width() + this.settings.margin, !(c > d));); f = b + 1 } else f = e.center ? this._items.length - 1 : this._items.length - e.items; return a && (f -= this._clones.length / 2), Math.max(f, 0) }, e.prototype.minimum = function(a) { return a ? 0 : this._clones.length / 2 }, e.prototype.items = function(a) { return a === d ? this._items.slice() : (a = this.normalize(a, !0), this._items[a]) }, e.prototype.mergers = function(a) { return a === d ? this._mergers.slice() : (a = this.normalize(a, !0), this._mergers[a]) }, e.prototype.clones = function(b) { var c = this._clones.length / 2, e = c + this._items.length, f = function(a) { return a % 2 === 0 ? e + a / 2 : c - (a + 1) / 2 }; return b === d ? a.map(this._clones, function(a, b) { return f(b) }) : a.map(this._clones, function(a, c) { return a === b ? f(c) : null }) }, e.prototype.speed = function(a) { return a !== d && (this._speed = a), this._speed }, e.prototype.coordinates = function(b) { var c, e = 1, f = b - 1; return b === d ? a.map(this._coordinates, a.proxy(function(a, b) { return this.coordinates(b) }, this)) : (this.settings.center ? (this.settings.rtl && (e = -1, f = b + 1), c = this._coordinates[b], c += (this.width() - c + (this._coordinates[f] || 0)) / 2 * e) : c = this._coordinates[f] || 0, c = Math.ceil(c)) }, e.prototype.duration = function(a, b, c) { return 0 === c ? 0 : Math.min(Math.max(Math.abs(b - a), 1), 6) * Math.abs(c || this.settings.smartSpeed) }, e.prototype.to = function(a, b) { var c = this.current(), d = null, e = a - this.relative(c), f = (e > 0) - (0 > e), g = this._items.length, h = this.minimum(), i = this.maximum(); this.settings.loop ? (!this.settings.rewind && Math.abs(e) > g / 2 && (e += -1 * f * g), a = c + e, d = ((a - h) % g + g) % g + h, d !== a && i >= d - e && d - e > 0 && (c = d - e, a = d, this.reset(c))) : this.settings.rewind ? (i += 1, a = (a % i + i) % i) : a = Math.max(h, Math.min(i, a)), this.speed(this.duration(c, a, b)), this.current(a), this.$element.is(":visible") && this.update() }, e.prototype.next = function(a) { a = a || !1, this.to(this.relative(this.current()) + 1, a) }, e.prototype.prev = function(a) { a = a || !1, this.to(this.relative(this.current()) - 1, a) }, e.prototype.onTransitionEnd = function(a) { return a !== d && (a.stopPropagation(), (a.target || a.srcElement || a.originalTarget) !== this.$stage.get(0)) ? !1 : (this.leave("animating"), void this.trigger("translated")) }, e.prototype.viewport = function() { var d; if (this.options.responsiveBaseElement !== b) d = a(this.options.responsiveBaseElement).width(); else if (b.innerWidth) d = b.innerWidth; else { if (!c.documentElement || !c.documentElement.clientWidth) throw "Can not detect viewport width."; d = c.documentElement.clientWidth } return d }, e.prototype.replace = function(b) { this.$stage.empty(), this._items = [], b && (b = b instanceof jQuery ? b : a(b)), this.settings.nestedItemSelector && (b = b.find("." + this.settings.nestedItemSelector)), b.filter(function() { return 1 === this.nodeType }).each(a.proxy(function(a, b) { b = this.prepare(b), this.$stage.append(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1) }, this)), this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0), this.invalidate("items") }, e.prototype.add = function(b, c) { var e = this.relative(this._current); c = c === d ? this._items.length : this.normalize(c, !0), b = b instanceof jQuery ? b : a(b), this.trigger("add", { content: b, position: c }), b = this.prepare(b), 0 === this._items.length || c === this._items.length ? (0 === this._items.length && this.$stage.append(b), 0 !== this._items.length && this._items[c - 1].after(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)) : (this._items[c].before(b), this._items.splice(c, 0, b), this._mergers.splice(c, 0, 1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)), this._items[e] && this.reset(this._items[e].index()), this.invalidate("items"), this.trigger("added", { content: b, position: c }) }, e.prototype.remove = function(a) { a = this.normalize(a, !0), a !== d && (this.trigger("remove", { content: this._items[a], position: a }), this._items[a].remove(), this._items.splice(a, 1), this._mergers.splice(a, 1), this.invalidate("items"), this.trigger("removed", { content: null, position: a })) }, e.prototype.preloadAutoWidthImages = function(b) { b.each(a.proxy(function(b, c) { this.enter("pre-loading"), c = a(c), a(new Image).one("load", a.proxy(function(a) { c.attr("src", a.target.src), c.css("opacity", 1), this.leave("pre-loading"), !this.is("pre-loading") && !this.is("initializing") && this.refresh() }, this)).attr("src", c.attr("src") || c.attr("data-src") || c.attr("data-src-retina")) }, this)) }, e.prototype.destroy = function() { this.$element.off(".owl.core"), this.$stage.off(".owl.core"), a(c).off(".owl.core"), this.settings.responsive !== !1 && (b.clearTimeout(this.resizeTimer), this.off(b, "resize", this._handlers.onThrottledResize)); for (var d in this._plugins) this._plugins[d].destroy(); this.$stage.children(".cloned").remove(), this.$stage.unwrap(), this.$stage.children().contents().unwrap(), this.$stage.children().unwrap(), this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class", this.$element.attr("class").replace(new RegExp(this.options.responsiveClass + "-\\S+\\s", "g"), "")).removeData("owl.carousel") }, e.prototype.op = function(a, b, c) { var d = this.settings.rtl; switch (b) { case "<": return d ? a > c : c > a; case ">": return d ? c > a : a > c; case ">=": return d ? c >= a : a >= c; case "<=": return d ? a >= c : c >= a } }, e.prototype.on = function(a, b, c, d) { a.addEventListener ? a.addEventListener(b, c, d) : a.attachEvent && a.attachEvent("on" + b, c) }, e.prototype.off = function(a, b, c, d) { a.removeEventListener ? a.removeEventListener(b, c, d) : a.detachEvent && a.detachEvent("on" + b, c) }, e.prototype.trigger = function(b, c, d, f, g) { var h = { item: { count: this._items.length, index: this.current() } }, i = a.camelCase(a.grep(["on", b, d], function(a) { return a }).join("-").toLowerCase()), j = a.Event([b, "owl", d || "carousel"].join(".").toLowerCase(), a.extend({ relatedTarget: this }, h, c)); return this._supress[b] || (a.each(this._plugins, function(a, b) { b.onTrigger && b.onTrigger(j) }), this.register({ type: e.Type.Event, name: b }), this.$element.trigger(j), this.settings && "function" == typeof this.settings[i] && this.settings[i].call(this, j)), j }, e.prototype.enter = function(b) { a.each([b].concat(this._states.tags[b] || []), a.proxy(function(a, b) { this._states.current[b] === d && (this._states.current[b] = 0), this._states.current[b]++ }, this)) }, e.prototype.leave = function(b) { a.each([b].concat(this._states.tags[b] || []), a.proxy(function(a, b) { this._states.current[b]-- }, this)) }, e.prototype.register = function(b) { if (b.type === e.Type.Event) { if (a.event.special[b.name] || (a.event.special[b.name] = {}), !a.event.special[b.name].owl) { var c = a.event.special[b.name]._default; a.event.special[b.name]._default = function(a) { return !c || !c.apply || a.namespace && -1 !== a.namespace.indexOf("owl") ? a.namespace && a.namespace.indexOf("owl") > -1 : c.apply(this, arguments) }, a.event.special[b.name].owl = !0 } } else b.type === e.Type.State && (this._states.tags[b.name] ? this._states.tags[b.name] = this._states.tags[b.name].concat(b.tags) : this._states.tags[b.name] = b.tags, this._states.tags[b.name] = a.grep(this._states.tags[b.name], a.proxy(function(c, d) { return a.inArray(c, this._states.tags[b.name]) === d }, this))) }, e.prototype.suppress = function(b) { a.each(b, a.proxy(function(a, b) { this._supress[b] = !0 }, this)) }, e.prototype.release = function(b) { a.each(b, a.proxy(function(a, b) { delete this._supress[b] }, this)) }, e.prototype.pointer = function(a) { var c = { x: null, y: null }; return a = a.originalEvent || a || b.event, a = a.touches && a.touches.length ? a.touches[0] : a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : a, a.pageX ? (c.x = a.pageX, c.y = a.pageY) : (c.x = a.clientX, c.y = a.clientY), c }, e.prototype.isNumeric = function(a) { return !isNaN(parseFloat(a)) }, e.prototype.difference = function(a, b) { return { x: a.x - b.x, y: a.y - b.y } }, a.fn.owlCarousel = function(b) { var c = Array.prototype.slice.call(arguments, 1); return this.each(function() { var d = a(this), f = d.data("owl.carousel"); f || (f = new e(this, "object" == typeof b && b), d.data("owl.carousel", f), a.each(["next", "prev", "to", "destroy", "refresh", "replace", "add", "remove"], function(b, c) { f.register({ type: e.Type.Event, name: c }), f.$element.on(c + ".owl.carousel.core", a.proxy(function(a) { a.namespace && a.relatedTarget !== this && (this.suppress([c]), f[c].apply(this, [].slice.call(arguments, 1)), this.release([c])) }, f)) })), "string" == typeof b && "_" !== b.charAt(0) && f[b].apply(f, c) }) }, a.fn.owlCarousel.Constructor = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this._core = b, this._interval = null, this._visible = null, this._handlers = { "initialized.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.autoRefresh && this.watch() }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { autoRefresh: !0, autoRefreshInterval: 500 }, e.prototype.watch = function() { this._interval || (this._visible = this._core.$element.is(":visible"), this._interval = b.setInterval(a.proxy(this.refresh, this), this._core.settings.autoRefreshInterval)) }, e.prototype.refresh = function() { this._core.$element.is(":visible") !== this._visible && (this._visible = !this._visible, this._core.$element.toggleClass("owl-hidden", !this._visible), this._visible && this._core.invalidate("width") && this._core.refresh()) }, e.prototype.destroy = function() { var a, c; b.clearInterval(this._interval); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null) }, a.fn.owlCarousel.Constructor.Plugins.AutoRefresh = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this._core = b, this._loaded = [], this._handlers = { "initialized.owl.carousel change.owl.carousel resized.owl.carousel": a.proxy(function(b) { if (b.namespace && this._core.settings && this._core.settings.lazyLoad && (b.property && "position" == b.property.name || "initialized" == b.type)) for (var c = this._core.settings, e = c.center && Math.ceil(c.items / 2) || c.items, f = c.center && -1 * e || 0, g = (b.property && b.property.value !== d ? b.property.value : this._core.current()) + f, h = this._core.clones().length, i = a.proxy(function(a, b) { this.load(b) }, this); f++ < e;) this.load(h / 2 + this._core.relative(g)), h && a.each(this._core.clones(this._core.relative(g)), i), g++ }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { lazyLoad: !1 }, e.prototype.load = function(c) { var d = this._core.$stage.children().eq(c), e = d && d.find(".owl-lazy"); !e || a.inArray(d.get(0), this._loaded) > -1 || (e.each(a.proxy(function(c, d) { var e, f = a(d), g = b.devicePixelRatio > 1 && f.attr("data-src-retina") || f.attr("data-src"); this._core.trigger("load", { element: f, url: g }, "lazy"), f.is("img") ? f.one("load.owl.lazy", a.proxy(function() { f.css("opacity", 1), this._core.trigger("loaded", { element: f, url: g }, "lazy") }, this)).attr("src", g) : (e = new Image, e.onload = a.proxy(function() { f.css({ "background-image": "url(" + g + ")", opacity: "1" }), this._core.trigger("loaded", { element: f, url: g }, "lazy") }, this), e.src = g) }, this)), this._loaded.push(d.get(0))) }, e.prototype.destroy = function() { var a, b; for (a in this.handlers) this._core.$element.off(a, this.handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.Lazy = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this._core = b, this._handlers = { "initialized.owl.carousel refreshed.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.autoHeight && this.update() }, this), "changed.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.autoHeight && "position" == a.property.name && this.update() }, this), "loaded.owl.lazy": a.proxy(function(a) { a.namespace && this._core.settings.autoHeight && a.element.closest("." + this._core.settings.itemClass).index() === this._core.current() && this.update() }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers) }; e.Defaults = { autoHeight: !1, autoHeightClass: "owl-height" }, e.prototype.update = function() { var b = this._core._current, c = b + this._core.settings.items, d = this._core.$stage.children().toArray().slice(b, c), e = [], f = 0; a.each(d, function(b, c) { e.push(a(c).height()) }), f = Math.max.apply(null, e), this._core.$stage.parent().height(f).addClass(this._core.settings.autoHeightClass) }, e.prototype.destroy = function() { var a, b; for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.AutoHeight = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this._core = b, this._videos = {}, this._playing = null, this._handlers = { "initialized.owl.carousel": a.proxy(function(a) { a.namespace && this._core.register({ type: "state", name: "playing", tags: ["interacting"] }) }, this), "resize.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.video && this.isInFullScreen() && a.preventDefault() }, this), "refreshed.owl.carousel": a.proxy(function(a) { a.namespace && this._core.is("resizing") && this._core.$stage.find(".cloned .owl-video-frame").remove() }, this), "changed.owl.carousel": a.proxy(function(a) { a.namespace && "position" === a.property.name && this._playing && this.stop() }, this), "prepared.owl.carousel": a.proxy(function(b) { if (b.namespace) { var c = a(b.content).find(".owl-video"); c.length && (c.css("display", "none"), this.fetch(c, a(b.content))) } }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers), this._core.$element.on("click.owl.video", ".owl-video-play-icon", a.proxy(function(a) { this.play(a) }, this)) }; e.Defaults = { video: !1, videoHeight: !1, videoWidth: !1 }, e.prototype.fetch = function(a, b) { var c = function() { return a.attr("data-vimeo-id") ? "vimeo" : a.attr("data-vzaar-id") ? "vzaar" : "youtube" }(), d = a.attr("data-vimeo-id") || a.attr("data-youtube-id") || a.attr("data-vzaar-id"), e = a.attr("data-width") || this._core.settings.videoWidth, f = a.attr("data-height") || this._core.settings.videoHeight, g = a.attr("href"); if (!g) throw new Error("Missing video URL."); if (d = g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/), d[3].indexOf("youtu") > -1) c = "youtube"; else if (d[3].indexOf("vimeo") > -1) c = "vimeo"; else { if (!(d[3].indexOf("vzaar") > -1)) throw new Error("Video URL not supported."); c = "vzaar" } d = d[6], this._videos[g] = { type: c, id: d, width: e, height: f }, b.attr("data-video", g), this.thumbnail(a, this._videos[g]) }, e.prototype.thumbnail = function(b, c) { var d, e, f, g = c.width && c.height ? 'style="width:' + c.width + "px;height:" + c.height + 'px;"' : "", h = b.find("img"), i = "src", j = "", k = this._core.settings, l = function(a) { e = '
', d = k.lazyLoad ? '
' : '
', b.after(d), b.after(e) }; return b.wrap('
"), this._core.settings.lazyLoad && (i = "data-src", j = "owl-lazy"), h.length ? (l(h.attr(i)), h.remove(), !1) : void("youtube" === c.type ? (f = "//img.youtube.com/vi/" + c.id + "/hqdefault.jpg", l(f)) : "vimeo" === c.type ? a.ajax({ type: "GET", url: "//vimeo.com/api/v2/video/" + c.id + ".json", jsonp: "callback", dataType: "jsonp", success: function(a) { f = a[0].thumbnail_large, l(f) } }) : "vzaar" === c.type && a.ajax({ type: "GET", url: "//vzaar.com/api/videos/" + c.id + ".json", jsonp: "callback", dataType: "jsonp", success: function(a) { f = a.framegrab_url, l(f) } })) }, e.prototype.stop = function() { this._core.trigger("stop", null, "video"), this._playing.find(".owl-video-frame").remove(), this._playing.removeClass("owl-video-playing"), this._playing = null, this._core.leave("playing"), this._core.trigger("stopped", null, "video") }, e.prototype.play = function(b) { var c, d = a(b.target), e = d.closest("." + this._core.settings.itemClass), f = this._videos[e.attr("data-video")], g = f.width || "100%", h = f.height || this._core.$stage.height(); this._playing || (this._core.enter("playing"), this._core.trigger("play", null, "video"), e = this._core.items(this._core.relative(e.index())), this._core.reset(e.index()), "youtube" === f.type ? c = '' : "vimeo" === f.type ? c = '' : "vzaar" === f.type && (c = ''), a('
' + c + "
").insertAfter(e.find(".owl-video")), this._playing = e.addClass("owl-video-playing")) }, e.prototype.isInFullScreen = function() { var b = c.fullscreenElement || c.mozFullScreenElement || c.webkitFullscreenElement; return b && a(b).parent().hasClass("owl-video-frame") }, e.prototype.destroy = function() { var a, b; this._core.$element.off("click.owl.video"); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.Video = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this.core = b, this.core.options = a.extend({}, e.Defaults, this.core.options), this.swapping = !0, this.previous = d, this.next = d, this.handlers = { "change.owl.carousel": a.proxy(function(a) { a.namespace && "position" == a.property.name && (this.previous = this.core.current(), this.next = a.property.value) }, this), "drag.owl.carousel dragged.owl.carousel translated.owl.carousel": a.proxy(function(a) { a.namespace && (this.swapping = "translated" == a.type) }, this), "translate.owl.carousel": a.proxy(function(a) { a.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn) && this.swap() }, this) }, this.core.$element.on(this.handlers) }; e.Defaults = { animateOut: !1, animateIn: !1 }, e.prototype.swap = function() { if (1 === this.core.settings.items && a.support.animation && a.support.transition) { this.core.speed(0); var b, c = a.proxy(this.clear, this), d = this.core.$stage.children().eq(this.previous), e = this.core.$stage.children().eq(this.next), f = this.core.settings.animateIn, g = this.core.settings.animateOut; this.core.current() !== this.previous && (g && (b = this.core.coordinates(this.previous) - this.core.coordinates(this.next), d.one(a.support.animation.end, c).css({ left: b + "px" }).addClass("animated owl-animated-out").addClass(g)), f && e.one(a.support.animation.end, c).addClass("animated owl-animated-in").addClass(f)) } }, e.prototype.clear = function(b) { a(b.target).css({ left: "" }).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut), this.core.onTransitionEnd() }, e.prototype.destroy = function() { var a, b; for (a in this.handlers) this.core.$element.off(a, this.handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null); }, a.fn.owlCarousel.Constructor.Plugins.Animate = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { var e = function(b) { this._core = b, this._timeout = null, this._paused = !1, this._handlers = { "changed.owl.carousel": a.proxy(function(a) { a.namespace && "settings" === a.property.name ? this._core.settings.autoplay ? this.play() : this.stop() : a.namespace && "position" === a.property.name && this._core.settings.autoplay && this._setAutoPlayInterval() }, this), "initialized.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.autoplay && this.play() }, this), "play.owl.autoplay": a.proxy(function(a, b, c) { a.namespace && this.play(b, c) }, this), "stop.owl.autoplay": a.proxy(function(a) { a.namespace && this.stop() }, this), "mouseover.owl.autoplay": a.proxy(function() { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause() }, this), "mouseleave.owl.autoplay": a.proxy(function() { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.play() }, this), "touchstart.owl.core": a.proxy(function() { this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause() }, this), "touchend.owl.core": a.proxy(function() { this._core.settings.autoplayHoverPause && this.play() }, this) }, this._core.$element.on(this._handlers), this._core.options = a.extend({}, e.Defaults, this._core.options) }; e.Defaults = { autoplay: !1, autoplayTimeout: 5e3, autoplayHoverPause: !1, autoplaySpeed: !1 }, e.prototype.play = function(a, b) { this._paused = !1, this._core.is("rotating") || (this._core.enter("rotating"), this._setAutoPlayInterval()) }, e.prototype._getNextTimeout = function(d, e) { return this._timeout && b.clearTimeout(this._timeout), b.setTimeout(a.proxy(function() { this._paused || this._core.is("busy") || this._core.is("interacting") || c.hidden || this._core.next(e || this._core.settings.autoplaySpeed) }, this), d || this._core.settings.autoplayTimeout) }, e.prototype._setAutoPlayInterval = function() { this._timeout = this._getNextTimeout() }, e.prototype.stop = function() { this._core.is("rotating") && (b.clearTimeout(this._timeout), this._core.leave("rotating")) }, e.prototype.pause = function() { this._core.is("rotating") && (this._paused = !0) }, e.prototype.destroy = function() { var a, b; this.stop(); for (a in this._handlers) this._core.$element.off(a, this._handlers[a]); for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null) }, a.fn.owlCarousel.Constructor.Plugins.autoplay = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { "use strict"; var e = function(b) { this._core = b, this._initialized = !1, this._pages = [], this._controls = {}, this._templates = [], this.$element = this._core.$element, this._overrides = { next: this._core.next, prev: this._core.prev, to: this._core.to }, this._handlers = { "prepared.owl.carousel": a.proxy(function(b) { b.namespace && this._core.settings.dotsData && this._templates.push('
' + a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot") + "
") }, this), "added.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 0, this._templates.pop()) }, this), "remove.owl.carousel": a.proxy(function(a) { a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 1) }, this), "changed.owl.carousel": a.proxy(function(a) { a.namespace && "position" == a.property.name && this.draw() }, this), "initialized.owl.carousel": a.proxy(function(a) { a.namespace && !this._initialized && (this._core.trigger("initialize", null, "navigation"), this.initialize(), this.update(), this.draw(), this._initialized = !0, this._core.trigger("initialized", null, "navigation")) }, this), "refreshed.owl.carousel": a.proxy(function(a) { a.namespace && this._initialized && (this._core.trigger("refresh", null, "navigation"), this.update(), this.draw(), this._core.trigger("refreshed", null, "navigation")) }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers) }; e.Defaults = { nav: !1, navText: ["prev", "next"], navSpeed: !1, navElement: "div", navContainer: !1, navContainerClass: "owl-nav", navClass: ["owl-prev", "owl-next"], slideBy: 1, dotClass: "owl-dot", dotsClass: "owl-dots", dots: !0, dotsEach: !1, dotsData: !1, dotsSpeed: !1, dotsContainer: !1 }, e.prototype.initialize = function() { var b, c = this._core.settings; this._controls.$relative = (c.navContainer ? a(c.navContainer) : a("
").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"), this._controls.$previous = $('#sliderNav .icon-' + ($('.icon-slider-arrow-left').length ? 'slider-' : '') + 'arrow-left').prependTo(this._controls.$relative).on("click", a.proxy(function(a) { this.prev(c.navSpeed) }, this)), this._controls.$next = $('#sliderNav .icon-' + ($('.icon-slider-arrow-left').length ? 'slider-' : '') + 'arrow-right').appendTo(this._controls.$relative).on("click", a.proxy(function(a) { this.next(c.navSpeed) }, this)), c.dotsData || (this._templates = [a("
").addClass(c.dotClass).append(a("")).prop("outerHTML")]), this._controls.$absolute = (c.dotsContainer ? a(c.dotsContainer) : a("
").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"), this._controls.$absolute.on("click", "div", a.proxy(function(b) { var d = a(b.target).parent().is(this._controls.$absolute) ? a(b.target).index() : a(b.target).parent().index(); b.preventDefault(), this.to(d, c.dotsSpeed) }, this)); for (b in this._overrides) this._core[b] = a.proxy(this[b], this) }, e.prototype.destroy = function() { var a, b, c, d; for (a in this._handlers) this.$element.off(a, this._handlers[a]); for (b in this._controls) this._controls[b].remove(); for (d in this.overides) this._core[d] = this._overrides[d]; for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null) }, e.prototype.update = function() { var a, b, c, d = this._core.clones().length / 2, e = d + this._core.items().length, f = this._core.maximum(!0), g = this._core.settings, h = g.center || g.autoWidth || g.dotsData ? 1 : g.dotsEach || g.items; if ("page" !== g.slideBy && (g.slideBy = Math.min(g.slideBy, g.items)), g.dots || "page" == g.slideBy) for (this._pages = [], a = d, b = 0, c = 0; e > a; a++) { if (b >= h || 0 === b) { if (this._pages.push({ start: Math.min(f, a - d), end: a - d + h - 1 }), Math.min(f, a - d) === f) break; b = 0, ++c } b += this._core.mergers(this._core.relative(a)) } }, e.prototype.draw = function() { var b, c = this._core.settings, d = this._core.items().length <= c.items, e = this._core.relative(this._core.current()), f = c.loop || c.rewind; this._controls.$relative.toggleClass("disabled", !c.nav || d), c.nav && (this._controls.$previous.toggleClass("disabled", !f && e <= this._core.minimum(!0)), this._controls.$next.toggleClass("disabled", !f && e >= this._core.maximum(!0))), this._controls.$absolute.toggleClass("disabled", !c.dots || d), c.dots && (b = this._pages.length - this._controls.$absolute.children().length, c.dotsData && 0 !== b ? this._controls.$absolute.html(this._templates.join("")) : b > 0 ? this._controls.$absolute.append(new Array(b + 1).join(this._templates[0])) : 0 > b && this._controls.$absolute.children().slice(b).remove(), this._controls.$absolute.find(".active").removeClass("active"), this._controls.$absolute.children().eq(a.inArray(this.current(), this._pages)).addClass("active")) }, e.prototype.onTrigger = function(b) { var c = this._core.settings; b.page = { index: a.inArray(this.current(), this._pages), count: this._pages.length, size: c && (c.center || c.autoWidth || c.dotsData ? 1 : c.dotsEach || c.items) } }, e.prototype.current = function() { var b = this._core.relative(this._core.current()); return a.grep(this._pages, a.proxy(function(a, c) { return a.start <= b && a.end >= b }, this)).pop() }, e.prototype.getPosition = function(b) { var c, d, e = this._core.settings; return "page" == e.slideBy ? (c = a.inArray(this.current(), this._pages), d = this._pages.length, b ? ++c : --c, c = this._pages[(c % d + d) % d].start) : (c = this._core.relative(this._core.current()), d = this._core.items().length, b ? c += e.slideBy : c -= e.slideBy), c }, e.prototype.next = function(b) { a.proxy(this._overrides.to, this._core)(this.getPosition(!0), b) }, e.prototype.prev = function(b) { a.proxy(this._overrides.to, this._core)(this.getPosition(!1), b) }, e.prototype.to = function(b, c, d) { var e; !d && this._pages.length ? (e = this._pages.length, a.proxy(this._overrides.to, this._core)(this._pages[(b % e + e) % e].start, c)) : a.proxy(this._overrides.to, this._core)(b, c) }, a.fn.owlCarousel.Constructor.Plugins.Navigation = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { "use strict"; var e = function(c) { this._core = c, this._hashes = {}, this.$element = this._core.$element, this._handlers = { "initialized.owl.carousel": a.proxy(function(c) { c.namespace && "URLHash" === this._core.settings.startPosition && a(b).trigger("hashchange.owl.navigation") }, this), "prepared.owl.carousel": a.proxy(function(b) { if (b.namespace) { var c = a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash"); if (!c) return; this._hashes[c] = b.content } }, this), "changed.owl.carousel": a.proxy(function(c) { if (c.namespace && "position" === c.property.name) { var d = this._core.items(this._core.relative(this._core.current())), e = a.map(this._hashes, function(a, b) { return a === d ? b : null }).join(); if (!e || b.location.hash.slice(1) === e) return; b.location.hash = e } }, this) }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers), a(b).on("hashchange.owl.navigation", a.proxy(function(a) { var c = b.location.hash.substring(1), e = this._core.$stage.children(), f = this._hashes[c] && e.index(this._hashes[c]); f !== d && f !== this._core.current() && this._core.to(this._core.relative(f), !1, !0) }, this)) }; e.Defaults = { URLhashListener: !1 }, e.prototype.destroy = function() { var c, d; a(b).off("hashchange.owl.navigation"); for (c in this._handlers) this._core.$element.off(c, this._handlers[c]); for (d in Object.getOwnPropertyNames(this)) "function" != typeof this[d] && (this[d] = null) }, a.fn.owlCarousel.Constructor.Plugins.Hash = e }(window.Zepto || window.jQuery, window, document), function(a, b, c, d) { function e(b, c) { var e = !1, f = b.charAt(0).toUpperCase() + b.slice(1); return a.each((b + " " + h.join(f + " ") + f).split(" "), function(a, b) { return g[b] !== d ? (e = c ? b : !0, !1) : void 0 }), e } function f(a) { return e(a, !0) } var g = a("").get(0).style, h = "Webkit Moz O ms".split(" "), i = { transition: { end: { WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd", transition: "transitionend" } }, animation: { end: { WebkitAnimation: "webkitAnimationEnd", MozAnimation: "animationend", OAnimation: "oAnimationEnd", animation: "animationend" } } }, j = { csstransforms: function() { return !!e("transform") }, csstransforms3d: function() { return !!e("perspective") }, csstransitions: function() { return !!e("transition") }, cssanimations: function() { return !!e("animation") } }; j.csstransitions() && (a.support.transition = new String(f("transition")), a.support.transition.end = i.transition.end[a.support.transition]), j.cssanimations() && (a.support.animation = new String(f("animation")), a.support.animation.end = i.animation.end[a.support.animation]), j.csstransforms() && (a.support.transform = new String(f("transform")), a.support.transform3d = j.csstransforms3d()) }(window.Zepto || window.jQuery, window, document);; /*! * jQuery Cookie Plugin v1.4.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2006, 2014 Klaus Hartl * Released under the MIT license */ (function(factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { module.exports = factory(require('jquery')); } else { factory(jQuery); } }(function($) { var pluses = /\+/g; function encode(s) { return config.raw ? s : encodeURIComponent(s); } function decode(s) { return config.raw ? s : decodeURIComponent(s); } function stringifyCookieValue(value) { return encode(config.json ? JSON.stringify(value) : String(value)); } function parseCookieValue(s) { if (s.indexOf('"') === 0) { s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { s = decodeURIComponent(s.replace(pluses, ' ')); return config.json ? JSON.parse(s) : s; } catch (e) {} } function read(s, converter) { var value = config.raw ? s : parseCookieValue(s); return $.isFunction(converter) ? converter(value) : value; } var config = $.cookie = function(key, value, options) { if (arguments.length > 1 && !$.isFunction(value)) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setMilliseconds(t.getMilliseconds() + days * 864e+5); } return (document.cookie = [encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : ''].join('')); } var result = key ? undefined : {}, cookies = document.cookie ? document.cookie.split('; ') : [], i = 0, l = cookies.length; for (; i < l; i++) { var parts = cookies[i].split('='), name = decode(parts.shift()), cookie = parts.join('='); if (key === name) { result = read(cookie, value); break; } if (!key && (cookie = read(cookie)) !== undefined) { result[name] = cookie; } } return result; }; config.defaults = {}; $.removeCookie = function(key, options) { $.cookie(key, '', $.extend({}, options, { expires: -1 })); return !$.cookie(key); }; }));; var hstime, bstime, usearch, usersfilter; function hideSearch() { $('.header .search-form form a').fadeOut('fast', function() { $('.header .search-form form').stop().animate({ width: 0, opacity: 0 }, 'slow', function() { $(this).hide(); }); $('#searchsuggestions').stop().fadeOut('fast'); }); } function showSearch() { $('.header .search-form form').stop().show().animate({ width: '100%', opacity: 1 }, 'slow', function() { if ($(this).find('#story').val().length > 1 && $('#searchsuggestions').length) $('#searchsuggestions').fadeIn('fast'); }); $('.header #story').trigger('focus'); } function openWindow(blockWindow) { var wHeight, textInput, visible; textInput = $(blockWindow).find('input[type="text"]').eq(0); $('body').addClass('xOverflow'); var recaptcha = document.getElementById(blockWindow.substr(1)); recaptcha = recaptcha.getElementsByClassName('recaptchaWindow'); if (recaptcha.length && recaptcha[0].innerHTML == '') { grecaptcha.render(recaptcha[0], { sitekey: recaptchaSiteKey, callback: function(response) { console.log(response); } }); } $(blockWindow).show(0, function() { wHeight = $(blockWindow).find('.contentWindow').outerHeight(); }).find('.overlayWindow').hide().fadeIn('slow').parents(blockWindow).find('.contentWindow').css({ opacity: 0 }).animate({ marginBottom: (wHeight <= $(window).height() ? -wHeight / 2 : 0), opacity: 1 }, 'slow', function() { if (textInput.length) textInput.focus(); }).addClass(wHeight > $(window).height() ? 'fixHeight' : '').parents('.popupWindow').jScrollPane(); } function closeWindow(blockWindow) { $(blockWindow).find('.contentWindow').removeClass('fixHeight').animate({ marginBottom: 0, opacity: 0 }, 'fast').parents('.popupWindow').fadeOut('fast'); $('body').removeClass('xOverflow'); } function Timer(callback, delay) { var timerId, start, remaining = delay; this.pause = function() { window.clearTimeout(timerId); remaining -= new Date() - start; }; this.resume = function() { start = new Date(); window.clearTimeout(timerId); timerId = window.setTimeout(callback, remaining); }; this.resume(); } function noticePush(message, title) { if (!$('.noticePanel').length) $('body').append('
'); var msg = $('
').addClass('notice').hide(); msg.html(title ? '' + title + ' ' + message : message); msg.append(''); msg.prependTo('.noticePanel'); var myNotice = $('.noticePanel .notice').eq(0); myNotice.slideDown('slow'); if (!myNotice.find('a').length) { var myTime = new Timer(function() { removeNotice(myNotice); }, 10000); myNotice.mouseenter(function() { myTime.pause(); }).mouseleave(function() { myTime.resume(); }); } } function removeNotice(notice) { notice.slideUp('slow', function() { $(this).remove(); }); } function addSpaces(number) { if (number.length > 3) { var mod = number.length % 3; var output = (mod > 0 ? (number.substring(0, mod)) : ''); for (i = 0; i < Math.floor(number.length / 3); i++) { if ((mod == 0) && (i == 0)) output += number.substring(mod + 3 * i, mod + 3 * i + 3); else output += ' ' + number.substring(mod + 3 * i, mod + 3 * i + 3); } return (output); } else { return number; } } function resizeIframe() { $('iframe').each(function() { $(this).height($(this).parent().width() / 1.77777); }); } function slideToogle(block, cache) { $(block).stop().slideToggle('slow', function() { if (cache) { if ($(this).css('display') == 'none') $.cookie(cache, 1, { expires: 365, path: '/' }); else $.cookie(cache, 0, { expires: 0, path: '/' }); } }); } function showTrailer(code) { $('body').append('
'); var w = $(window).width() - 40; if ($('.trailer_frame').width() > w) { $('.trailer_frame').height(w / ($('.trailer_frame').width() / $('.trailer_frame').height())).width(w).css({ 'margin-left': 0 - w / 2 }); } $('.trailer_frame').animate({ opacity: 1, top: $(window).height() / 2 - $('.trailer_frame').height() / 2 }, 'slow', function() { $(this).children('.iframe').append(''); }); } function checkFilter(label) { var id = 'sel_' + label.attr('for'); if ($('#' + id).length && label.hasClass('checked')) $('#' + id).remove(); else if (!$('#' + id).length && !label.hasClass('checked')) label.parents('.filterOptions').find('.selected').append('' + label.text() + ' '); if (label.parents('.filterOptions').find('.selected span').length) label.parents('.filterOptions').find('.selected').show().prev('.any').hide(); else label.parents('.filterOptions').find('.selected').hide().prev('.any').show(); } function uncheckFilter(label) { if (label.parent().find('span').length <= 1) label.parent().hide().prev('.any').show(); $('label[for="' + label.attr('id').substr(4) + '"]').trigger('click'); label.remove(); } function doSubscribe(id) { $.post('/engine/ajax/subscribe.php', { id: id }, function(data) { data = JSON.parse(data); noticePush(data.msg); if (data.error) return; else if (data.action) $('.subscrButton').html('Unsubscribe'); else $('.subscrButton').html('Subscribe'); }); } function userRate(go, id) { ShowLoading(''); $.post('/engine/ajax/user_rating.php', { go_rate: go, user_id: id }, function(data) { HideLoading(''); if (data.error) noticePush(data.errorinfo); else if (data.ok) { var plus = Number($('.vote-num-id-' + id).text()), minus = Number($('.vote-num-minus-id-' + id).text()); if (data.ok == 1 && go == 'plus') plus += 1; else if (data.ok == 1 && go == 'minus') minus += 1; else if (data.ok == 2 && go == 'plus') { plus += 1; minus -= 1; } else if (data.ok == 2 && go == 'minus') { plus -= 1; minus += 1; } $('.vote-num-id-' + id).html(plus); $('.vote-num-minus-id-' + id).html(minus); var percent_plus = Math.round(plus * 100 / (plus + minus)), percent_minus = 100 - percent_plus; $('.ratingPlus').animate({ width: percent_plus + '%' }, 'slow'); $('.ratingMinus').animate({ width: percent_minus + '%' }, 'slow'); $('.ratings').html(percent_plus + '%' + '' + percent_minus + '%'); $('.ratingBar').removeClass('free'); } }, 'json'); } function updateAvatar() { var image = new FormData($('#dle-content form').get(0)); $.ajax({ url: '/engine/ajax/avatar.php', type: 'post', contentType: false, processData: false, data: image, dataType: 'json', success: function(json) { if (json.error) noticePush(json.msg); else { if ($('.leftCol .noAvatar').length) $('.leftCol .noAvatar').replaceWith(''); else $('.leftCol .avatar > img').attr({ src: json.src }); $('.leftCol .avatar > ul li').eq(1).css({ 'display': 'list-item' }); $('.miniprofile .avatar img').attr({ src: json.src }).parent().addClass('radius'); if ($('form[name="registration"]').length) $('form[name="registration"]').submit(); } } }); } function delAvatar() { DLEconfirm('Are you sure you want to delete this profile picture?', 'Delete Picture?', function() { $.post('/engine/ajax/avatar.php', { del: true }, function(data) { $('.leftCol .avatar > img').replaceWith(data); $('.miniprofile .avatar img').replaceWith(data.replace('_full', '')).parent().removeClass('radius'); $('.leftCol .avatar > ul li').eq(1).hide(); }); }); } function deleteProfile() { DLEconfirm('Are you sure you want to delete your profile from website? The profile will be deleted irrevocably.', 'Delete Profile?', function() { window.location = '/index.php?action=logout&subaction=delpage'; }); } function changePass() { var pass = ['current', 'new', 'confirm']; for (i = 0; i < pass.length; i++) { pass[i] = $('#' + pass[i] + '_password').val(); if (!pass[i]) return noticePush('Fill in all the fields'); } if (pass[1].length < 6) return noticePush('The password must contain at least 6 characters'); else if (pass[1].length > 72) return noticePush('The password must contain no more than 72 characters'); else if (pass[1] !== pass[2]) return noticePush('New passwords do not match'); $.post('/engine/ajax/password.php', { pass: pass.join(',') }, function(json) { noticePush(json.msg); if (!json.error) { closeWindow('#changePassword'); var pass = ['current', 'new', 'confirm']; for (i = 0; i < pass.length; i++) $('#' + pass[i] + '_password').val(''); } }, 'json'); } function addIgnore(id, text) { if (text) { DLEconfirm(text, 'Block User?', function() { ShowLoading(''); $.get(dle_root + "engine/ajax/ignore.php", { id: id, action: "add_ignore" }, function(data) { HideLoading(''); noticePush(data); return false; }); }); } else { ShowLoading(''); $.get(dle_root + "engine/ajax/ignore.php", { id: id, action: "add_ignore" }, function(data) { HideLoading(''); noticePush(data); return false; }); } } function delIgnore(id, text) { DLEconfirm(text, 'Unblock User?', function() { ShowLoading(''); $.get(dle_root + "engine/ajax/ignore.php", { id: id, action: "del_ignore" }, function(data) { HideLoading(''); $("#dle-ignore-list-" + id).slideUp('slow', function() { $(this).remove(); }); noticePush(data); return false; }); }); } function doFriend(id, action, button) { ShowLoading(''); $.post('/engine/ajax/friends.php', { action: action, id: id }, function(json) { HideLoading(''); noticePush(json.msg); if (!json.error && $(button).length) { $(button).attr({ "onclick": "doFriend('" + id + "', '" + (action == 'send' ? 'cancel' : action == 'cancel' ? 'send' : action == 'confirm' ? 'unfriend' : 'confirm') + "', this)" }); if ($(button).hasClass('roundbutton') && (action == 'send' || action == 'confirm')) $(button).text(action == 'send' ? 'Cancel Request' : 'Unfriend').removeClass('roundRed').addClass('roundBorder roundBorderGray roundGraycolor'); else if ($(button).hasClass('roundbutton')) $(button).text(action == 'cancel' ? 'Send Request' : 'Confirm Request').removeClass('roundBorder roundBorderGray roundGraycolor').addClass('roundRed'); else if ($('.tableTabs').length) { $(button).parents('tr').fadeOut('slow', function() { $(this).remove(); }); } else $(button).fadeOut('fast', function() { $(this).remove(); }); } }, 'json'); } function removeDialog(user) { if ($.cookie('dialogs')) { dialogs = JSON.parse($.cookie('dialogs')); delete dialogs[user]; dialogs = JSON.stringify(dialogs); $.cookie('dialogs', dialogs, { expires: 1, path: '/' }); $('.dialogView .list .item svg').each(function() { if ($(this).attr('onclick') == 'removeDialog(\'' + user + '\')') { if ($(this).parent().hasClass('active')) return window.location = '/pm/'; $(this).parent().fadeOut('slow', function() { $(this).remove(); }); } }); } } function resizeMsg() { if ($('.footer').css('opacity') == '0') $('.footer').animate({ opacity: 1 }, 'fast'); var msg = $('.dialogView .messages'), top = msg.offset().top, height = msg.outerHeight(), bottom = $('body').height() - (top + height); if ($('body').height() < $(window).height() && height + $(window).height() - $('body').height() > 300) msg.height(height + $(window).height() - $('body').height()); else if ($(window).height() - top - bottom > 300) msg.height($(window).height() - top - bottom); else msg.height(300); msg.jScrollPane(); if (msg.find('.message').length) { var msgApi = msg.data('jsp'); msgApi.scrollToBottom('slow') } } function delDialog(uid) { DLEconfirm('Recover deleted data can not be.', 'Delete Dialog?', function() { ShowLoading(''); $.post("/engine/ajax/dialogs.php", { uid: uid, action: "del_dialog" }, function(data) { HideLoading(''); $("#dialog_" + uid + " td").fadeOut('slow', function() { $(this).parent().remove(); }); noticePush('Dialog successfully removed'); }); }); } function footerFix() { if ($(window).height() > $('body').outerHeight()) { if (!$('body').hasClass('footerFix')) $('body').addClass('footerFix'); $('body').css({ 'padding-bottom': $('.footer').height() }); } else { $('body').removeClass('footerFix').removeAttr('style'); } if ($('.footer').css('opacity') == '0') $('.footer').animate({ opacity: 1 }, 'fast'); } function togglemenu(action) { var menu = menu = $('.header .menuSlide').css('position') == 'fixed' ? $('.header .menuSlide') : $('.header .menuHide'); if (menu.css('position') !== 'fixed') return; if (action == 'show') { $('body').addClass('menuOpened xOverflow'); $('.overlayMenu').stop().fadeIn(200); } else { $('body').removeClass('menuOpened xOverflow'); $('.overlayMenu').stop().fadeOut(200); } } function side() { if ($('.sidebarFilter').length) { if ($('.sidebar').css('float') == 'none' && !$('.sidebar').parents('.marginPage').length) { var side = $('.sidebar').clone(); $('.sidebar').remove(); $('.tabLine').after(side); } else if ($('.sidebar').css('float') !== 'none' && $('.sidebar').parents('.marginPage').length) { var side = $('.sidebar').clone(); $('.sidebar').remove(); $('.marginPage').after(side); } } } $(document).ready(function() { if (window.location.hash) { if (window.location.hash !== '#_=_') { var elem; if ($(window.location.hash).length) elem = $(window.location.hash); else elem = $('[name="' + window.location.hash.substr(1) + '"]'); if (elem.length) { setTimeout(function() {; $('html, body').stop().animate({ scrollTop: elem.offset().top - $('.header').height() - 20 }, 'fast', 'linear', function() { elem.animate({ opacity: 0.5 }, 'fast', function() { $(this).animate({ opacity: 1 }, 'fast'); }); }); }, 500); } } } $('input[type="checkbox"]').each(function(i) { var my = $(this), name = my.attr('id'), label; if (!name) { my.attr({ 'id': 'checkbox_' + i }); name = my.attr('id'); } label = $('label[for="' + name + '"]'); if (!label.length) { if (my.parent('label').length) label = my.parent('label').attr({ 'for': name }); else { my.after(''); label = $('label[for="' + name + '"]'); } } if (label.length) { my.remove(); var svg; if (label.data('icon') == 'icon-close') svg = ''; else if (my.attr('checked')) svg = ''; else svg = ''; if (my.attr('checked')) label.addClass('checked'); label.html(label.html().trim()); my.prependTo(label.addClass('checkbox').prepend(svg)); } }); $('form').on('reset', function() { $(this).find('input').each(function() { if ($(this).attr('type') == 'checkbox') $(this).prop('checked', false).removeAttr('checked'); else if ($(this).attr('name') == 'story') $(this).removeAttr('value'); }); $(this).find('select').each(function() { $(this).find('option').removeAttr('selected'); $(this).find('option').eq(0).prop('selected', true); $(this).trigger('change'); }); $(this).find('label.checkbox').each(function() { $(this).removeClass('checked'); var icon = $(this).parent().children('.icon'); if (!$(this).data('icon')) { if (icon.hasClass('icon-checkbox-checked')) icon.replaceWith(''); } }); $('.filterOptions .selected span').remove(); $('.filterOptions .selected').hide(); $('.filterOptions .any').show(); setTimeout(function() { $('.sliderRange').each(function() { var input = $(this).prev().children('input'), min = $(this).slider('option', 'min'), max = $(this).slider('option', 'max'); input.val(min).next('input').val(max); $(this).slider('values', [min, max]); }); }, 1); }); if ($('.notice.hidden').length) { if (!$('.noticePanel').length) $('body').append('
'); $('.notice.hidden').each(function(i) { $('.noticePanel').prepend($(this).clone().removeClass('hidden').hide().delay(i * 1000).slideDown('slow')); $(this).remove(); }); $('.noticePanel .notice').each(function(i) { if (!$(this).find('a').length) { var notice = $(this); var timeout = new Timer(function() { removeNotice(notice); }, 10000 + (i * 1000)); $(this).mouseenter(function() { timeout.pause(); }).mouseleave(function() { timeout.resume(); }); } }); } $('.tabLine').each(function() { var wand = $(this).children('.tabWand'), active = $(this).children('.tabUl').children('.active'), left = active.offset().left - $('.tabLine').offset().left; if (!active.length) active = $(this).children('.tabUl').children('li').eq(0).addClass('active'); wand.css({ width: active.width(), left: left }); function tabUl(item) { left = $(item).offset().left - $('.tabLine').offset().left; if ($(item).hasClass('active') || $(item).parent('li').hasClass('active')) return; $(item).parent().children('.active').removeClass('active'); $(item).addClass('active'); wand.animate({ width: $(item).width(), left: left }, 200); var index = $(item).index(), tabCont = $($(item).parent('.tabUl').data('tabs')), tabTab = $($(item).parent('.tabUl').data('tab')); ShowLoading(''); if ($(item).parent('li').length || $(item).children('a').length) { var href = $(item).parent('li').length ? $(item).attr('href') : $(item).children('a').attr('href'); HideLoading(''); return window.location = href; } if (!$('.tabUl').data('load')) { var tab = $(tabCont).find(tabTab).eq(index); $(tabCont).find(tabTab).hide(); tab.show(); HideLoading(''); if ($('#searchUsers').length && $(item).index() == 1 && !$('#order').length) { $('#searchUsers').append(''); $('#searchUsers').trigger('change'); } else if ($('#searchUsers').length && $(item).index() !== 1) { $('#searchUsers #order').remove(); $('#searchUsers').trigger('change'); } return; } $.post('/engine/ajax/load_posts.php', { cat: index == 1 || index == 3 ? 1 : index == 2 ? 2 : index == 4 ? 3 : 0, xf: index == 3 ? 'genre|%Animation%' : '', nav: 1 }, function(data) { var tab = $(tabCont).find(tabTab).eq(index); HideLoading(''); $(tabCont).find(tabTab).hide(); if (tab.html() == '') tab.html(data); tab.show(); }); } $(this).children('.tabUl').children('li').click(function() { tabUl(this); }); $(this).children('.tabUl').children('li').children('a').click(function() { tabUl(this); return false; }); if ($(this).children('.tabUl').find('li').length) { var sel = $(''); if ($(this).hasClass('header_tabs')) $(this).append(sel); else $(this).after(sel); $(this).find('li').each(function(i) { if ($(this).children('a').length) sel.append(''); }); sel.change(function() { var a = $(this).parent().children('ul').find('li').eq($(this).val()).children('a'); if (a.length) window.location = a.attr('href'); }); }); $('select').each(function(i) { var id = $(this).attr('id') ? $(this).attr('id') : 'selectImult_' + i, t = $(this); $(this).attr({ 'id': id }).after('
').next('.selectImult').append('').css({ 'min-width': t.css('width') ? t.css('width') : t.outerWidth() }).append('
').prev('select').hide().find('option').each(function() { var v = $(this).html().replace(/(\d+)$/, '$1'); if (t.val() == $(this).val()) { $(this).parent().next('.selectImult').prepend('
' + v + '
').children('.options').append('
' + v + '
'); } else $(this).parent().next('.selectImult').children('.options').append('
' + v + '
'); }); }); $('#carousel').owlCarousel({ loop: true, margin: 33, nav: true, responsive: { 1359: { items: 9, slideBy: 8 }, 1199: { items: 8, slideBy: 7 }, 950: { items: 6, slideBy: 5 }, 800: { items: 5, slideBy: 4 }, 648: { items: 4, slideBy: 3 }, 540: { items: 3, slideBy: 2 }, 500: { items: 4, slideBy: 3 }, 380: { items: 3, slideBy: 2 }, 0: { items: 2, slideBy: 2 } } }); $('.flipSlider').owlCarousel({ margin: 20, nav: true, responsive: { 1359: { items: 8, slideBy: 7, loop: $('.flipSlider .smallItem').length >= 8 ? true : false }, 1199: { items: 7, slideBy: 6, loop: $('.flipSlider .smallItem').length >= 7 ? true : false }, 999: { items: 5, slideBy: 4, loop: $('.flipSlider .smallItem').length >= 5 ? true : false }, 940: { items: 7, slideBy: 6, loop: $('.flipSlider .smallItem').length >= 7 ? true : false }, 800: { items: 6, slideBy: 5, loop: $('.flipSlider .smallItem').length >= 6 ? true : false }, 420: { items: 4, slideBy: 3, loop: $('.flipSlider .smallItem').length >= 4 ? true : false }, 0: { items: 3, slideBy: 2, loop: $('.flipSlider .smallItem').length >= 3 ? true : false } } }); $('.tabsList').each(function() { var cont = $(this).data('for'), tabs = $(this).find('li'); if (!tabs.length || !$(cont).length) return; tabs.eq(0).addClass('active'); $(cont).eq(0).show(); tabs.each(function() { $(this).click(function() { if ($(this).hasClass('active')) return; $('.tabCont').html($('.tabCont').html()); tabs.not($(this)).removeClass('active'); $(this).addClass('active'); $(cont).hide(); $(cont).eq($(this).index()).show(); }); }); }); $('.textSpoiler').each(function() { var h = $(this).data('height') || 60; if ($(this).children('.spoilerBody').height() > h) { $(this).addClass('closed').css({ height: h }).after('
Show more '); } }); $('.comments-tree-item').each(function() { if ($(this).children('.comments-tree-list').length || $(this).next('.comments-tree-item').length) $(this).children('div').children('.mcomment').append(''); if ($(this).prev().children('.comments-tree-list').length && $(this).parents('.comments-tree-item').length) $(this).children('div').children('.mcomment').append(''); if ($(this).index() == 0 && $(this).parents('.comments-tree-list').length > 1) $(this).children('div').children('.mcomment').append(''); }); $('#news_set_sort').prepend('
Filter ' + $('#news_set_sort li[class]').text() + '
'); $('.filterOptions .checkbox.checked').each(function() { $(this).trigger('click').trigger('click'); }); $(".toggleMenu").swipe({ swipeRight: function(event, direction, distance, duration, fingerCount) { var menu = $('.header .menuSlide').css('position') == 'fixed' ? '.header .menuSlide' : '.header .menuHide'; $(menu).addClass('transition'); togglemenu('show'); $(menu + ', .toggleMenu').removeAttr('style'); }, swipeStatus: function(event, phase, direction, distance, duration, fingers, fingerData) { var x = typeof(event.clientX) !== 'undefined' ? event.clientX : event.changedTouches[0].clientX, menu = $('.header .menuSlide').css('position') == 'fixed' ? '.header .menuSlide' : '.header .menuHide'; if (phase == $.fn.swipe.phases.PHASE_START) { start = x; $(".toggleMenu").css({ width: '100%', 'z-index': 9999 }); $(menu).removeClass('transition'); } else if (phase == $.fn.swipe.phases.PHASE_CANCEL) { $(menu).addClass('transition').removeAttr('style'); $(".toggleMenu").removeAttr('style'); } else { if ((0 - (260 - x - start)) >= -260 && (0 - (260 - x - start)) <= 0) $(menu).css({ 'transform': 'translate(' + (0 - (260 - x - start)) + 'px, 0)' }); } }, threshold: 60 }); var allowHide = true; $(".header .menuHide").swipe({ swipeLeft: function(event, direction, distance, duration, fingerCount) { var menu = $('.header .menuSlide').css('position') == 'fixed' ? '.header .menuSlide' : '.header .menuHide'; if ($(event.srcElement).parents('.search-form').length) $('#story').focus(); else $('#story').blur(); if (allowHide === true) { $(menu).addClass('transition'); togglemenu('hide'); } $(menu + ', .toggleMenu').removeAttr('style'); }, swipeStatus: function(event, phase, direction, distance, duration, fingers, fingerData) { var x = typeof(event.clientX) !== 'undefined' ? event.clientX : event.changedTouches[0].clientX, menu = $('.header .menuSlide').css('position') == 'fixed' ? '.header .menuSlide' : '.header .menuHide'; if ($(event.srcElement).parents('.search-form').length) $('#story').focus(); else $('#story').blur(); if (phase == $.fn.swipe.phases.PHASE_START) { start = x; $(menu).removeClass('transition'); allowHide = true; } else if (phase == $.fn.swipe.phases.PHASE_CANCEL) { $(menu).addClass('transition').removeAttr('style'); $(".toggleMenu").removeAttr('style'); } else { if (allowHide === true && x - start >= -260 && x - start <= 0) $(menu).css({ 'transform': 'translate(' + (x - start) + 'px, 0)' }); } }, threshold: 60, allowPageScroll: 'vertical' }); $('.menuHide').scroll(function(event) { $(this).removeAttr('style'); allowHide = false; }); $('.shortItem .poster, .shortItem .info').click(function(e) { var item = $(this).parents('.shortItem'), body = $(this).parents('.itemBody'); e = e || window.event; var target = e.target || e.srcElement; if ($(this).parents('.topmovies').length || item.hasClass('opened') || $(this).parents('.shortItem').hasClass('listItem') || $(target).hasClass('roundbutton') || $(target).parents('.roundbutton').length) return; $('.shortItem').not(item).removeClass('opened leftSide').removeAttr('style'); item.addClass('opened'); var width = body.outerWidth(), off = body.offset().left; if ($('.moviesList').width() + $('.moviesList').offset().left - off + 10 < width) { var lit = $(this).parents('.moviesList').find('.shortItem').not('.opened'), w = lit.width(); lit = w * 4; lit = $(this).parents('.moviesList').width() - lit; if (lit >= w) item.addClass('leftSide'); else item.css({ left: -(item.offset().left - $(this).parents('.moviesList').offset().left - item.css('margin-left').replace("px", "")) }); } body.append(''); }); if ($('.dialogView .messages').length) { resizeMsg(); } else footerFix(); side(); resizeIframe(); }); $(document).on('keydown keyup blur focus', '.header #story', function() { var link = $(this).next('a'); clearTimeout(hstime); if ($(this).val() !== '' && link.css('display') == 'block') { link.stop().fadeOut('fast'); link.next('button').stop().fadeIn('fast'); } else if ($(this).val() == '' && link.css('display') == 'none') { link.stop().fadeIn('fast'); link.next('button').stop().fadeOut('fast'); $('#searchsuggestions').stop().fadeOut('fast'); } }).on('blur', '.header #story', function() { clearTimeout(hstime); if ($(this).val() == '') hideSearch(); else hstime = setTimeout(function() { hideSearch(); }, 800); }).on('click', '.header .search-form button, .header .search-form .icon-close', function() { $('.header #story').val('').trigger('focus'); }).on('click', '.header .icon-search', function() { if ($('.header .search-form form').css('display') == 'none') showSearch(); else if ($('.header #story').val() == '') hideSearch(); else $('.header .search-form form').submit(); }).on('click', '.header .menu > li > span, .header .notifications .logbutton', function() { var li = $(this).parent(), activeNotify = $('.notifications.active'); if (!li.children('.drop').length) return; else if (li.hasClass('active')) { li.removeClass('active zIndex').find('.drop-body').hide(); if (li.hasClass('notifications')) li.find('.icon-notification-click').removeClass('icon-notification-click').addClass('icon-notification').html(''); } else { $('.header .zIndex').removeClass('zIndex'); setTimeout(function() { $('.header .menu li.active, .header .notifications.active').not(li).removeClass('active').find('.drop-body').hide() }, li.hasClass('relative') || li.hasClass('notifications') || activeNotify.length ? 0 : 200); li.addClass('active zIndex').find('.drop-body').fadeIn('fast'); if (li.hasClass('notifications')) { li.find('.icon-notification').removeClass('icon-notification').addClass('icon-notification-click').html(''); li.find('.noticeList').jScrollPane(); } } }).on('click', function(e) { e = e || window.event; var target = e.target || e.srcElement; if (!$(target).parents('.header .menu li.active').length && $('.header .menu li.active').length) $('.header .menu li.active').removeClass('active').find('.drop-body').hide(); if (!$(target).parents('.header .notifications.active').length && $('.header .notifications.active').length && $(target).get(0).tagName !== 'path') { $('.header .notifications.active').removeClass('active').find('.drop-body').hide(); $('.header .notifications .icon-notification-click').removeClass('icon-notification-click').addClass('icon-notification').html(''); } if ((!$(target).parents('.is_logged').length && !$(target).hasClass('logbutton is_logged')) && $('.is_logged.opened').length) $('.is_logged.opened').removeClass('opened').find('ul.reset').stop().slideUp(120); if (!$(target).parents('.selectImult').length && !$(target).hasClass('selectImult') && $('.selectImult.opened').length) $('.selectImult.opened').removeClass('opened'); if (!$(target).parents('.filterOptions').length && !$(target).hasClass('optionSet') && $('.optionSet.opened').length) $('.optionSet.opened').removeClass('opened').stop().fadeOut('fast'); }).on('click', '.header .notifications .logbutton', function(e) { var nPane = $(this).parent(); if (nPane.find('.icon-sad-face').length) return; if (!nPane.find('ul').length && !nPane.find('.notFound').length) { $.post('/engine/ajax/notifications.php', {}, function(data) { var counter = nPane.find('.counter'), val = Number(counter.text()); nPane.find('.drop-title').after(data).next('.noticeList').jScrollPane().find('.unread').each(function() { val--; }); counter.text(val); if (!val) counter.remove(); else { nPane.find('.view_all').append('+' + val + ''); } }); } }).on('click', '.overlayWindow, .headWindow .icon-close', function() { closeWindow('#' + $(this).parents('.popupWindow').attr('id')); }).on('click', '.noticePanel .notice', function() { removeNotice($(this)); }).on('click', 'select.textWindow', function() { $(this).toggleClass('opened'); }).on('blur', 'select.textWindow', function() { $(this).removeClass('opened'); }).on('click', '.selectImult', function() { $('.selectImult').not($(this)).removeClass('opened'); var top = Math.round($(this).offset().top - $(window).scrollTop()), bottom = Math.round($(window).height() - top - $(this).outerHeight()), padding = $(this).children('.options').css('border-top-width').replace("px", "") * 2; if (bottom >= $(this).children('.options').outerHeight() && $(this).children('.options').outerHeight() < 300) pos = ['100%', 'auto', 'auto']; else if (top >= $(this).children('.options').outerHeight() && $(this).children('.options').outerHeight() < 300) pos = ['auto', '100%', 'auto']; else if (bottom > 300) pos = ['100%', 'auto', 300]; else if (top > 300) pos = ['auto', '100%', 300]; else if (bottom > top) pos = ['100%', 'auto', bottom]; else pos = ['auto', '100%', top]; $(this).toggleClass('opened').children('.options').css({ top: pos[0], bottom: pos[1], height: pos[2] - padding }); $(this).children('.options').jScrollPane(); var api = $(this).children('.options').data('jsp'); if ($(this).find('.option.active').length) api.scrollTo(0, $(this).find('.option.active').offset().top - $(this).children('.options').offset().top - ($(this).children('.options').height() / 2)); }).on('click', '.selectImult .option', function() { $(this).addClass('active').parent().children('.active').not($(this)).removeClass('active').parents('.selectImult').children('.activeOption').html($(this).html()); $('#' + $(this).parents('.selectImult').data('select') + ' option').eq($(this).index()).prop('selected', true).parent().trigger('change'); }).on('change', 'select', function() { var imult = $('.selectImult[data-select="' + $(this).attr('id') + '"]'); if (imult.length) imult.find('.active').removeClass('active').parent().find('.option').eq(this.selectedIndex).addClass('active').parents('.selectImult').children('.activeOption').html(imult.find('.active').text().replace(/(\d+)$/, '$1')); }).on('click', '.logbutton.is_logged', function(e) { e = e || window.event; var target = e.target || e.srcElement; if ($(target).parents('ul.reset').length) return; var i = $(this), ul = i.find('ul.reset'); if (!i.hasClass('opened')) i.addClass('opened'); ul.stop().slideToggle(ul.css('display') == 'block' ? 120 : 200, function() { if ($(this).css('display') == 'block' && !i.hasClass('opened')) i.addClass('opened'); else if ($(this).css('display') == 'none' && i.hasClass('opened')) i.removeClass('opened'); }); }).on('click', '.shortItem .icon-close', function() { $('.shortItem').removeClass('opened leftSide').removeAttr('style'); }).on('click', '.opened .itemBody .overlay, .shortItem.listItem .overlay', function() { window.location.href = $(this).parents('.itemBody').find('.info .fullWidth').attr('href'); }).on('click', '.list_toggle .icon', function() { if ($(this).parent('li').hasClass('active')) return; $(this).parents('.list_toggle').children('.active').not($(this).parent('li')).removeClass('active'); $(this).parent('li').addClass('active'); if ($(this).hasClass('icon-menu-list')) { $('.shortItem').addClass('listItem'); $.cookie('list_item', 1, { expires: 365, path: '/' }); } else { $('.shortItem.listItem').removeClass('listItem'); $.cookie('list_item', 0, { expires: 0, path: '/' }); } }).on('click', '.spoilerToggle', function() { var story = $(this).prev('.textSpoiler'), h = story.data('height') || 60; if (story.hasClass('closed')) { story.stop().animate({ height: story.children('.spoilerBody').height() }, 'fast', function() { $(this).removeClass('closed').next('.spoilerToggle').html($(this).next('.spoilerToggle').html().replace('Show more', 'Show less')); }); } else { story.stop().animate({ height: h }, 'fast', function() { $(this).addClass('closed').next('.spoilerToggle').html($(this).next('.spoilerToggle').html().replace('Show less', 'Show more')); }); } return false; }).on('click', '.fullMovie .about .rating a', function() { var interval; interval = setInterval(function() { if ($('.header #loading-layer').length) return; else clearInterval(interval); var rate = $('.fullMovie .about .rating .ignore-select'), rates = []; rates[0] = Number(rate.eq(0).text()); rates[1] = Number(rate.eq(1).text()); rates[0] = Math.round(rates[0] * 100 / (rates[0] + rates[1])); rates[1] = 100 - rates[0]; if ($('.fullMovie .ratingBar.free').length) $('.fullMovie .ratingBar.free').removeClass('free'); $('.fullMovie .about .ratings').html(rates[0] + '% ' + rates[1] + '%'); $('.fullMovie .about .ratingPlus').stop().animate({ width: rates[0] + '%' }, 'slow'); $('.fullMovie .about .ratingMinus').stop().animate({ width: rates[1] + '%' }, 'slow'); }, 100); }).on('click', '.ui-widget-overlay', function() { $('.ui-dialog').each(function() { var id = $(this).find('.ui-dialog-content').attr('id'); $('#' + id).dialog('close'); }); }).on('click', '.topmovies td', function() { window.location = $(this).parent().find('a').attr('href'); }).on('click', '.mcomment .message', function(e) { if ($(this).parents('.editable').length || !$('.mass_comments_action').length) return; e = e || window.event; var target = e.target || e.srcElement; if ($(target).get(0).tagName.toLowerCase() !== 'a' && !$(target).hasClass('checkbox') && !$(target).hasClass('bb-editor') && !$(target).parents('.bb-editor').length) { $(this).toggleClass('active'); if ($('.mcomment .message.active').length) $('.mass_comments_action').stop().fadeIn('slow'); else $('.mass_comments_action').stop().fadeOut('slow'); $(this).find('.checkbox').trigger('click'); } }).on('click', '.trailer_frame .icon-close, .trailer_frame .overlay', function() { $(this).parent().find('iframe').remove(); $('.trailer_frame').animate({ opacity: 0, top: 0 }, function() { $(this).remove(); }); }).on('click', '.smallItem', function(e) { e = e || window.event; var target = e.target || e.srcElement; if ($(target).get(0).tagName.toLowerCase() == 'a' || $(target).hasClass('shortRating') || $(target).parents('.shortRating').length) return; window.location = $(this).find('.title a').attr('href'); }).on('click', '#news_set_sort .button', function() { $(this).next('ul').toggleClass('active'); }).on('click', '.filterOptions .label, .filterOptions .any', function() { $('.filterOptions .optionSet').removeClass('opened').stop().fadeOut('fast'); $(this).parents('.filterOptions').find('.optionSet').addClass('opened').stop().fadeIn('fast', function() { $(this).find('.optionOverflow').jScrollPane(); }); }).on('click', '.filterOptions .close', function() { $('.filterOptions .optionSet').removeClass('opened').stop().fadeOut('fast'); }).on('click', '.filterOptions .optionSet label', function() { checkFilter($(this)); }).on('click', '.filterOptions .selected span', function() { uncheckFilter($(this)); }).on('click', '.filterButton', function() { var filter = $('.absFilter'); $(this).toggleClass('active'); if (filter.css('display') == 'block') filter.stop().animate({ opacity: 0, top: $('.filterButton').outerHeight() + $('.filterButton').offset().top - $('.pageContent').offset().top }, 'slow', function() { $(this).hide() }); else filter.show().stop().animate({ opacity: 1, top: $('.filterButton').outerHeight() + $('.filterButton').offset().top - $('.pageContent').offset().top + 25 }, 'slow'); }).on('change', '#updateAvatar #new_avatar', function() { if (this.files && this.files[0]) { var reader = new FileReader(); reader.onload = function(e) { var image = new Image(); image.src = e.target.result; image.onload = function() { var myWidth = this.width, myHeight = this.height; if (myWidth < 200 || myHeight < 200) { noticePush('The minimal resolution of the image must be 200x200 pixels'); return false; } var newSize = $('#imgPreview_small').height(); $('#imgPreview_small').html('
'); $('#imgPreview').html('').children('img').each(function() { $(this).on('load', function() { image = $(this); if (myWidth > myHeight / 1.4) { var my_x1 = (myWidth - myHeight / 1.4) / 2, my_x2 = myHeight / 1.4 + my_x1, my_y1 = 0, my_y2 = myHeight; } else if (myWidth < myHeight / 1.4) { var my_x1 = 0, my_x2 = myWidth, my_y1 = (myHeight - myWidth * 1.4) / 2, my_y2 = myWidth * 1.4 + my_y1; } else { var my_x1 = 0, my_x2 = myWidth, my_y1 = 0, my_y2 = myHeight; } setTimeout(function() { var preview = image.imgAreaSelect({ handles: true, imageWidth: myWidth, imageHeight: myHeight, minHeight: 200, minWidth: 200, x1: my_x1, y1: my_y1, x2: my_x2, y2: my_y2, borderColor1: '#ec164f', borderOpacity: 1, borderWidth: 1, instance: true, parent: $('#imgPreview'), onInit: previewAvatar, onSelectStart: previewAvatar, onSelectChange: previewAvatar, onSelectEnd: previewAvatar }); $(window).resize(function() { preview.update(); }); $(window).scroll(function() { preview.update(); }); }, 600); function previewAvatar(img, sel) { var preview = $('#imgPreview img').imgAreaSelect({ instance: true }); if (!sel.height) preview.setSelection(my_x1, my_y1, my_x2, my_y2); preview.setOptions({ minHeight: (sel.width > 200 ? sel.width : 200), maxHeight: sel.width * 1.4, minWidth: (sel.height / 1.4 > 200 ? sel.height / 1.4 : 200), maxWidth: sel.height }); var sw = sel.width, sh = sel.height; if (sel.width >= sel.height) { sel.height = newSize * (sel.height / sel.width); sel.width = newSize; } if (sel.width < sel.height) { sel.width = newSize * (sel.width / sel.height); sel.height = newSize; } var scale = myWidth / sw; var scaleX = sel.width / sw; var scaleY = sel.height / sh; $('#minPrev').css({ width: sel.width, height: sel.height, 'background-size': Math.round(scaleX * myWidth) + 'px ' + Math.round(scaleY * myHeight) + 'px', 'background-position': (-Math.round(scaleX * sel.x1)) + 'px ' + (-Math.round(scaleY * sel.y1)) + 'px' }); var coord = preview.getSelection(); if (!$('input[name="image_width"]').length) { $('#imgPreview').append('').append('').append('').append('').append('').append(''); } else if (coord.width && coord.height) { $('input[name="image_width"]').val(coord.width); $('input[name="image_height"]').val(coord.height); $('input[name="image_x1"]').val(coord.x1); $('input[name="image_x2"]').val(coord.x2); $('input[name="image_y1"]').val(coord.y1); $('input[name="image_y2"]').val(coord.y2); } if ($(window).width() <= 1024) updateAvatar(); } }); }); closeWindow('#updateAvatar'); if ($(window).width() > 1024) openWindow('#submitAvatar'); }; } reader.readAsDataURL(this.files[0]); } }).on('click', '#deleteImage', function() { closeWindow('#submitAvatar'); openWindow('#updateAvatar'); $('#imgPreview').html(''); $('#new_avatar').val(''); }).on('click', '.selectImult[data-select="xf_month_birth"] .option', function() { $('.selectImult[data-select="xf_day_birth"] .option').show(); if ($(this).index() == 2) { $('.selectImult[data-select="xf_day_birth"] .option:eq(29), .selectImult[data-select="xf_day_birth"] .option:eq(30)').hide(); if ($('.selectImult[data-select="xf_day_birth"] .option:eq(29)').hasClass('active') || $('.selectImult[data-select="xf_day_birth"] .option:eq(30)').hasClass('active')) { $('.selectImult[data-select="xf_day_birth"] .option:eq(28)').trigger('click'); $(this).parents('.selectImult').addClass('opened'); } } else if ($(this).index() == 4 || $(this).index() == 6 || $(this).index() == 9 || $(this).index() == 11) { $('.selectImult[data-select="xf_day_birth"] .option:eq(30)').hide(); if ($('.selectImult[data-select="xf_day_birth"] .option:eq(30)').hasClass('active')) { $('.selectImult[data-select="xf_day_birth"] .option:eq(29)').trigger('click'); $(this).parents('.selectImult').addClass('opened'); } } }).on('click', '.tableTabs a', function() { if ($(this).parent().hasClass('active')) return false; var url = $(this).attr('href'); ShowLoading(''); $('.tableTabs .active').removeClass('active'); $(this).parent().addClass('active'); $.get(url, {}, function(data) { HideLoading(''); $('#usersList').stop().slideUp('slow', function() { $(this).html($(data).find('#usersList').html()).stop().slideDown('slow', function() { history.pushState({ content: document.getElementById('dle-content').innerHTML }, '', url); }); }); $('.commCounter').html($(data).find('.commCounter').html()); if ($(data).find('#nextList').val()) $('#nextList').val($(data).find('#nextList').val()); else $('#nextList').val(''); }); return false; }).on('focus', '.searchBlock input', function() { var q = $(this).val(); clearTimeout(bstime); if (!$('.searchBlock').hasClass('focus')) { $('.searchBlock').addClass('focus'); if (q) $('#searchsuggestions').delay(300).fadeIn('slow'); } }).on('blur', '.searchBlock input', function() { if ($('.searchBlock').hasClass('focus')) { bstime = setTimeout(function() { $('.searchBlock').removeClass('focus'); $('#searchsuggestions').fadeOut('fast'); }, 600); } }).on('click', '.searchBlock .icon-close', function() { $(this).parent().children('input').val(''); }).on('keyup', '.searchBlock input', function() { var q = $(this).val(), id = $(this).attr('id'); if (q.length > 1) { clearTimeout(bstime); bstime = setTimeout(function() { if (usearch !== q) $.post('/engine/ajax/search_user.php', { friends: id == 'searchFriends' ? 1 : 0, pm: id == 'dialogSearch' ? 1 : 0, q: q }, function(data) { if (data !== $('#searchsuggestions').html()) { $('#searchsuggestions').remove(); $("body").append(""); $('#searchsuggestions').append(data).css({ 'position': 'absolute', width: $('.searchBlock').outerWidth(), top: 0, left: 0 }).fadeIn('slow').position({ my: "left top", at: "left bottom", of: ".searchBlock", collision: "fit flip" }); } else $('#searchsuggestions').stop().fadeIn('slow'); usearch = q; }); else $('#searchsuggestions').stop().fadeIn('slow'); }, 600); } else if (!q) { clearTimeout(bstime); $('#searchsuggestions').stop().fadeOut('slow'); } }).on('change', '#remember_me', function(e) { e = e || window.event; var target = e.target || e.srcElement; if (target.checked) $.cookie('remember', 1, { expires: 365, path: '/' }); else $.cookie('remember', 0, { expires: 0, path: '/' }); }).on('change', '#searchUsers', function() { var form = $(this); clearTimeout(usersfilter); usersfilter = setTimeout(function() { ShowLoading(''); var data = form.serialize(); $('#nextFilter').val(''); $.post(window.location, data, function(data) { $('#usersTable').html(''); $('#usersTable').html($(data).find('#usersTable').html()); if ($(data).find('#nextFilter').val()) $('#nextFilter').val($(data).find('#nextFilter').val()); }); HideLoading(''); }, 1000); }).on('click', '#resetFilter', function() { $('#searchUsers select').each(function() { if ($(this).find('option[selected]').length) $(this).find('option[selected]').prop('selected', true).trigger('change'); else $(this).children('option').eq(0).prop('selected', true).trigger('change'); }); $('#searchUsers input[type="checkbox"]').each(function() { $(this).prop('checked', false).trigger('change'); }); }).on('click', '.dialogs .dialog', function(e) { e = e || window.event; var target = e.target || e.srcElement; if ($(target).get(0).nodeName.toLowerCase() !== 'a' && $(target).get(0).nodeName.toLowerCase() !== 'svg' && !$(target).parents('svg').length && !$(target).parents('a').length) { window.location = $(this).children('.info').children('a').attr('href').replace('/user/', '/im/'); } }).on('click', '.dialogView .list .item', function(e) { if ($(this).hasClass('active')) return; e = e || window.event; var target = e.target || e.srcElement; if ($(target).get(0).nodeName.toLowerCase() !== 'svg' && !$(target).parents('svg').length) { window.location = '/im/' + $(this).data('target') + '/'; } }).on('change', 'label.checkbox input', function() { var icon = $(this).parent().children('.icon'); $(this).parent().toggleClass('checked'); if (!$(this).parent().data('icon')) { if (icon.hasClass('icon-checkbox-checked')) icon.replaceWith(''); else icon.replaceWith(''); } }); window.addEventListener('popstate', function(event) { if (event.state == null) return; document.getElementById('dle-content').innerHTML = event.state.content; }); history.replaceState({ content: document.getElementById('dle-content').innerHTML }, document.title, document.location.href); function nextFriends() { if (!$('#usersTable').length || !$('#nextList').val()) return; if ($(window).scrollTop() + $(window).height() + 200 > $('#usersTable td').eq($('#usersTable td').length - 1).offset().top) { var url = window.location.href.replace(/page\/\d+?\//, '') + 'page/' + $('#nextList').val() + '/'; $('#nextList').val(''); $.get(url, {}, function(data) { $('#usersTable').append($(data).find('#usersTable').html()); if ($(data).find('#nextList').val()) $('#nextList').val($(data).find('#nextList').val()); }); } } function nextUsers() { if (!$('#usersTable').length || !$('#nextFilter').val()) return; if ($(window).scrollTop() + $(window).height() + 200 > $('#usersTable td').eq($('#usersTable td').length - 1).offset().top) { var cstart = $('#nextFilter').val(); $('#nextFilter').val(''); $.post(window.location, $('#searchUsers').serialize() + '&cstart=' + cstart, function(data) { $('#usersTable').append($(data).find('#usersTable').html()); if ($(data).find('#nextFilter').val()) $('#nextFilter').val($(data).find('#nextFilter').val()); }); } } function nextNotices() { if (!$('#nextList').val()) return; if ($(window).scrollTop() + $(window).height() + 200 > $('.notificationPage .item').last().offset().top) { var cstart = $('#nextList').val(); $('#nextList').val(''); $.post(window.location, { cstart: cstart }, function(data) { $('.notificationPage').append($(data).find('.notificationPage').html()); var days = []; $('.notificationPage .date').each(function(i) { if ($.inArray($(this).text(), days) !== -1) $(this).remove(); else days[i] = $(this).text(); }); if ($(data).find('#nextList').val()) $('#nextList').val($(data).find('#nextList').val()); }); } } $(window).scroll(function() { nextFriends(); nextUsers(); nextNotices(); footerFix(); }).resize(function() { if ($('.dialogView .messages').length) resizeMsg(); resizeIframe(); footerFix(); side(); $('.jspScrollable').each(function() { $(this).data('jsp').reinitialise(); }); var opened = $('.shortItem.opened'); if (opened.length) { var width = opened.children('.itemBody').outerWidth(), off = opened.offset().left; var lit = opened.parents('.moviesList').find('.shortItem').not('.opened'), w = lit.width(); lit = w * 4; lit = opened.parents('.moviesList').width() - lit; if ($('.moviesList').width() + $('.moviesList').offset().left - off + 20 < width && lit >= w) opened.addClass('leftSide'); else if (lit < w) { opened.removeAttr('style').removeClass('leftSide'); opened.css({ left: -(opened.offset().left - opened.parents('.moviesList').offset().left - opened.css('margin-left').replace("px", "")) }); } else if (opened.hasClass('leftSide')) opened.removeClass('leftSide'); } var trailer = $('.trailer_frame'); if (trailer.length) { var w = $(window).width() - 40; if (trailer.width() > w || trailer.width() < 700) trailer.height(w / (trailer.width() / trailer.height())).width(w).css({ 'margin-left': 0 - w / 2, top: $(window).height() / 2 - trailer.height() / 2 }); else trailer.css({ width: 700, height: 394, 'margin-left': -350, top: $(window).height() / 2 - trailer.height() / 2 }); } }); $(function() { $('.filterBox .sliderRange').each(function() { var slider = $(this), min = 0, max = 10, step = 0.1; if (slider.attr('id') == 'sliderYear') { min = 1990; max = 2018; step = 1; } var input = slider.prev().children('input').eq(0); var val1 = input.val() || min, val2 = input.next('input').val() || max; slider.slider({ range: true, min: min, max: max, step: step, values: [val1, val2], slide: function(event, ui) { input.val(ui.values[0]).next('input').val(ui.values[1]); } }); slider.prev().children('input').bind('keydown', function(e) { var e = e || window.event, val = Number($(this).val()); if (e.keyCode !== 38 && e.keyCode !== 40) return; val = e.keyCode == 38 ? val + step : val - step; if (Math.ceil(step) - step > 0) val = val.toFixed(1); $(this).val(val); }).bind('input keydown change', function(e) { var value = this.value; if (/^\.|\d+\..*\.|[^\d\.{1}]/.test(value)) this.value = value.slice(0, -1); var val1 = parseFloat(input.val()), val2 = parseFloat(input.next('input').val()); if (val1 < min) input.val(min); else if (val2 > max) input.next('input').val(max); else if (val1 > val2 && $(this).index() == 0) input.val(input.next('input').val()); else if (val1 > val2 && $(this).index() == 1) input.next('input').val(input.val()); slider.slider('values', [input.val(), input.next('input').val()]); if (e.keyCode < 48 || e.keyCode > 58 && e.keyCode < 96 || e.keyCode > 105) return false; }); input.val(slider.slider('values', 0)).next('input').val(slider.slider('values', 1)); }); $('.sidebarFilter .sliderRange').each(function() { var slider = $(this), min = 1940, max = 2017, step = 1, select = slider.next('select'); var val1 = select.val() || min, val2 = select.next().next('select').val() || max; slider.slider({ range: true, min: min, max: max, step: step, values: [val1, val2], slide: function(event, ui) { select.val(ui.values[0]).trigger('change').next().next('select').val(ui.values[1]).trigger('change'); } }); select.bind('change', function(e) { var val1 = parseFloat(select.val()), val2 = parseFloat(select.next().next('select').val()); if (val1 < min) select.val(min); else if (val2 > max) select.next().next('select').val(max); else if (val1 > val2 && $(this).index() == select.index()) select.val(select.next().next('select').val()); else if (val1 > val2 && $(this).index() == select.next().next('select').index()) select.next().next('select').val(select.val()); slider.slider('values', [select.val(), select.next().next('select').val()]); }); select.next().next('select').bind('change', function(e) { var val1 = Number(select.val()), val2 = Number(select.next().next('select').val()); if (val1 < min) select.val(min); else if (val2 > max) select.next().next('select').val(max); else if (val1 > val2 && $(this).index() == select.index()) select.val(select.next().next('select').val()); else if (val1 > val2 && $(this).index() == select.next().next('select').index()) select.next().next('select').val(select.val()); slider.slider('values', [select.val(), select.next().next('select').val()]); }); select.val(slider.slider('values', 0)).next('select').next('select').val(slider.slider('values', 1)); }); });