' +\n '
' +\n '' +\n ''\n );\n a.dropdownTemplate = t7.compile(a.params.dropdownTemplate ||\n '
' +\n '
' +\n '{{#if preloader}}' +\n '
{{#if material}}{{materialPreloaderHtml}}{{/if}}
' +\n '{{/if}}' +\n '
'\n );\n }\n \n // Define popup\n a.popup = undefined;\n \n // Define Dropdown\n a.dropdown = undefined;\n \n // Handle Input Value Change\n function handleInputValue (e) {\n var query = a.input.val();\n if (a.params.source) {\n a.params.source(a, query, function (items) {\n var itemsHTML = '';\n var limit = a.params.limit ? Math.min(a.params.limit, items.length) : items.length;\n a.items = items;\n var i, j, regExp;\n if (a.params.highlightMatches) {\n query = query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n regExp = new RegExp('('+query+')', 'i');\n }\n \n for (i = 0; i < limit; i++) {\n var itemValue = typeof items[i] === 'object' ? items[i][a.params.valueProperty] : items[i];\n var itemText = typeof items[i] !== 'object' ? items[i] : items[i][a.params.textProperty];\n itemsHTML += a.dropdownItemTemplate({\n value: itemValue,\n text: a.params.highlightMatches ? itemText.replace(regExp, '
$1') : itemText\n });\n }\n if (itemsHTML === '' && query === '' && a.params.dropdownPlaceholderText) {\n itemsHTML += a.dropdownPlaceholderTemplate({\n text: a.params.dropdownPlaceholderText,\n });\n }\n a.dropdown.find('ul').html(itemsHTML);\n });\n }\n }\n // Handle Drop Down Click\n function handleDropdownClick (e) {\n /*jshint validthis:true */\n var clicked = $(this);\n var clickedItem;\n for (var i = 0; i < a.items.length; i++) {\n var itemValue = typeof a.items[i] === 'object' ? a.items[i][a.params.valueProperty] : a.items[i];\n var value = clicked.attr('data-value');\n if (itemValue === value || itemValue * 1 === value * 1) {\n clickedItem = a.items[i];\n }\n }\n if (a.params.updateInputValueOnSelect) {\n a.input.val(typeof clickedItem === 'object' ? clickedItem[a.params.valueProperty] : clickedItem);\n a.input.trigger('input change');\n }\n \n if (a.params.onChange) {\n a.params.onChange(a, clickedItem);\n }\n \n a.close();\n }\n \n // Handle HTML Click to close Dropdown\n function closeOnHTMLClick (e) {\n var target = $(e.target);\n if (!(target.is(a.input[0]) || a.dropdown && target.parents(a.dropdown[0]).length > 0)) {\n a.close();\n }\n }\n \n a.positionDropDown = function () {\n var listBlock = a.input.parents('.list-block'),\n pageContent = a.input.parents('.page-content'),\n paddingTop = parseInt(pageContent.css('padding-top'), 10),\n paddingBottom = parseInt(pageContent.css('padding-top'), 10),\n // inputOffset = a.input.offset(),\n listBlockOffsetLeft = listBlock.length > 0 ? listBlock.offset().left - listBlock.parent().offset().left : 0,\n inputOffsetLeft = a.input.offset().left - (listBlock.length > 0 ? listBlock.offset().left : 0),\n inputOffsetTop = a.input.offset().top - (pageContent.offset().top - pageContent[0].scrollTop),\n maxHeight = pageContent[0].scrollHeight - paddingBottom - (inputOffsetTop + pageContent[0].scrollTop) - a.input[0].offsetHeight;\n \n a.dropdown.css({\n left: (listBlock.length > 0 ? listBlockOffsetLeft : inputOffsetLeft) + 'px',\n top: inputOffsetTop + pageContent[0].scrollTop + a.input[0].offsetHeight + 'px',\n width: (listBlock.length > 0 ? listBlock[0].offsetWidth : a.input[0].offsetWidth) + 'px'\n });\n a.dropdown.children('.autocomplete-dropdown-inner').css({\n maxHeight: maxHeight + 'px',\n paddingLeft: listBlock.length > 0 && !a.params.expandInput ? inputOffsetLeft - (material ? 16 : 15) + 'px' : ''\n });\n };\n \n a.pageInit = function (e) {\n var page = e.detail.page;\n a.page = $(page.container);\n a.pageData = page;\n if (page.name !== pageName) {\n return;\n }\n var container = $(page.container);\n \n // Source\n function onSource(query) {\n if (!a.params.source) return;\n var i, j, k;\n \n a.params.source(a, query, function(items) {\n var itemsHTML = '';\n var limit = a.params.limit ? Math.min(a.params.limit, items.length) : items.length;\n a.items = items;\n for (i = 0; i < limit; i++) {\n var selected = false;\n var itemValue = typeof items[i] === 'object' ? items[i][a.params.valueProperty] : items[i];\n for (j = 0; j < a.value.length; j++) {\n var aValue = typeof a.value[j] === 'object' ? a.value[j][a.params.valueProperty] : a.value[j];\n if (aValue === itemValue || aValue * 1 === itemValue * 1) selected = true;\n }\n itemsHTML += a.itemTemplate({\n value: itemValue,\n text: typeof items[i] !== 'object' ? items[i] : items[i][a.params.textProperty],\n inputType: a.inputType,\n id: a.id,\n inputName: a.inputName,\n selected: selected,\n checkbox: a.inputType === 'checkbox',\n material: material\n });\n }\n container.find('.autocomplete-found ul').html(itemsHTML);\n if (items.length === 0) {\n if (query.length !== 0) {\n container.find('.autocomplete-not-found').show();\n container.find('.autocomplete-found, .autocomplete-values').hide();\n }\n else {\n container.find('.autocomplete-values').show();\n container.find('.autocomplete-found, .autocomplete-not-found').hide();\n }\n }\n else {\n container.find('.autocomplete-found').show();\n container.find('.autocomplete-not-found, .autocomplete-values').hide();\n }\n });\n }\n \n // Init Search Bar\n var searchbar = app.searchbar(container.find('.searchbar'), {\n customSearch: true,\n onSearch: function (searchbar, data) {\n if (data.query.length === 0 && searchbar.active) {\n searchbar.overlay.addClass('searchbar-overlay-active');\n }\n else {\n searchbar.overlay.removeClass('searchbar-overlay-active');\n }\n \n onSource(data.query);\n }\n });\n \n // Save searchbar instance\n a.searchbar = searchbar;\n \n // Update values\n function updateValues() {\n var valuesHTML = '';\n var i;\n for (i = 0; i < a.value.length; i++) {\n \n valuesHTML += a.itemTemplate({\n value: typeof a.value[i] === 'object' ? a.value[i][a.params.valueProperty] : a.value[i],\n text: typeof a.value[i] === 'object' ? a.value[i][a.params.textProperty]: a.value[i],\n inputType: a.inputType,\n id: a.id,\n inputName: a.inputName + '-checked',\n checkbox: a.inputType === 'checkbox',\n material: material,\n selected: true\n });\n }\n container.find('.autocomplete-values ul').html(valuesHTML);\n }\n \n // Handle Inputs\n if (!a.params.multiple && a.params.backOnSelect) {\n container.once('click', '.list-block label', function () {\n if (a.params.openIn === 'popup') app.closeModal(a.popup);\n else view.router.back({animatePages: a.params.openWithAnimation});\n });\n }\n container.on('change', 'input[type=\"radio\"], input[type=\"checkbox\"]', function () {\n var i;\n var input = this;\n var value = input.value;\n var text = $(input).parents('li').find('.item-title').text();\n var isValues = $(input).parents('.autocomplete-values').length > 0;\n var item, itemValue, aValue;\n if (isValues) {\n if (a.inputType === 'checkbox' && !input.checked) {\n for (i = 0; i < a.value.length; i++) {\n aValue = typeof a.value[i] === 'string' ? a.value[i] : a.value[i][a.params.valueProperty];\n if (aValue === value || aValue * 1 === value * 1) {\n a.value.splice(i, 1);\n }\n }\n updateValues();\n if (a.params.onChange) a.params.onChange(a, a.value);\n }\n return;\n }\n \n // Find Related Item\n for (i = 0; i < a.items.length; i++) {\n itemValue = typeof a.items[i] === 'string' ? a.items[i] : a.items[i][a.params.valueProperty];\n if (itemValue === value || itemValue * 1 === value * 1) item = a.items[i];\n }\n // Update Selected Value\n if (a.inputType === 'radio') {\n a.value = [item];\n }\n else {\n if (input.checked) {\n a.value.push(item);\n }\n else {\n for (i = 0; i < a.value.length; i++) {\n aValue = typeof a.value[i] === 'string' ? a.value[i] : a.value[i][a.params.valueProperty];\n if (aValue === value || aValue * 1 === value * 1) {\n a.value.splice(i, 1);\n }\n }\n }\n }\n \n // Update Values Block\n updateValues();\n \n // On Select Callback\n if ((a.inputType === 'radio' && input.checked || a.inputType === 'checkbox') && a.params.onChange ) {\n a.params.onChange(a, a.value);\n }\n });\n \n // Update Values On Page Init\n updateValues();\n \n // Source on load\n if (a.params.requestSourceOnOpen) onSource('');\n \n // On Open Callback\n if (a.params.onOpen) a.params.onOpen(a);\n };\n \n // Show Hide Preloader\n a.showPreloader = function () {\n if (a.params.openIn === 'dropdown') {\n if (a.dropdown) a.dropdown.find('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n }\n else $('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n };\n \n a.hidePreloader = function () {\n if (a.params.openIn === 'dropdown') {\n if (a.dropdown) a.dropdown.find('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n }\n else $('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n };\n \n // Autofocus\n a.autoFocus = function (e) {\n var self = this;\n setTimeout(function () {\n $(self).find('input[type=search]').focus();\n }, 0);\n };\n \n // Open Autocomplete Page/Popup\n a.open = function () {\n if (a.opened) return;\n a.opened = true;\n if (a.params.openIn === 'dropdown') {\n if (!a.dropdown) {\n a.dropdown = $(a.dropdownTemplate({\n preloader: a.params.preloader,\n preloaderColor: a.params.preloaderColor,\n material: material,\n materialPreloaderHtml: app.params.materialPreloaderHtml\n }));\n a.dropdown.on('click', 'label', handleDropdownClick);\n \n }\n var listBlock = a.input.parents('.list-block');\n if (listBlock.length && a.input.parents('.item-content').length > 0 && a.params.expandInput) {\n a.input.parents('.item-content').addClass('item-content-dropdown-expand');\n }\n a.positionDropDown();\n a.input.parents('.page-content').append(a.dropdown);\n a.dropdown.addClass('autocomplete-dropdown-in');\n a.input.trigger('input');\n app.onResize(a.positionDropDown);\n if (a.params.onOpen) a.params.onOpen(a);\n }\n else {\n $(document).once('page:init', '.autocomplete-page', a.pageInit);\n if (a.params.openIn === 'popup') {\n a.popup = app.popup(\n '',\n true,\n a.params.openWithAnimation\n );\n a.popup = $(a.popup);\n if (a.params.autoFocus) {\n if (a.params.openWithAnimation) a.popup.once('popup:opened', a.autoFocus);\n else a.autoFocus.bind(a.popup)();\n }\n a.popup.once('popup:closed', function () {\n a.popup = undefined;\n a.opened = false;\n if (a.params.onClose) a.params.onClose(a);\n });\n }\n else {\n if (a.params.autoFocus) {\n $(document).once(a.params.openWithAnimation ? 'page:afteranimation' : 'page:init', '.autocomplete-page', a.autoFocus);\n }\n view.router.load({\n content: pageHTML,\n animatePages: a.params.openWithAnimation\n });\n $(document).once('page:back', '.autocomplete-page', function () {\n a.opened = false;\n if (a.params.onClose) a.params.onClose(a);\n });\n }\n }\n };\n a.close = function (e) {\n if (!a.opened) return;\n if (a.params.openIn === 'dropdown') {\n if (e && e.type === 'blur' && a.dropdown.find('label.active-state').length > 0) return;\n a.dropdown.removeClass('autocomplete-dropdown-in').remove();\n a.input.parents('.item-content-dropdown-expand').removeClass('item-content-dropdown-expand');\n a.opened = false;\n app.offResize(a.positionDropDown);\n if (a.params.onClose) a.params.onClose(a);\n }\n if (a.params.openIn === 'popup') {\n if (a.popup) app.closeModal(a.popup);\n }\n };\n \n // Init Events\n a.initEvents = function (detach) {\n var method = detach ? 'off' : 'on';\n if (a.params.openIn !== 'dropdown' && a.opener) {\n a.opener[method]('click', a.open);\n }\n if (a.params.openIn === 'dropdown' && a.input) {\n a.input[method]('focus', a.open);\n a.input[method]('input', handleInputValue);\n if (app.device.android) {\n $('html')[method]('click', closeOnHTMLClick);\n }\n else {\n a.input[method]('blur', a.close);\n }\n }\n if (detach && a.dropdown) {\n a.dropdown = null;\n }\n };\n \n // Init/Destroy Methods\n a.init = function () {\n a.initEvents();\n };\n a.destroy = function () {\n a.initEvents(true);\n a = null;\n };\n \n // Init\n a.init();\n \n return a;\n };\n app.autocomplete = function (params) {\n return new Autocomplete(params);\n };\n \n"," /*======================================================\n ************ Picker ************\n ======================================================*/\n var Picker = function (params) {\n var p = this;\n var defaults = {\n updateValuesOnMomentum: false,\n updateValuesOnTouchmove: true,\n rotateEffect: false,\n momentumRatio: 7,\n freeMode: false,\n // Common settings\n closeByOutsideClick: true,\n scrollToInput: true,\n inputReadOnly: true,\n convertToPopover: true,\n onlyInPopover: false,\n toolbar: true,\n toolbarCloseText: 'Done',\n toolbarTemplate:\n '
'\n };\n params = params || {};\n for (var def in defaults) {\n if (typeof params[def] === 'undefined') {\n params[def] = defaults[def];\n }\n }\n p.params = params;\n p.cols = [];\n p.initialized = false;\n \n // Inline flag\n p.inline = p.params.container ? true : false;\n \n // 3D Transforms origin bug, only on safari\n var originBug = app.device.ios || (navigator.userAgent.toLowerCase().indexOf('safari') >= 0 && navigator.userAgent.toLowerCase().indexOf('chrome') < 0) && !app.device.android;\n \n // Should be converted to popover\n function isPopover() {\n var toPopover = false;\n if (!p.params.convertToPopover && !p.params.onlyInPopover) return toPopover;\n if (!p.inline && p.params.input) {\n if (p.params.onlyInPopover) toPopover = true;\n else {\n if (app.device.ios) {\n toPopover = app.device.ipad ? true : false;\n }\n else {\n if (app.width >= 768) toPopover = true;\n }\n }\n }\n return toPopover;\n }\n function inPopover() {\n if (p.opened && p.container && p.container.length > 0 && p.container.parents('.popover').length > 0) return true;\n else return false;\n }\n \n // Value\n p.setValue = function (arrValues, transition) {\n var valueIndex = 0;\n if (p.cols.length === 0) {\n p.value = arrValues;\n p.updateValue(arrValues);\n return;\n }\n for (var i = 0; i < p.cols.length; i++) {\n if (p.cols[i] && !p.cols[i].divider) {\n p.cols[i].setValue(arrValues[valueIndex], transition);\n valueIndex++;\n }\n }\n };\n p.updateValue = function (forceValues) {\n var newValue = forceValues || [];\n var newDisplayValue = [], i, column;\n if (p.cols.length === 0) {\n for (i = 0; i < p.params.cols.length; i++) {\n column = p.params.cols[i];\n if (column.displayValues !== undefined && column.values !== undefined && column.values.indexOf(newValue[i]) !== undefined) {\n newDisplayValue.push(column.displayValues[column.values.indexOf(newValue[i])]);\n }\n else {\n newDisplayValue.push(newValue[i]);\n }\n }\n }\n else {\n for (i = 0; i < p.cols.length; i++) {\n if (!p.cols[i].divider) {\n newValue.push(p.cols[i].value);\n newDisplayValue.push(p.cols[i].displayValue);\n }\n }\n }\n \n if (newValue.indexOf(undefined) >= 0) {\n return;\n }\n p.value = newValue;\n p.displayValue = newDisplayValue;\n if (p.params.onChange) {\n p.params.onChange(p, p.value, p.displayValue);\n }\n if (p.input && p.input.length > 0) {\n $(p.input).val(p.params.formatValue ? p.params.formatValue(p, p.value, p.displayValue) : p.value.join(' '));\n $(p.input).trigger('change');\n }\n };\n \n // Columns Handlers\n p.initPickerCol = function (colElement, updateItems) {\n var colContainer = $(colElement);\n var colIndex = colContainer.index();\n var col = p.cols[colIndex];\n if (col.divider) return;\n col.container = colContainer;\n col.wrapper = col.container.find('.picker-items-col-wrapper');\n col.items = col.wrapper.find('.picker-item');\n \n var i, j;\n var wrapperHeight, itemHeight, itemsHeight, minTranslate, maxTranslate;\n col.replaceValues = function (values, displayValues) {\n col.destroyEvents();\n col.values = values;\n col.displayValues = displayValues;\n var newItemsHTML = p.columnHTML(col, true);\n col.wrapper.html(newItemsHTML);\n col.items = col.wrapper.find('.picker-item');\n col.calcSize();\n col.setValue(col.values[0], 0, true);\n col.initEvents();\n };\n var resizeTimeout;\n col.calcSize = function () {\n if (p.params.rotateEffect) {\n col.container.removeClass('picker-items-col-absolute');\n if (!col.width) col.container.css({width:''});\n }\n var colWidth, colHeight;\n colWidth = 0;\n colHeight = col.container[0].offsetHeight;\n wrapperHeight = col.wrapper[0].offsetHeight;\n itemHeight = col.items[0].offsetHeight;\n itemsHeight = itemHeight * col.items.length;\n minTranslate = colHeight / 2 - itemsHeight + itemHeight / 2;\n maxTranslate = colHeight / 2 - itemHeight / 2;\n if (col.width) {\n colWidth = col.width;\n if (parseInt(colWidth, 10) === colWidth) colWidth = colWidth + 'px';\n col.container.css({width: colWidth});\n }\n if (p.params.rotateEffect) {\n if (!col.width) {\n col.items.each(function () {\n var item = $(this).children('span');\n colWidth = Math.max(colWidth, item[0].offsetWidth);\n });\n col.container.css({width: (colWidth + 2) + 'px'});\n }\n col.container.addClass('picker-items-col-absolute');\n }\n };\n col.calcSize();\n \n col.wrapper.transform('translate3d(0,' + maxTranslate + 'px,0)').transition(0);\n \n \n var activeIndex = 0;\n var animationFrameId;\n \n // Set Value Function\n col.setValue = function (newValue, transition, valueCallbacks) {\n if (typeof transition === 'undefined') transition = '';\n var newActiveIndex = col.wrapper.find('.picker-item[data-picker-value=\"' + newValue + '\"]').index();\n if(typeof newActiveIndex === 'undefined' || newActiveIndex === -1) {\n return;\n }\n var newTranslate = -newActiveIndex * itemHeight + maxTranslate;\n // Update wrapper\n col.wrapper.transition(transition);\n col.wrapper.transform('translate3d(0,' + (newTranslate) + 'px,0)');\n \n // Watch items\n if (p.params.updateValuesOnMomentum && col.activeIndex && col.activeIndex !== newActiveIndex ) {\n $.cancelAnimationFrame(animationFrameId);\n col.wrapper.transitionEnd(function(){\n $.cancelAnimationFrame(animationFrameId);\n });\n updateDuringScroll();\n }\n \n // Update items\n col.updateItems(newActiveIndex, newTranslate, transition, valueCallbacks);\n };\n \n col.updateItems = function (activeIndex, translate, transition, valueCallbacks) {\n if (typeof translate === 'undefined') {\n translate = $.getTranslate(col.wrapper[0], 'y');\n }\n if(typeof activeIndex === 'undefined') activeIndex = -Math.round((translate - maxTranslate)/itemHeight);\n if (activeIndex < 0) activeIndex = 0;\n if (activeIndex >= col.items.length) activeIndex = col.items.length - 1;\n var previousActiveIndex = col.activeIndex;\n col.activeIndex = activeIndex;\n col.wrapper.find('.picker-selected').removeClass('picker-selected');\n \n col.items.transition(transition);\n \n var selectedItem = col.items.eq(activeIndex).addClass('picker-selected').transform('');\n \n // Set 3D rotate effect\n if (p.params.rotateEffect) {\n var percentage = (translate - (Math.floor((translate - maxTranslate)/itemHeight) * itemHeight + maxTranslate)) / itemHeight;\n \n col.items.each(function () {\n var item = $(this);\n var itemOffsetTop = item.index() * itemHeight;\n var translateOffset = maxTranslate - translate;\n var itemOffset = itemOffsetTop - translateOffset;\n var percentage = itemOffset / itemHeight;\n \n var itemsFit = Math.ceil(col.height / itemHeight / 2) + 1;\n \n var angle = (-18*percentage);\n if (angle > 180) angle = 180;\n if (angle < -180) angle = -180;\n // Far class\n if (Math.abs(percentage) > itemsFit) item.addClass('picker-item-far');\n else item.removeClass('picker-item-far');\n // Set transform\n item.transform('translate3d(0, ' + (-translate + maxTranslate) + 'px, ' + (originBug ? -110 : 0) + 'px) rotateX(' + angle + 'deg)');\n });\n }\n \n if (valueCallbacks || typeof valueCallbacks === 'undefined') {\n // Update values\n col.value = selectedItem.attr('data-picker-value');\n col.displayValue = col.displayValues ? col.displayValues[activeIndex] : col.value;\n // On change callback\n if (previousActiveIndex !== activeIndex) {\n if (col.onChange) {\n col.onChange(p, col.value, col.displayValue);\n }\n p.updateValue();\n }\n }\n };\n \n function updateDuringScroll() {\n animationFrameId = $.requestAnimationFrame(function () {\n col.updateItems(undefined, undefined, 0);\n updateDuringScroll();\n });\n }\n \n // Update items on init\n if (updateItems) col.updateItems(0, maxTranslate, 0);\n \n var allowItemClick = true;\n var isTouched, isMoved, touchStartY, touchCurrentY, touchStartTime, touchEndTime, startTranslate, returnTo, currentTranslate, prevTranslate, velocityTranslate, velocityTime;\n function handleTouchStart (e) {\n if (isMoved || isTouched) return;\n e.preventDefault();\n isTouched = true;\n touchStartY = touchCurrentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchStartTime = (new Date()).getTime();\n \n allowItemClick = true;\n startTranslate = currentTranslate = $.getTranslate(col.wrapper[0], 'y');\n }\n function handleTouchMove (e) {\n if (!isTouched) return;\n e.preventDefault();\n allowItemClick = false;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (!isMoved) {\n // First move\n $.cancelAnimationFrame(animationFrameId);\n isMoved = true;\n startTranslate = currentTranslate = $.getTranslate(col.wrapper[0], 'y');\n col.wrapper.transition(0);\n }\n \n var diff = touchCurrentY - touchStartY;\n currentTranslate = startTranslate + diff;\n returnTo = undefined;\n \n // Normalize translate\n if (currentTranslate < minTranslate) {\n currentTranslate = minTranslate - Math.pow(minTranslate - currentTranslate, 0.8);\n returnTo = 'min';\n }\n if (currentTranslate > maxTranslate) {\n currentTranslate = maxTranslate + Math.pow(currentTranslate - maxTranslate, 0.8);\n returnTo = 'max';\n }\n // Transform wrapper\n col.wrapper.transform('translate3d(0,' + currentTranslate + 'px,0)');\n \n // Update items\n col.updateItems(undefined, currentTranslate, 0, p.params.updateValuesOnTouchmove);\n \n // Calc velocity\n velocityTranslate = currentTranslate - prevTranslate || currentTranslate;\n velocityTime = (new Date()).getTime();\n prevTranslate = currentTranslate;\n }\n function handleTouchEnd (e) {\n if (!isTouched || !isMoved) {\n isTouched = isMoved = false;\n return;\n }\n isTouched = isMoved = false;\n col.wrapper.transition('');\n if (returnTo) {\n if (returnTo === 'min') {\n col.wrapper.transform('translate3d(0,' + minTranslate + 'px,0)');\n }\n else col.wrapper.transform('translate3d(0,' + maxTranslate + 'px,0)');\n }\n touchEndTime = new Date().getTime();\n var velocity, newTranslate;\n if (touchEndTime - touchStartTime > 300) {\n newTranslate = currentTranslate;\n }\n else {\n velocity = Math.abs(velocityTranslate / (touchEndTime - velocityTime));\n newTranslate = currentTranslate + velocityTranslate * p.params.momentumRatio;\n }\n \n newTranslate = Math.max(Math.min(newTranslate, maxTranslate), minTranslate);\n \n // Active Index\n var activeIndex = -Math.floor((newTranslate - maxTranslate)/itemHeight);\n \n // Normalize translate\n if (!p.params.freeMode) newTranslate = -activeIndex * itemHeight + maxTranslate;\n \n // Transform wrapper\n col.wrapper.transform('translate3d(0,' + (parseInt(newTranslate,10)) + 'px,0)');\n \n // Update items\n col.updateItems(activeIndex, newTranslate, '', true);\n \n // Watch items\n if (p.params.updateValuesOnMomentum) {\n updateDuringScroll();\n col.wrapper.transitionEnd(function(){\n $.cancelAnimationFrame(animationFrameId);\n });\n }\n \n // Allow click\n setTimeout(function () {\n allowItemClick = true;\n }, 100);\n }\n \n function handleClick(e) {\n if (!allowItemClick) return;\n $.cancelAnimationFrame(animationFrameId);\n /*jshint validthis:true */\n var value = $(this).attr('data-picker-value');\n col.setValue(value);\n }\n \n col.initEvents = function (detach) {\n var method = detach ? 'off' : 'on';\n var activeListener = app.support.passiveListener ? {passive: false, capture: false} : false;\n col.container[method](app.touchEvents.start, handleTouchStart, activeListener);\n col.container[method](app.touchEvents.move, handleTouchMove, activeListener);\n col.container[method](app.touchEvents.end, handleTouchEnd, activeListener);\n col.items[method]('click', handleClick);\n };\n col.destroyEvents = function () {\n col.initEvents(true);\n };\n \n col.container[0].f7DestroyPickerCol = function () {\n col.destroyEvents();\n };\n \n col.initEvents();\n \n };\n p.destroyPickerCol = function (colContainer) {\n colContainer = $(colContainer);\n if ('f7DestroyPickerCol' in colContainer[0]) colContainer[0].f7DestroyPickerCol();\n };\n // Resize cols\n function resizeCols() {\n if (!p.opened) return;\n for (var i = 0; i < p.cols.length; i++) {\n if (!p.cols[i].divider) {\n p.cols[i].calcSize();\n p.cols[i].setValue(p.cols[i].value, 0, false);\n }\n }\n }\n app.onResize(resizeCols);\n \n // HTML Layout\n p.columnHTML = function (col, onlyItems) {\n var columnItemsHTML = '';\n var columnHTML = '';\n if (col.divider) {\n columnHTML += '
' + col.content + '
';\n }\n else {\n for (var j = 0; j < col.values.length; j++) {\n columnItemsHTML += '
' + (col.displayValues ? col.displayValues[j] : col.values[j]) + '
';\n }\n columnHTML += '
';\n }\n return onlyItems ? columnItemsHTML : columnHTML;\n };\n p.layout = function () {\n var pickerHTML = '';\n var pickerClass = '';\n var i;\n p.cols = [];\n var colsHTML = '';\n for (i = 0; i < p.params.cols.length; i++) {\n var col = p.params.cols[i];\n colsHTML += p.columnHTML(p.params.cols[i]);\n p.cols.push(col);\n }\n pickerClass = 'picker-modal picker-columns ' + (p.params.cssClass || '') + (p.params.rotateEffect ? ' picker-3d' : '');\n pickerHTML =\n '
' +\n (p.params.toolbar ? p.params.toolbarTemplate.replace(/{{closeText}}/g, p.params.toolbarCloseText) : '') +\n '
' +\n colsHTML +\n '
' +\n '
' +\n '
';\n \n p.pickerHTML = pickerHTML;\n };\n \n // Input Events\n function openOnInput(e) {\n e.preventDefault();\n if (p.opened) return;\n p.open();\n if (p.params.scrollToInput && !isPopover()) {\n var pageContent = p.input.parents('.page-content');\n if (pageContent.length === 0) return;\n \n var paddingTop = parseInt(pageContent.css('padding-top'), 10),\n paddingBottom = parseInt(pageContent.css('padding-bottom'), 10),\n pageHeight = pageContent[0].offsetHeight - paddingTop - p.container.height(),\n pageScrollHeight = pageContent[0].scrollHeight - paddingTop - p.container.height(),\n newPaddingBottom;\n var inputTop = p.input.offset().top - paddingTop + p.input[0].offsetHeight;\n if (inputTop > pageHeight) {\n var scrollTop = pageContent.scrollTop() + inputTop - pageHeight;\n if (scrollTop + pageHeight > pageScrollHeight) {\n newPaddingBottom = scrollTop + pageHeight - pageScrollHeight + paddingBottom;\n if (pageHeight === pageScrollHeight) {\n newPaddingBottom = p.container.height();\n }\n pageContent.css({'padding-bottom': (newPaddingBottom) + 'px'});\n }\n pageContent.scrollTop(scrollTop, 300);\n }\n }\n }\n function closeOnHTMLClick(e) {\n if (inPopover()) return;\n if (p.input && p.input.length > 0) {\n if (e.target !== p.input[0] && $(e.target).parents('.picker-modal').length === 0) p.close();\n }\n else {\n if ($(e.target).parents('.picker-modal').length === 0) p.close();\n }\n }\n \n if (p.params.input) {\n p.input = $(p.params.input);\n if (p.input.length > 0) {\n if (p.params.inputReadOnly) p.input.prop('readOnly', true);\n if (!p.inline) {\n p.input.on('click', openOnInput);\n }\n if (p.params.inputReadOnly) {\n p.input.on('focus mousedown', function (e) {\n e.preventDefault();\n });\n }\n }\n \n }\n \n if (!p.inline && p.params.closeByOutsideClick) $('html').on('click', closeOnHTMLClick);\n \n // Open\n function onPickerClose() {\n p.opened = false;\n if (p.input && p.input.length > 0) {\n p.input.parents('.page-content').css({'padding-bottom': ''});\n if (app.params.material) p.input.trigger('blur');\n }\n if (p.params.onClose) p.params.onClose(p);\n \n // Destroy events\n p.container.find('.picker-items-col').each(function () {\n p.destroyPickerCol(this);\n });\n }\n \n p.opened = false;\n p.open = function () {\n var toPopover = isPopover();\n \n if (!p.opened) {\n \n // Layout\n p.layout();\n \n // Append\n if (toPopover) {\n p.pickerHTML = '
';\n p.popover = app.popover(p.pickerHTML, p.params.input, true);\n p.container = $(p.popover).find('.picker-modal');\n $(p.popover).on('popover:close', function () {\n onPickerClose();\n });\n }\n else if (p.inline) {\n p.container = $(p.pickerHTML);\n p.container.addClass('picker-modal-inline');\n $(p.params.container).append(p.container);\n }\n else {\n p.container = $(app.pickerModal(p.pickerHTML));\n $(p.container)\n .on('picker:close', function () {\n onPickerClose();\n });\n }\n \n // Store picker instance\n p.container[0].f7Picker = p;\n \n // Init Events\n p.container.find('.picker-items-col').each(function () {\n var updateItems = true;\n if ((!p.initialized && p.params.value) || (p.initialized && p.value)) updateItems = false;\n p.initPickerCol(this, updateItems);\n });\n \n // Set value\n if (!p.initialized) {\n if (p.value) p.setValue(p.value, 0);\n else if (p.params.value) {\n p.setValue(p.params.value, 0);\n }\n }\n else {\n if (p.value) p.setValue(p.value, 0);\n }\n \n // Material Focus\n if (p.input && p.input.length > 0 && app.params.material) {\n p.input.trigger('focus');\n }\n }\n \n // Set flag\n p.opened = true;\n p.initialized = true;\n \n if (p.params.onOpen) p.params.onOpen(p);\n };\n \n // Close\n p.close = function () {\n if (!p.opened || p.inline) return;\n if (inPopover()) {\n app.closeModal(p.popover);\n return;\n }\n else {\n app.closeModal(p.container);\n return;\n }\n };\n \n // Destroy\n p.destroy = function () {\n p.close();\n if (p.params.input && p.input.length > 0) {\n p.input.off('click focus', openOnInput);\n }\n $('html').off('click', closeOnHTMLClick);\n app.offResize(resizeCols);\n };\n \n if (p.inline) {\n p.open();\n }\n else {\n if (!p.initialized && p.params.value) p.setValue(p.params.value);\n }\n \n return p;\n };\n app.picker = function (params) {\n return new Picker(params);\n };\n \n"," /*======================================================\n ************ Calendar ************\n ======================================================*/\n var Calendar = function (params) {\n var p = this;\n var defaults = {\n monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August' , 'September' , 'October', 'November', 'December'],\n monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n firstDay: 1, // First day of the week, Monday\n weekendDays: [0, 6], // Sunday and Saturday\n multiple: false,\n rangePicker: false,\n dateFormat: 'yyyy-mm-dd',\n direction: 'horizontal', // or 'vertical'\n minDate: null,\n maxDate: null,\n disabled: null, // dates range of disabled days\n events: null, // dates range of days with events\n rangesClasses: null, //array with custom classes date ranges\n touchMove: true,\n animate: true,\n closeOnSelect: false,\n monthPicker: true,\n monthPickerTemplate:\n '
' +\n '
' +\n '
' +\n '
' +\n '
',\n yearPicker: true,\n yearPickerTemplate:\n '
' +\n '
' +\n '
' +\n '
' +\n '
',\n weekHeader: true,\n // Common settings\n closeByOutsideClick: true,\n scrollToInput: true,\n inputReadOnly: true,\n convertToPopover: true,\n onlyInPopover: false,\n toolbar: true,\n toolbarCloseText: 'Done',\n headerPlaceholder: 'Select date',\n header: app.params.material,\n footer: app.params.material,\n toolbarTemplate:\n '
',\n headerTemplate:\n '',\n footerTemplate:\n '',\n \n /* Callbacks\n onMonthAdd\n onChange\n onOpen\n onClose\n onDayClick\n onMonthYearChangeStart\n onMonthYearChangeEnd\n */\n };\n params = params || {};\n for (var def in defaults) {\n if (typeof params[def] === 'undefined') {\n params[def] = defaults[def];\n }\n }\n p.params = params;\n p.initialized = false;\n \n // Inline flag\n p.inline = p.params.container ? true : false;\n \n // Is horizontal\n p.isH = p.params.direction === 'horizontal';\n \n // RTL inverter\n var inverter = p.isH ? (app.rtl ? -1 : 1) : 1;\n \n // Animating flag\n p.animating = false;\n \n // Should be converted to popover\n function isPopover() {\n var toPopover = false;\n if (!p.params.convertToPopover && !p.params.onlyInPopover) return toPopover;\n if (!p.inline && p.params.input) {\n if (p.params.onlyInPopover) toPopover = true;\n else {\n if (app.device.ios) {\n toPopover = app.device.ipad ? true : false;\n }\n else {\n if (app.width >= 768) toPopover = true;\n }\n }\n }\n return toPopover;\n }\n function inPopover() {\n if (p.opened && p.container && p.container.length > 0 && p.container.parents('.popover').length > 0) return true;\n else return false;\n }\n \n // Format date\n function formatDate(date) {\n date = new Date(date);\n var year = date.getFullYear();\n var month = date.getMonth();\n var month1 = month + 1;\n var day = date.getDate();\n var weekDay = date.getDay();\n \n return p.params.dateFormat\n .replace(/yyyy/g, year)\n .replace(/yy/g, (year + '').substring(2))\n .replace(/mm/g, month1 < 10 ? '0' + month1 : month1)\n .replace(/m(\\W+)/g, month1 + '$1')\n .replace(/MM/g, p.params.monthNames[month])\n .replace(/M(\\W+)/g, p.params.monthNamesShort[month] + '$1')\n .replace(/dd/g, day < 10 ? '0' + day : day)\n .replace(/d(\\W+)/g, day + '$1')\n .replace(/DD/g, p.params.dayNames[weekDay])\n .replace(/D(\\W+)/g, p.params.dayNamesShort[weekDay] + '$1');\n }\n \n \n // Value\n p.addValue = function (value) {\n if (p.params.multiple) {\n if (!p.value) p.value = [];\n var inValuesIndex;\n for (var i = 0; i < p.value.length; i++) {\n if (new Date(value).getTime() === new Date(p.value[i]).getTime()) {\n inValuesIndex = i;\n }\n }\n if (typeof inValuesIndex === 'undefined') {\n p.value.push(value);\n }\n else {\n p.value.splice(inValuesIndex, 1);\n }\n p.updateValue();\n }\n else if (p.params.rangePicker) {\n if (!p.value) p.value = [];\n if (p.value.length === 2 || p.value.length === 0) {\n p.value = [];\n }\n if (p.value[0] !== value) p.value.push(value);\n else p.value = [];\n p.value.sort(function (a,b) {\n return a - b;\n });\n p.updateValue();\n }\n else {\n p.value = [value];\n p.updateValue();\n }\n };\n p.setValue = function (arrValues) {\n p.value = arrValues;\n p.updateValue();\n };\n p.updateValue = function (onlyHeader) {\n var i, inputValue;\n if (p.container && p.container.length > 0) {\n p.wrapper.find('.picker-calendar-day-selected').removeClass('picker-calendar-day-selected');\n var valueDate;\n if (p.params.rangePicker && p.value.length === 2) {\n for (i = new Date(p.value[0]).getTime(); i <= new Date(p.value[1]).getTime(); i += 24*60*60*1000) {\n valueDate = new Date(i);\n p.wrapper.find('.picker-calendar-day[data-date=\"' + valueDate.getFullYear() + '-' + valueDate.getMonth() + '-' + valueDate.getDate() + '\"]').addClass('picker-calendar-day-selected');\n }\n }\n else {\n for (i = 0; i < p.value.length; i++) {\n valueDate = new Date(p.value[i]);\n p.wrapper.find('.picker-calendar-day[data-date=\"' + valueDate.getFullYear() + '-' + valueDate.getMonth() + '-' + valueDate.getDate() + '\"]').addClass('picker-calendar-day-selected');\n }\n }\n }\n \n if (p.params.onChange) {\n p.params.onChange(p, p.value);\n }\n if ((p.input && p.input.length > 0) || (app.params.material && p.params.header)) {\n if (p.params.formatValue) inputValue = p.params.formatValue(p, p.value);\n else {\n inputValue = [];\n for (i = 0; i < p.value.length; i++) {\n inputValue.push(formatDate(p.value[i]));\n }\n inputValue = inputValue.join(p.params.rangePicker ? ' - ' : ', ');\n }\n if (app.params.material && p.params.header && p.container && p.container.length > 0) {\n p.container.find('.picker-calendar-selected-date').text(inputValue);\n }\n if (p.input && p.input.length > 0 && !onlyHeader) {\n $(p.input).val(inputValue);\n $(p.input).trigger('change');\n }\n \n }\n };\n \n // Columns Handlers\n p.initCalendarEvents = function () {\n var col;\n var allowItemClick = true;\n var isTouched, isMoved, touchStartX, touchStartY, touchCurrentX, touchCurrentY, touchStartTime, touchEndTime, startTranslate, currentTranslate, wrapperWidth, wrapperHeight, percentage, touchesDiff, isScrolling;\n function handleTouchStart (e) {\n if (isMoved || isTouched) return;\n // e.preventDefault();\n isTouched = true;\n touchStartX = touchCurrentY = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchStartY = touchCurrentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchStartTime = (new Date()).getTime();\n percentage = 0;\n allowItemClick = true;\n isScrolling = undefined;\n startTranslate = currentTranslate = p.monthsTranslate;\n }\n function handleTouchMove (e) {\n if (!isTouched) return;\n \n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(touchCurrentY - touchStartY) > Math.abs(touchCurrentX - touchStartX));\n }\n if (p.isH && isScrolling) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n if (p.animating) {\n isTouched = false;\n return;\n }\n allowItemClick = false;\n if (!isMoved) {\n // First move\n isMoved = true;\n wrapperWidth = p.wrapper[0].offsetWidth;\n wrapperHeight = p.wrapper[0].offsetHeight;\n p.wrapper.transition(0);\n }\n \n touchesDiff = p.isH ? touchCurrentX - touchStartX : touchCurrentY - touchStartY;\n percentage = touchesDiff/(p.isH ? wrapperWidth : wrapperHeight);\n currentTranslate = (p.monthsTranslate * inverter + percentage) * 100;\n \n // Transform wrapper\n p.wrapper.transform('translate3d(' + (p.isH ? currentTranslate : 0) + '%, ' + (p.isH ? 0 : currentTranslate) + '%, 0)');\n \n }\n function handleTouchEnd (e) {\n if (!isTouched || !isMoved) {\n isTouched = isMoved = false;\n return;\n }\n isTouched = isMoved = false;\n \n touchEndTime = new Date().getTime();\n if (touchEndTime - touchStartTime < 300) {\n if (Math.abs(touchesDiff) < 10) {\n p.resetMonth();\n }\n else if (touchesDiff >= 10) {\n if (app.rtl) p.nextMonth();\n else p.prevMonth();\n }\n else {\n if (app.rtl) p.prevMonth();\n else p.nextMonth();\n }\n }\n else {\n if (percentage <= -0.5) {\n if (app.rtl) p.prevMonth();\n else p.nextMonth();\n }\n else if (percentage >= 0.5) {\n if (app.rtl) p.nextMonth();\n else p.prevMonth();\n }\n else {\n p.resetMonth();\n }\n }\n \n // Allow click\n setTimeout(function () {\n allowItemClick = true;\n }, 100);\n }\n \n function handleDayClick(e) {\n if (!allowItemClick) return;\n var day = $(e.target).parents('.picker-calendar-day');\n if (day.length === 0 && $(e.target).hasClass('picker-calendar-day')) {\n day = $(e.target);\n }\n if (day.length === 0) return;\n if (day.hasClass('picker-calendar-day-disabled')) return;\n if (!p.params.rangePicker) {\n if (day.hasClass('picker-calendar-day-next')) p.nextMonth();\n if (day.hasClass('picker-calendar-day-prev')) p.prevMonth();\n }\n var dateYear = day.attr('data-year');\n var dateMonth = day.attr('data-month');\n var dateDay = day.attr('data-day');\n if (p.params.onDayClick) {\n p.params.onDayClick(p, day[0], dateYear, dateMonth, dateDay);\n }\n if (!day.hasClass('picker-calendar-day-selected') || p.params.multiple || p.params.rangePicker) {\n p.addValue(new Date(dateYear, dateMonth, dateDay, 0, 0, 0));\n }\n if (p.params.closeOnSelect) {\n if (p.params.rangePicker && p.value.length === 2 || !p.params.rangePicker) p.close();\n }\n }\n \n p.container.find('.picker-calendar-prev-month').on('click', p.prevMonth);\n p.container.find('.picker-calendar-next-month').on('click', p.nextMonth);\n p.container.find('.picker-calendar-prev-year').on('click', p.prevYear);\n p.container.find('.picker-calendar-next-year').on('click', p.nextYear);\n p.wrapper.on('click', handleDayClick);\n var passiveListener = app.touchEvents.start === 'touchstart' && app.support.passiveListener ? {passive: true, capture: false} : false;\n var activeListener = app.support.passiveListener ? {passive: false, capture: false} : false;\n if (p.params.touchMove) {\n p.wrapper.on(app.touchEvents.start, handleTouchStart, passiveListener);\n p.wrapper.on(app.touchEvents.move, handleTouchMove, activeListener);\n p.wrapper.on(app.touchEvents.end, handleTouchEnd, passiveListener);\n }\n \n p.container[0].f7DestroyCalendarEvents = function () {\n p.container.find('.picker-calendar-prev-month').off('click', p.prevMonth);\n p.container.find('.picker-calendar-next-month').off('click', p.nextMonth);\n p.container.find('.picker-calendar-prev-year').off('click', p.prevYear);\n p.container.find('.picker-calendar-next-year').off('click', p.nextYear);\n p.wrapper.off('click', handleDayClick);\n if (p.params.touchMove) {\n p.wrapper.off(app.touchEvents.start, handleTouchStart, passiveListener);\n p.wrapper.off(app.touchEvents.move, handleTouchMove, activeListener);\n p.wrapper.off(app.touchEvents.end, handleTouchEnd, passiveListener);\n }\n };\n \n \n };\n p.destroyCalendarEvents = function (colContainer) {\n if ('f7DestroyCalendarEvents' in p.container[0]) p.container[0].f7DestroyCalendarEvents();\n };\n \n // Scan Dates Range\n p.dateInRange = function (dayDate, range) {\n var match = false;\n var i;\n if (!range) return false;\n if (Array.isArray(range)) {\n for (i = 0; i < range.length; i ++) {\n if (range[i].from || range[i].to) {\n if (range[i].from && range[i].to) {\n if ((dayDate <= new Date(range[i].to).getTime()) && (dayDate >= new Date(range[i].from).getTime())) {\n match = true;\n }\n }\n else if (range[i].from) {\n if (dayDate >= new Date(range[i].from).getTime()) {\n match = true;\n }\n }\n else if (range[i].to) {\n if (dayDate <= new Date(range[i].to).getTime()) {\n match = true;\n }\n }\n } else if (dayDate === new Date(range[i]).getTime()) {\n match = true;\n }\n }\n }\n else if (range.from || range.to) {\n if (range.from && range.to) {\n if ((dayDate <= new Date(range.to).getTime()) && (dayDate >= new Date(range.from).getTime())) {\n match = true;\n }\n }\n else if (range.from) {\n if (dayDate >= new Date(range.from).getTime()) {\n match = true;\n }\n }\n else if (range.to) {\n if (dayDate <= new Date(range.to).getTime()) {\n match = true;\n }\n }\n }\n else if (typeof range === 'function') {\n match = range(new Date(dayDate));\n }\n return match;\n };\n // Calendar Methods\n p.daysInMonth = function (date) {\n var d = new Date(date);\n return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();\n };\n p.monthHTML = function (date, offset) {\n date = new Date(date);\n var year = date.getFullYear(),\n month = date.getMonth(),\n day = date.getDate();\n if (offset === 'next') {\n if (month === 11) date = new Date(year + 1, 0);\n else date = new Date(year, month + 1, 1);\n }\n if (offset === 'prev') {\n if (month === 0) date = new Date(year - 1, 11);\n else date = new Date(year, month - 1, 1);\n }\n if (offset === 'next' || offset === 'prev') {\n month = date.getMonth();\n year = date.getFullYear();\n }\n var daysInPrevMonth = p.daysInMonth(new Date(date.getFullYear(), date.getMonth()).getTime() - 10 * 24 * 60 * 60 * 1000),\n daysInMonth = p.daysInMonth(date),\n firstDayOfMonthIndex = new Date(date.getFullYear(), date.getMonth()).getDay();\n if (firstDayOfMonthIndex === 0) firstDayOfMonthIndex = 7;\n \n var dayDate, currentValues = [], i, j, k,\n rows = 6, cols = 7,\n monthHTML = '',\n dayIndex = 0 + (p.params.firstDay - 1),\n today = new Date().setHours(0,0,0,0),\n minDate = p.params.minDate ? new Date(p.params.minDate).getTime() : null,\n maxDate = p.params.maxDate ? new Date(p.params.maxDate).getTime() : null,\n disabled,\n hasEvent;\n \n if (p.value && p.value.length) {\n for (i = 0; i < p.value.length; i++) {\n currentValues.push(new Date(p.value[i]).setHours(0,0,0,0));\n }\n }\n \n for (i = 1; i <= rows; i++) {\n var rowHTML = '';\n var row = i;\n for (j = 1; j <= cols; j++) {\n var col = j;\n dayIndex ++;\n var dayNumber = dayIndex - firstDayOfMonthIndex;\n var weekDayIndex = (col - 1 + p.params.firstDay > 6) ? (col - 1 - 7 + p.params.firstDay) : (col - 1 + p.params.firstDay);\n var addClass = '';\n if (dayNumber < 0) {\n dayNumber = daysInPrevMonth + dayNumber + 1;\n addClass += ' picker-calendar-day-prev';\n dayDate = new Date(month - 1 < 0 ? year - 1 : year, month - 1 < 0 ? 11 : month - 1, dayNumber).getTime();\n }\n else {\n dayNumber = dayNumber + 1;\n if (dayNumber > daysInMonth) {\n dayNumber = dayNumber - daysInMonth;\n addClass += ' picker-calendar-day-next';\n dayDate = new Date(month + 1 > 11 ? year + 1 : year, month + 1 > 11 ? 0 : month + 1, dayNumber).getTime();\n }\n else {\n dayDate = new Date(year, month, dayNumber).getTime();\n }\n }\n // Today\n if (dayDate === today) addClass += ' picker-calendar-day-today';\n // Selected\n if (p.params.rangePicker && currentValues.length === 2) {\n if (dayDate >= currentValues[0] && dayDate <= currentValues[1]) addClass += ' picker-calendar-day-selected';\n }\n else {\n if (currentValues.indexOf(dayDate) >= 0) addClass += ' picker-calendar-day-selected';\n }\n // Weekend\n if (p.params.weekendDays.indexOf(weekDayIndex) >= 0) {\n addClass += ' picker-calendar-day-weekend';\n }\n // Has Events\n hasEvent = false;\n if (p.params.events) {\n if (p.dateInRange(dayDate, p.params.events)) {\n hasEvent = true;\n }\n }\n if (hasEvent) {\n addClass += ' picker-calendar-day-has-events';\n }\n // Custom Ranges\n if (p.params.rangesClasses) {\n for (k = 0; k < p.params.rangesClasses.length; k++) {\n if (p.dateInRange(dayDate, p.params.rangesClasses[k].range)) {\n addClass += ' ' + p.params.rangesClasses[k].cssClass;\n }\n }\n }\n // Disabled\n disabled = false;\n if ((minDate && dayDate < minDate) || (maxDate && dayDate > maxDate)) {\n disabled = true;\n }\n if (p.params.disabled) {\n if (p.dateInRange(dayDate, p.params.disabled)) {\n disabled = true;\n }\n }\n if (disabled) {\n addClass += ' picker-calendar-day-disabled';\n }\n \n \n dayDate = new Date(dayDate);\n var dayYear = dayDate.getFullYear();\n var dayMonth = dayDate.getMonth();\n rowHTML += '
'+dayNumber+'
';\n }\n monthHTML += '
' + rowHTML + '
';\n }\n monthHTML = '
' + monthHTML + '
';\n return monthHTML;\n };\n p.animating = false;\n p.updateCurrentMonthYear = function (dir) {\n if (typeof dir === 'undefined') {\n p.currentMonth = parseInt(p.months.eq(1).attr('data-month'), 10);\n p.currentYear = parseInt(p.months.eq(1).attr('data-year'), 10);\n }\n else {\n p.currentMonth = parseInt(p.months.eq(dir === 'next' ? (p.months.length - 1) : 0).attr('data-month'), 10);\n p.currentYear = parseInt(p.months.eq(dir === 'next' ? (p.months.length - 1) : 0).attr('data-year'), 10);\n }\n p.container.find('.current-month-value').text(p.params.monthNames[p.currentMonth]);\n p.container.find('.current-year-value').text(p.currentYear);\n \n };\n p.onMonthChangeStart = function (dir) {\n p.updateCurrentMonthYear(dir);\n p.months.removeClass('picker-calendar-month-current picker-calendar-month-prev picker-calendar-month-next');\n var currentIndex = dir === 'next' ? p.months.length - 1 : 0;\n \n p.months.eq(currentIndex).addClass('picker-calendar-month-current');\n p.months.eq(dir === 'next' ? currentIndex - 1 : currentIndex + 1).addClass(dir === 'next' ? 'picker-calendar-month-prev' : 'picker-calendar-month-next');\n \n if (p.params.onMonthYearChangeStart) {\n p.params.onMonthYearChangeStart(p, p.currentYear, p.currentMonth);\n }\n };\n p.onMonthChangeEnd = function (dir, rebuildBoth) {\n p.animating = false;\n var nextMonthHTML, prevMonthHTML, newMonthHTML;\n p.wrapper.find('.picker-calendar-month:not(.picker-calendar-month-prev):not(.picker-calendar-month-current):not(.picker-calendar-month-next)').remove();\n \n if (typeof dir === 'undefined') {\n dir = 'next';\n rebuildBoth = true;\n }\n if (!rebuildBoth) {\n newMonthHTML = p.monthHTML(new Date(p.currentYear, p.currentMonth), dir);\n }\n else {\n p.wrapper.find('.picker-calendar-month-next, .picker-calendar-month-prev').remove();\n prevMonthHTML = p.monthHTML(new Date(p.currentYear, p.currentMonth), 'prev');\n nextMonthHTML = p.monthHTML(new Date(p.currentYear, p.currentMonth), 'next');\n }\n if (dir === 'next' || rebuildBoth) {\n p.wrapper.append(newMonthHTML || nextMonthHTML);\n }\n if (dir === 'prev' || rebuildBoth) {\n p.wrapper.prepend(newMonthHTML || prevMonthHTML);\n }\n p.months = p.wrapper.find('.picker-calendar-month');\n p.setMonthsTranslate(p.monthsTranslate);\n if (p.params.onMonthAdd) {\n p.params.onMonthAdd(p, dir === 'next' ? p.months.eq(p.months.length - 1)[0] : p.months.eq(0)[0]);\n }\n if (p.params.onMonthYearChangeEnd) {\n p.params.onMonthYearChangeEnd(p, p.currentYear, p.currentMonth);\n }\n };\n p.setMonthsTranslate = function (translate) {\n translate = translate || p.monthsTranslate || 0;\n if (typeof p.monthsTranslate === 'undefined') p.monthsTranslate = translate;\n p.months.removeClass('picker-calendar-month-current picker-calendar-month-prev picker-calendar-month-next');\n var prevMonthTranslate = -(translate + 1) * 100 * inverter;\n var currentMonthTranslate = -translate * 100 * inverter;\n var nextMonthTranslate = -(translate - 1) * 100 * inverter;\n p.months.eq(0).transform('translate3d(' + (p.isH ? prevMonthTranslate : 0) + '%, ' + (p.isH ? 0 : prevMonthTranslate) + '%, 0)').addClass('picker-calendar-month-prev');\n p.months.eq(1).transform('translate3d(' + (p.isH ? currentMonthTranslate : 0) + '%, ' + (p.isH ? 0 : currentMonthTranslate) + '%, 0)').addClass('picker-calendar-month-current');\n p.months.eq(2).transform('translate3d(' + (p.isH ? nextMonthTranslate : 0) + '%, ' + (p.isH ? 0 : nextMonthTranslate) + '%, 0)').addClass('picker-calendar-month-next');\n };\n p.nextMonth = function (transition) {\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n transition = '';\n if (!p.params.animate) transition = 0;\n }\n var nextMonth = parseInt(p.months.eq(p.months.length - 1).attr('data-month'), 10);\n var nextYear = parseInt(p.months.eq(p.months.length - 1).attr('data-year'), 10);\n var nextDate = new Date(nextYear, nextMonth);\n var nextDateTime = nextDate.getTime();\n var transitionEndCallback = p.animating ? false : true;\n if (p.params.maxDate) {\n if (nextDateTime > new Date(p.params.maxDate).getTime()) {\n return p.resetMonth();\n }\n }\n p.monthsTranslate --;\n if (nextMonth === p.currentMonth) {\n var nextMonthTranslate = -(p.monthsTranslate) * 100 * inverter;\n var nextMonthHTML = $(p.monthHTML(nextDateTime, 'next')).transform('translate3d(' + (p.isH ? nextMonthTranslate : 0) + '%, ' + (p.isH ? 0 : nextMonthTranslate) + '%, 0)').addClass('picker-calendar-month-next');\n p.wrapper.append(nextMonthHTML[0]);\n p.months = p.wrapper.find('.picker-calendar-month');\n if (p.params.onMonthAdd) {\n p.params.onMonthAdd(p, p.months.eq(p.months.length - 1)[0]);\n }\n }\n p.animating = true;\n p.onMonthChangeStart('next');\n var translate = (p.monthsTranslate * 100) * inverter;\n \n p.wrapper.transition(transition).transform('translate3d(' + (p.isH ? translate : 0) + '%, ' + (p.isH ? 0 : translate) + '%, 0)');\n if (transitionEndCallback) {\n p.wrapper.transitionEnd(function () {\n p.onMonthChangeEnd('next');\n });\n }\n if (!p.params.animate) {\n p.onMonthChangeEnd('next');\n }\n };\n p.prevMonth = function (transition) {\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n transition = '';\n if (!p.params.animate) transition = 0;\n }\n var prevMonth = parseInt(p.months.eq(0).attr('data-month'), 10);\n var prevYear = parseInt(p.months.eq(0).attr('data-year'), 10);\n var prevDate = new Date(prevYear, prevMonth + 1, -1);\n var prevDateTime = prevDate.getTime();\n var transitionEndCallback = p.animating ? false : true;\n if (p.params.minDate) {\n if (prevDateTime < new Date(p.params.minDate).getTime()) {\n return p.resetMonth();\n }\n }\n p.monthsTranslate ++;\n if (prevMonth === p.currentMonth) {\n var prevMonthTranslate = -(p.monthsTranslate) * 100 * inverter;\n var prevMonthHTML = $(p.monthHTML(prevDateTime, 'prev')).transform('translate3d(' + (p.isH ? prevMonthTranslate : 0) + '%, ' + (p.isH ? 0 : prevMonthTranslate) + '%, 0)').addClass('picker-calendar-month-prev');\n p.wrapper.prepend(prevMonthHTML[0]);\n p.months = p.wrapper.find('.picker-calendar-month');\n if (p.params.onMonthAdd) {\n p.params.onMonthAdd(p, p.months.eq(0)[0]);\n }\n }\n p.animating = true;\n p.onMonthChangeStart('prev');\n var translate = (p.monthsTranslate * 100) * inverter;\n p.wrapper.transition(transition).transform('translate3d(' + (p.isH ? translate : 0) + '%, ' + (p.isH ? 0 : translate) + '%, 0)');\n if (transitionEndCallback) {\n p.wrapper.transitionEnd(function () {\n p.onMonthChangeEnd('prev');\n });\n }\n if (!p.params.animate) {\n p.onMonthChangeEnd('prev');\n }\n };\n p.resetMonth = function (transition) {\n if (typeof transition === 'undefined') transition = '';\n var translate = (p.monthsTranslate * 100) * inverter;\n p.wrapper.transition(transition).transform('translate3d(' + (p.isH ? translate : 0) + '%, ' + (p.isH ? 0 : translate) + '%, 0)');\n };\n p.setYearMonth = function (year, month, transition) {\n if (typeof year === 'undefined') year = p.currentYear;\n if (typeof month === 'undefined') month = p.currentMonth;\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n transition = '';\n if (!p.params.animate) transition = 0;\n }\n var targetDate;\n if (year < p.currentYear) {\n targetDate = new Date(year, month + 1, -1).getTime();\n }\n else {\n targetDate = new Date(year, month).getTime();\n }\n if (p.params.maxDate && targetDate > new Date(p.params.maxDate).getTime()) {\n return false;\n }\n if (p.params.minDate && targetDate < new Date(p.params.minDate).getTime()) {\n return false;\n }\n var currentDate = new Date(p.currentYear, p.currentMonth).getTime();\n var dir = targetDate > currentDate ? 'next' : 'prev';\n var newMonthHTML = p.monthHTML(new Date(year, month));\n p.monthsTranslate = p.monthsTranslate || 0;\n var prevTranslate = p.monthsTranslate;\n var monthTranslate, wrapperTranslate;\n var transitionEndCallback = p.animating ? false : true;\n if (targetDate > currentDate) {\n // To next\n p.monthsTranslate --;\n if (!p.animating) p.months.eq(p.months.length - 1).remove();\n p.wrapper.append(newMonthHTML);\n p.months = p.wrapper.find('.picker-calendar-month');\n monthTranslate = -(prevTranslate - 1) * 100 * inverter;\n p.months.eq(p.months.length - 1).transform('translate3d(' + (p.isH ? monthTranslate : 0) + '%, ' + (p.isH ? 0 : monthTranslate) + '%, 0)').addClass('picker-calendar-month-next');\n }\n else {\n // To prev\n p.monthsTranslate ++;\n if (!p.animating) p.months.eq(0).remove();\n p.wrapper.prepend(newMonthHTML);\n p.months = p.wrapper.find('.picker-calendar-month');\n monthTranslate = -(prevTranslate + 1) * 100 * inverter;\n p.months.eq(0).transform('translate3d(' + (p.isH ? monthTranslate : 0) + '%, ' + (p.isH ? 0 : monthTranslate) + '%, 0)').addClass('picker-calendar-month-prev');\n }\n if (p.params.onMonthAdd) {\n p.params.onMonthAdd(p, dir === 'next' ? p.months.eq(p.months.length - 1)[0] : p.months.eq(0)[0]);\n }\n p.animating = true;\n p.onMonthChangeStart(dir);\n wrapperTranslate = (p.monthsTranslate * 100) * inverter;\n p.wrapper.transition(transition).transform('translate3d(' + (p.isH ? wrapperTranslate : 0) + '%, ' + (p.isH ? 0 : wrapperTranslate) + '%, 0)');\n if (transitionEndCallback) {\n p.wrapper.transitionEnd(function () {\n p.onMonthChangeEnd(dir, true);\n });\n }\n if (!p.params.animate) {\n p.onMonthChangeEnd(dir);\n }\n };\n p.nextYear = function () {\n p.setYearMonth(p.currentYear + 1);\n };\n p.prevYear = function () {\n p.setYearMonth(p.currentYear - 1);\n };\n \n \n // HTML Layout\n p.layout = function () {\n var pickerHTML = '';\n var pickerClass = '';\n var i;\n \n var layoutDate = p.value && p.value.length ? p.value[0] : new Date().setHours(0,0,0,0);\n var prevMonthHTML = p.monthHTML(layoutDate, 'prev');\n var currentMonthHTML = p.monthHTML(layoutDate);\n var nextMonthHTML = p.monthHTML(layoutDate, 'next');\n var monthsHTML = '
' + (prevMonthHTML + currentMonthHTML + nextMonthHTML) + '
';\n // Week days header\n var weekHeaderHTML = '';\n if (p.params.weekHeader) {\n for (i = 0; i < 7; i++) {\n var weekDayIndex = (i + p.params.firstDay > 6) ? (i - 7 + p.params.firstDay) : (i + p.params.firstDay);\n var dayName = p.params.dayNamesShort[weekDayIndex];\n weekHeaderHTML += '
= 0) ? 'picker-calendar-week-day-weekend' : '') + '\"> ' + dayName + '
';\n \n }\n weekHeaderHTML = '
' + weekHeaderHTML + '
';\n }\n pickerClass = 'picker-modal picker-calendar' +\n (p.params.rangePicker ? ' picker-calendar-range' : '') +\n (p.params.cssClass ? ' ' + p.params.cssClass : '');\n var toolbarHTML = p.params.toolbar ? p.params.toolbarTemplate.replace(/{{closeText}}/g, p.params.toolbarCloseText) : '';\n if (p.params.toolbar) {\n toolbarHTML = p.params.toolbarTemplate\n .replace(/{{closeText}}/g, p.params.toolbarCloseText)\n .replace(/{{monthPicker}}/g, (p.params.monthPicker ? p.params.monthPickerTemplate : ''))\n .replace(/{{yearPicker}}/g, (p.params.yearPicker ? p.params.yearPickerTemplate : ''));\n }\n var headerHTML = p.params.header ? p.params.headerTemplate.replace(/{{closeText}}/g, p.params.toolbarCloseText).replace(/{{placeholder}}/g, p.params.headerPlaceholder) : '';\n var footerHTML = p.params.footer ? p.params.footerTemplate.replace(/{{closeText}}/g, p.params.toolbarCloseText) : '';\n \n pickerHTML =\n '
' +\n headerHTML +\n footerHTML +\n toolbarHTML +\n '
' +\n weekHeaderHTML +\n monthsHTML +\n '
' +\n '
';\n \n \n p.pickerHTML = pickerHTML;\n };\n \n // Input Events\n function openOnInput(e) {\n e.preventDefault();\n if (p.opened) return;\n p.open();\n if (p.params.scrollToInput && !isPopover() && !app.params.material) {\n var pageContent = p.input.parents('.page-content');\n if (pageContent.length === 0) return;\n \n var paddingTop = parseInt(pageContent.css('padding-top'), 10),\n paddingBottom = parseInt(pageContent.css('padding-bottom'), 10),\n pageHeight = pageContent[0].offsetHeight - paddingTop - p.container.height(),\n pageScrollHeight = pageContent[0].scrollHeight - paddingTop - p.container.height(),\n newPaddingBottom;\n \n var inputTop = p.input.offset().top - paddingTop + p.input[0].offsetHeight;\n if (inputTop > pageHeight) {\n var scrollTop = pageContent.scrollTop() + inputTop - pageHeight;\n if (scrollTop + pageHeight > pageScrollHeight) {\n newPaddingBottom = scrollTop + pageHeight - pageScrollHeight + paddingBottom;\n if (pageHeight === pageScrollHeight) {\n newPaddingBottom = p.container.height();\n }\n pageContent.css({'padding-bottom': (newPaddingBottom) + 'px'});\n }\n pageContent.scrollTop(scrollTop, 300);\n }\n }\n }\n function closeOnHTMLClick(e) {\n if (inPopover()) return;\n if (p.input && p.input.length > 0) {\n if (e.target !== p.input[0] && $(e.target).parents('.picker-modal').length === 0) p.close();\n }\n else {\n if ($(e.target).parents('.picker-modal').length === 0) p.close();\n }\n }\n \n if (p.params.input) {\n p.input = $(p.params.input);\n if (p.input.length > 0) {\n if (p.params.inputReadOnly) p.input.prop('readOnly', true);\n if (!p.inline) {\n p.input.on('click', openOnInput);\n }\n if (p.params.inputReadOnly) {\n p.input.on('focus mousedown', function (e) {\n e.preventDefault();\n });\n }\n }\n \n }\n \n if (!p.inline && p.params.closeByOutsideClick) $('html').on('click', closeOnHTMLClick);\n \n // Open\n function onPickerClose() {\n p.opened = false;\n if (p.input && p.input.length > 0) {\n p.input.parents('.page-content').css({'padding-bottom': ''});\n if (app.params.material) p.input.trigger('blur');\n }\n if (p.params.onClose) p.params.onClose(p);\n \n // Destroy events\n p.destroyCalendarEvents();\n }\n \n p.opened = false;\n p.open = function () {\n var toPopover = isPopover();\n var updateValue = false;\n if (!p.opened) {\n // Set date value\n if (!p.value) {\n if (p.params.value) {\n p.value = p.params.value;\n updateValue = true;\n }\n }\n \n // Layout\n p.layout();\n \n // Append\n if (toPopover) {\n p.pickerHTML = '
';\n p.popover = app.popover(p.pickerHTML, p.params.input, true);\n p.container = $(p.popover).find('.picker-modal');\n $(p.popover).on('popover:close', function () {\n onPickerClose();\n });\n }\n else if (p.inline) {\n p.container = $(p.pickerHTML);\n p.container.addClass('picker-modal-inline');\n $(p.params.container).append(p.container);\n }\n else {\n p.container = $(app.pickerModal(p.pickerHTML));\n $(p.container)\n .on('picker:close', function () {\n onPickerClose();\n });\n }\n \n // Store calendar instance\n p.container[0].f7Calendar = p;\n p.wrapper = p.container.find('.picker-calendar-months-wrapper');\n \n // Months\n p.months = p.wrapper.find('.picker-calendar-month');\n \n // Update current month and year\n p.updateCurrentMonthYear();\n \n // Set initial translate\n p.monthsTranslate = 0;\n p.setMonthsTranslate();\n \n // Init events\n p.initCalendarEvents();\n \n // Update input value\n if (updateValue) p.updateValue();\n else if (app.params.material && p.value) p.updateValue(true);\n \n // Material Focus\n if (p.input && p.input.length > 0 && app.params.material) {\n p.input.trigger('focus');\n }\n \n }\n \n // Set flag\n p.opened = true;\n p.initialized = true;\n if (p.params.onMonthAdd) {\n p.months.each(function () {\n p.params.onMonthAdd(p, this);\n });\n }\n if (p.params.onOpen) p.params.onOpen(p);\n };\n \n // Close\n p.close = function () {\n if (!p.opened || p.inline) return;\n if (inPopover()) {\n app.closeModal(p.popover);\n return;\n }\n else {\n app.closeModal(p.container);\n return;\n }\n };\n \n // Destroy\n p.destroy = function () {\n p.close();\n if (p.params.input && p.input.length > 0) {\n p.input.off('click focus', openOnInput);\n }\n $('html').off('click', closeOnHTMLClick);\n };\n \n if (p.inline) {\n p.open();\n }\n else {\n if (!p.initialized && p.params.value) p.setValue(p.params.value);\n }\n \n return p;\n };\n app.calendar = function (params) {\n return new Calendar(params);\n };\n \n"," /*======================================================\n ************ Notifications ************\n ======================================================*/\n var _tempNotificationElement;\n app.addNotification = function (params) {\n if (!params) return;\n \n if (typeof params.media === 'undefined') params.media = app.params.notificationMedia;\n if (typeof params.title === 'undefined') params.title = app.params.notificationTitle;\n if (typeof params.subtitle === 'undefined') params.subtitle = app.params.notificationSubtitle;\n if (typeof params.closeIcon === 'undefined') params.closeIcon = app.params.notificationCloseIcon;\n if (typeof params.hold === 'undefined') params.hold = app.params.notificationHold;\n if (typeof params.closeOnClick === 'undefined') params.closeOnClick = app.params.notificationCloseOnClick;\n if (typeof params.button === 'undefined') params.button = app.params.notificationCloseButtonText && {\n text: app.params.notificationCloseButtonText,\n close: true\n };\n \n if (!_tempNotificationElement) _tempNotificationElement = document.createElement('div');\n \n params.material = app.params.material;\n \n var container = $('.notifications');\n if (container.length === 0) {\n app.root.append('
');\n container = $('.notifications');\n }\n var list = container.children('ul');\n \n var notificationTemplate = app.params.notificationTemplate || \n '{{#if custom}}' +\n '
{{custom}}' +\n '{{else}}' +\n '
' +\n '' +\n '{{#if material}}' +\n '
' +\n '
{{js \"this.message || this.title || this.subtitle\"}}
' +\n '{{#if ../button}}{{#button}}' +\n '
' +\n '{{/button}}{{/if}}' +\n '
' +\n '{{else}}' +\n '{{#if media}}' +\n '
{{media}}
' +\n '{{/if}}' +\n '
' +\n '
' +\n '{{#if title}}' +\n '
{{title}}
' +\n '{{/if}}' +\n '{{#if closeIcon}}' +\n '
' +\n '{{/if}}' +\n '
' +\n '{{#if subtitle}}' +\n '
{{subtitle}}
' +\n '{{/if}}' +\n '{{#if message}}' +\n '
{{message}}
' +\n '
' +\n '{{/if}}' +\n '{{/if}}' +\n '
' +\n '' +\n '{{/if}}';\n if (!app._compiledTemplates.notification) {\n app._compiledTemplates.notification = t7.compile(notificationTemplate);\n }\n _tempNotificationElement.innerHTML = app._compiledTemplates.notification(params);\n \n var item = $(_tempNotificationElement).children();\n \n item.on('click', function (e) {\n var close = false;\n var target = $(e.target);\n if (params.material && target.hasClass('button')) {\n if (params.button && params.button.onClick) params.button.onClick.call(target[0], e, item[0]);\n }\n if (target.is('.close-notification') || $(e.target).parents('.close-notification').length > 0) {\n close = true;\n }\n else {\n if (params.onClick) params.onClick(e, item[0]);\n if (params.closeOnClick) close = true;\n }\n if (close) app.closeNotification(item[0], e);\n });\n if (params.onClose) {\n item.data('f7NotificationOnClose', function (e) {\n params.onClose(item[0], e);\n });\n }\n if (params.additionalClass) {\n item.addClass(params.additionalClass);\n }\n if (params.hold) {\n setTimeout(function () {\n if (item.length > 0) app.closeNotification(item[0]);\n }, params.hold);\n }\n \n if (!app.params.material) {\n app.closeNotification(list.children('li.notification-item:last-child'));\n }\n list.append(item[0]);\n container.show();\n \n var itemHeight = item.outerHeight(), clientLeft;\n if (params.material) {\n container.transform('translate3d(0, '+itemHeight+'px, 0)');\n container.transition(0);\n \n clientLeft = item[0].clientLeft;\n \n container.transform('translate3d(0, 0, 0)');\n container.transition('');\n }\n else {\n item.transform('translate3d(0,' + (-itemHeight) + 'px,0)');\n item.transition(0);\n \n clientLeft = item[0].clientLeft;\n \n item.transition('');\n item.transform('translate3d(0,0px,0)');\n }\n \n container.transform('translate3d(0, 0,0)');\n item.removeClass('notification-hidden');\n \n return item[0];\n };\n app.closeNotification = function (item, event) {\n item = $(item);\n if (item.length === 0) return;\n if (item.hasClass('notification-item-removing')) return;\n var container = $('.notifications');\n \n var itemHeight = item.outerHeight();\n item.css('height', itemHeight + 'px').transition(0).addClass('notification-item-removing');\n var clientLeft = item[0].clientLeft;\n \n item.css({\n height: '0px',\n marginBottom: '0px'\n }).transition('');\n \n if (item.data('f7NotificationOnClose')) item.data('f7NotificationOnClose')(event);\n \n if (container.find('.notification-item:not(.notification-item-removing)').length === 0) {\n container.transform('');\n }\n \n item.addClass('notification-hidden').transitionEnd(function () {\n item.remove();\n if (container.find('.notification-item').length === 0) {\n container.hide();\n }\n });\n };\n"," /*===============================================================================\n ************ Data Table ************\n ===============================================================================*/\n app.initDataTable = function (table) {\n table = $(table);\n var tableHeader = table.find('.data-table-header');\n var tableHeaderSelected = table.find('.data-table-header-selected');\n \n // Handle selected\n function checkSelectedHeader() {\n if (tableHeader.length > 0 && tableHeaderSelected.length > 0) {\n var checkedItems = table.find('tbody .checkbox-cell input:checked').length;\n table[checkedItems > 0 ? 'addClass' : 'removeClass']('data-table-has-checked');\n tableHeaderSelected.find('.data-table-selected-count').text(checkedItems);\n }\n }\n table.on('change', '.checkbox-cell input[type=\"checkbox\"]', function (e) {\n if (e.detail && e.detail._sentByF7DataTable) {\n // Scripted event, don't do anything\n return;\n }\n var input = $(this);\n var checked = input[0].checked;\n if (input.parents('thead').length > 0) {\n table\n .find('tbody tr')[checked ? 'addClass': 'removeClass']('data-table-row-selected')\n .find('input').prop('checked', checked).trigger('change', {_sentByF7DataTable: true});\n }\n else {\n input.parents('tr')[checked ? 'addClass': 'removeClass']('data-table-row-selected');\n if (!checked) {\n table.find('thead .checkbox-cell input[type=\"checkbox\"]').prop('checked', false);\n }\n else {\n // Check for all checked\n if (table.find('tbody .checkbox-cell input[type=\"checkbox\"]:checked').length === table.find('tbody tr').length) {\n table.find('thead .checkbox-cell input[type=\"checkbox\"]').prop('checked', true).trigger('change', {_sentByF7DataTable: true});\n }\n }\n }\n checkSelectedHeader();\n });\n checkSelectedHeader();\n \n // Sortable\n table.find('thead .sortable-cell').on('click', function () {\n var cell = $(this);\n var isActive = cell.hasClass('sortable-active');\n var currentSort;\n if (isActive) {\n currentSort = cell.hasClass('sortable-desc') ? 'desc' : 'asc';\n cell.removeClass('sortable-desc sortable-asc').addClass('sortable-' + (currentSort === 'desc' ? 'asc' : 'desc'));\n }\n else {\n table.find('thead .sortable-active').removeClass('sortable-active');\n cell.addClass('sortable-active');\n }\n });\n \n // Collapsible\n if (table.hasClass('data-table-collapsible')) {\n table.find('tbody td:not(.checkbox-cell)').each(function () {\n var index = $(this).index();\n var collpsibleTitle = $(this).attr('data-collapsible-title');\n if (!collpsibleTitle && collpsibleTitle !== '') {\n $(this).attr('data-collapsible-title', table.find('thead th').eq(index).text());\n }\n });\n }\n };\n app.initPageDataTables = function (pageContainer) {\n pageContainer = $(pageContainer);\n var dataTables = pageContainer.find('.data-table-init');\n if (dataTables.length === 0 && pageContainer.hasClass('data-table-init')) {\n dataTables = pageContainer;\n }\n dataTables.each(function () {\n app.initDataTable(this);\n });\n };\n \n"," /*===========================\n Compile Template7 Templates On App Init\n ===========================*/\n app.initTemplate7Templates = function () {\n if (!window.Template7) return;\n Template7.templates = Template7.templates || app.params.templates || {};\n Template7.data = Template7.data || app.params.template7Data || {};\n Template7.cache = Template7.cache || {};\n \n app.templates = Template7.templates;\n app.template7Data = Template7.data;\n app.template7Cache = Template7.cache;\n \n // Precompile templates on app init\n if (!app.params.precompileTemplates) return;\n $('script[type=\"text/template7\"]').each(function () {\n var id = $(this).attr('id');\n if (!id) return;\n Template7.templates[id] = Template7.compile($(this).html());\n });\n };\n \n"," /*=======================================\n ************ Plugins API ************\n =======================================*/\n var _plugins = [];\n app.initPlugins = function () {\n // Initialize plugins\n for (var plugin in app.plugins) {\n var p = app.plugins[plugin](app, app.params[plugin]);\n if (p) _plugins.push(p);\n }\n };\n // Plugin Hooks\n app.pluginHook = function (hook) {\n for (var i = 0; i < _plugins.length; i++) {\n if (_plugins[i].hooks && hook in _plugins[i].hooks) {\n _plugins[i].hooks[hook](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n }\n }\n };\n // Prevented by plugin\n app.pluginPrevent = function (action) {\n var prevent = false;\n for (var i = 0; i < _plugins.length; i++) {\n if (_plugins[i].prevents && action in _plugins[i].prevents) {\n if (_plugins[i].prevents[action](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])) prevent = true;\n }\n }\n return prevent;\n };\n // Preprocess content by plugin\n app.pluginProcess = function (process, data) {\n var processed = data;\n for (var i = 0; i < _plugins.length; i++) {\n if (_plugins[i].preprocess && process in _plugins[i].preprocess) {\n processed = _plugins[i].preprocess[process](data, arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]);\n }\n }\n return processed;\n };\n \n \n"," /*======================================================\n ************ App Init ************\n ======================================================*/\n app.init = function () {\n // Compile Template7 templates on app load\n if (app.initTemplate7Templates) app.initTemplate7Templates();\n \n // Init Plugins\n if (app.initPlugins) app.initPlugins();\n \n // Init Device\n if (app.getDeviceInfo) app.getDeviceInfo();\n \n // Init resize events and calc app sizes\n if (app.initResize) app.initResize();\n \n // Init Panels Breakpoints\n if (app.initPanelsBreakpoints && (app.params.panelLeftBreakpoint || app.params.panelRightBreakpoint)) app.initPanelsBreakpoints();\n \n // Init Click events\n if (app.initFastClicks && app.params.fastClicks) app.initFastClicks();\n if (app.initClickEvents) app.initClickEvents();\n \n // Init each page callbacks\n $('.page:not(.cached)').each(function () {\n app.initPageWithCallback(this);\n });\n \n // Init each navbar callbacks\n $('.navbar:not(.cached)').each(function () {\n app.initNavbarWithCallback(this);\n });\n \n // Init push state\n if (app.initPushState && app.params.pushState) app.initPushState();\n \n // Init Live Swipeouts events\n if (app.initSwipeout && app.params.swipeout) app.initSwipeout();\n \n // Init Live Sortable events\n if (app.initSortable && app.params.sortable) app.initSortable();\n \n // Init Live Swipe Panels\n if (app.initSwipePanels && (app.params.swipePanel || app.params.swipePanelOnlyClose)) app.initSwipePanels();\n \n // Init Material Inputs\n if (app.params.material && app.initMaterialWatchInputs) app.initMaterialWatchInputs();\n \n // Init Material Tabbar\n if (app.params.material) {\n $('.tabbar').each(function (index, el) {\n if ($(el).parents('.page').length === 0) {\n app.initMaterialTabbar(el);\n }\n });\n }\n \n // App Init callback\n if (app.params.onAppInit) app.params.onAppInit();\n \n // Plugin app init hook\n app.pluginHook('appInit');\n };\n if (app.params.init) app.init();\n \n"," //Return instance\n return app;\n };\n \n // Save Dom7\n Framework7.$ = window.Dom7;\n \n"," /*===========================\n Features Support Detection\n ===========================*/\n Framework7.prototype.support = (function () {\n var support = {\n touch: !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch),\n passiveListener: (function () {\n var supportsPassive = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function() {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassiveListener', null, opts);\n } catch (e) {}\n return supportsPassive;\n })()\n };\n \n // Export object\n return support;\n })();\n \n"," /*===========================\n Device/OS Detection\n ===========================*/\n Framework7.prototype.device = (function () {\n var device = {};\n var ua = navigator.userAgent;\n var $ = Dom7;\n \n var windows = ua.match(/(Windows Phone);?[\\s\\/]+([\\d.]+)?/);\n var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/);\n var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n var ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n var iphone = !ipad && ua.match(/(iPhone\\sOS|iOS)\\s([\\d_]+)/);\n \n device.ios = device.android = device.windows = device.iphone = device.ipod = device.ipad = device.androidChrome = false;\n \n // Windows\n if (windows) {\n device.os = 'windows';\n device.osVersion = windows[2];\n device.windows = true;\n }\n // Android\n if (android && !windows) {\n device.os = 'android';\n device.osVersion = android[2];\n device.android = true;\n device.androidChrome = ua.toLowerCase().indexOf('chrome') >= 0;\n }\n if (ipad || iphone || ipod) {\n device.os = 'ios';\n device.ios = true;\n }\n // iOS\n if (iphone && !ipod) {\n device.osVersion = iphone[2].replace(/_/g, '.');\n device.iphone = true;\n }\n if (ipad) {\n device.osVersion = ipad[2].replace(/_/g, '.');\n device.ipad = true;\n }\n if (ipod) {\n device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;\n device.iphone = true;\n }\n // iOS 8+ changed UA\n if (device.ios && device.osVersion && ua.indexOf('Version/') >= 0) {\n if (device.osVersion.split('.')[0] === '10') {\n device.osVersion = ua.toLowerCase().split('version/')[1].split(' ')[0];\n }\n }\n \n // Webview\n device.webView = (iphone || ipad || ipod) && ua.match(/.*AppleWebKit(?!.*Safari)/i);\n \n // Minimal UI\n if (device.os && device.os === 'ios') {\n var osVersionArr = device.osVersion.split('.');\n device.minimalUi = !device.webView &&\n (ipod || iphone) &&\n (osVersionArr[0] * 1 === 7 ? osVersionArr[1] * 1 >= 1 : osVersionArr[0] * 1 > 7) &&\n $('meta[name=\"viewport\"]').length > 0 && $('meta[name=\"viewport\"]').attr('content').indexOf('minimal-ui') >= 0;\n }\n \n // Check for status bar and fullscreen app mode\n var windowWidth = $(window).width();\n var windowHeight = $(window).height();\n \n device.needsStatusBar = function () {\n if (device.webView && (windowWidth * windowHeight === screen.width * screen.height)) {\n return true;\n }\n return false;\n };\n device.statusBar = device.needsStatusBar();\n \n // Classes\n var classNames = [];\n \n // Pixel Ratio\n device.pixelRatio = window.devicePixelRatio || 1;\n classNames.push('pixel-ratio-' + Math.floor(device.pixelRatio));\n if (device.pixelRatio >= 2) {\n classNames.push('retina');\n }\n \n // OS classes\n if (device.os) {\n classNames.push(device.os, device.os + '-' + device.osVersion.split('.')[0], device.os + '-' + device.osVersion.replace(/\\./g, '-'));\n if (device.os === 'ios') {\n var major = parseInt(device.osVersion.split('.')[0], 10);\n for (var i = major - 1; i >= 6; i--) {\n classNames.push('ios-gt-' + i);\n }\n }\n \n }\n // Status bar classes\n if (device.statusBar) {\n classNames.push('with-statusbar-overlay');\n }\n else {\n $('html').removeClass('with-statusbar-overlay');\n }\n \n // Add html classes\n if (classNames.length > 0) $('html').addClass(classNames.join(' '));\n \n // Export object\n return device;\n })();\n \n"," /*===========================\n Plugins prototype\n ===========================*/\n Framework7.prototype.plugins = {};\n \n"," /*===========================\n Swiper\n ===========================*/\n window.Swiper = function (container, params) {\n if (!(this instanceof Swiper)) return new Swiper(container, params);\n \n var defaults = {\n direction: 'horizontal',\n touchEventsTarget: 'container',\n initialSlide: 0,\n speed: 300,\n // autoplay\n autoplay: false,\n autoplayDisableOnInteraction: true,\n autoplayStopOnLast: false,\n // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).\n iOSEdgeSwipeDetection: false,\n iOSEdgeSwipeThreshold: 20,\n // Free mode\n freeMode: false,\n freeModeMomentum: true,\n freeModeMomentumRatio: 1,\n freeModeMomentumBounce: true,\n freeModeMomentumBounceRatio: 1,\n freeModeMomentumVelocityRatio: 1,\n freeModeSticky: false,\n freeModeMinimumVelocity: 0.02,\n // Autoheight\n autoHeight: false,\n // Set wrapper width\n setWrapperSize: false,\n // Virtual Translate\n virtualTranslate: false,\n // Effects\n effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'\n coverflow: {\n rotate: 50,\n stretch: 0,\n depth: 100,\n modifier: 1,\n slideShadows : true\n },\n flip: {\n slideShadows : true,\n limitRotation: true\n },\n cube: {\n slideShadows: true,\n shadow: true,\n shadowOffset: 20,\n shadowScale: 0.94\n },\n fade: {\n crossFade: false\n },\n // Parallax\n parallax: false,\n // Zoom\n zoom: false,\n zoomMax: 3,\n zoomMin: 1,\n zoomToggle: true,\n // Scrollbar\n scrollbar: null,\n scrollbarHide: true,\n scrollbarDraggable: false,\n scrollbarSnapOnRelease: false,\n // Keyboard Mousewheel\n keyboardControl: false,\n mousewheelControl: false,\n mousewheelReleaseOnEdges: false,\n mousewheelInvert: false,\n mousewheelForceToAxis: false,\n mousewheelSensitivity: 1,\n mousewheelEventsTarged: 'container',\n // Hash Navigation\n hashnav: false,\n hashnavWatchState: false,\n // History\n history: false,\n // Commong Nav State\n replaceState: false,\n // Breakpoints\n breakpoints: undefined,\n // Slides grid\n spaceBetween: 0,\n slidesPerView: 1,\n slidesPerColumn: 1,\n slidesPerColumnFill: 'column',\n slidesPerGroup: 1,\n centeredSlides: false,\n slidesOffsetBefore: 0, // in px\n slidesOffsetAfter: 0, // in px\n // Round length\n roundLengths: false,\n // Touches\n touchRatio: 1,\n touchAngle: 45,\n simulateTouch: true,\n shortSwipes: true,\n longSwipes: true,\n longSwipesRatio: 0.5,\n longSwipesMs: 300,\n followFinger: true,\n onlyExternal: false,\n threshold: 0,\n touchMoveStopPropagation: true,\n touchReleaseOnEdges: false,\n // Unique Navigation Elements\n uniqueNavElements: true,\n // Pagination\n pagination: null,\n paginationElement: 'span',\n paginationClickable: false,\n paginationHide: false,\n paginationBulletRender: null,\n paginationProgressRender: null,\n paginationFractionRender: null,\n paginationCustomRender: null,\n paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom'\n // Resistance\n resistance: true,\n resistanceRatio: 0.85,\n // Next/prev buttons\n nextButton: null,\n prevButton: null,\n // Progress\n watchSlidesProgress: false,\n watchSlidesVisibility: false,\n // Cursor\n grabCursor: false,\n // Clicks\n preventClicks: true,\n preventClicksPropagation: true,\n slideToClickedSlide: false,\n // Lazy Loading\n lazyLoading: false,\n lazyLoadingInPrevNext: false,\n lazyLoadingInPrevNextAmount: 1,\n lazyLoadingOnTransitionStart: false,\n // Images\n preloadImages: true,\n updateOnImagesReady: true,\n // loop\n loop: false,\n loopAdditionalSlides: 0,\n loopedSlides: null,\n // Control\n control: undefined,\n controlInverse: false,\n controlBy: 'slide', //or 'container'\n normalizeSlideIndex: true,\n // Swiping/no swiping\n allowSwipeToPrev: true,\n allowSwipeToNext: true,\n swipeHandler: null, //'.swipe-handler',\n noSwiping: true,\n noSwipingClass: 'swiper-no-swiping',\n // Passive Listeners\n passiveListeners: true,\n // NS\n containerModifierClass: 'swiper-container-', // NEW\n slideClass: 'swiper-slide',\n slideActiveClass: 'swiper-slide-active',\n slideDuplicateActiveClass: 'swiper-slide-duplicate-active',\n slideVisibleClass: 'swiper-slide-visible',\n slideDuplicateClass: 'swiper-slide-duplicate',\n slideNextClass: 'swiper-slide-next',\n slideDuplicateNextClass: 'swiper-slide-duplicate-next',\n slidePrevClass: 'swiper-slide-prev',\n slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',\n wrapperClass: 'swiper-wrapper',\n bulletClass: 'swiper-pagination-bullet',\n bulletActiveClass: 'swiper-pagination-bullet-active',\n buttonDisabledClass: 'swiper-button-disabled',\n paginationCurrentClass: 'swiper-pagination-current',\n paginationTotalClass: 'swiper-pagination-total',\n paginationHiddenClass: 'swiper-pagination-hidden',\n paginationProgressbarClass: 'swiper-pagination-progressbar',\n paginationClickableClass: 'swiper-pagination-clickable', // NEW\n paginationModifierClass: 'swiper-pagination-', // NEW\n lazyLoadingClass: 'swiper-lazy',\n lazyStatusLoadingClass: 'swiper-lazy-loading',\n lazyStatusLoadedClass: 'swiper-lazy-loaded',\n lazyPreloaderClass: 'swiper-lazy-preloader',\n notificationClass: 'swiper-notification',\n preloaderClass: 'preloader',\n zoomContainerClass: 'swiper-zoom-container',\n \n // Observer\n observer: false,\n observeParents: false,\n // Accessibility\n a11y: false,\n prevSlideMessage: 'Previous slide',\n nextSlideMessage: 'Next slide',\n firstSlideMessage: 'This is the first slide',\n lastSlideMessage: 'This is the last slide',\n paginationBulletMessage: 'Go to slide {{index}}',\n // Callbacks\n runCallbacksOnInit: true\n /*\n Callbacks:\n onInit: function (swiper)\n onDestroy: function (swiper)\n onBeforeResize: function (swiper)\n onAfterResize: function (swiper)\n onClick: function (swiper, e)\n onTap: function (swiper, e)\n onDoubleTap: function (swiper, e)\n onSliderMove: function (swiper, e)\n onSlideChangeStart: function (swiper)\n onSlideChangeEnd: function (swiper)\n onTransitionStart: function (swiper)\n onTransitionEnd: function (swiper)\n onImagesReady: function (swiper)\n onProgress: function (swiper, progress)\n onTouchStart: function (swiper, e)\n onTouchMove: function (swiper, e)\n onTouchMoveOpposite: function (swiper, e)\n onTouchEnd: function (swiper, e)\n onReachBeginning: function (swiper)\n onReachEnd: function (swiper)\n onSetTransition: function (swiper, duration)\n onSetTranslate: function (swiper, translate)\n onAutoplayStart: function (swiper)\n onAutoplayStop: function (swiper),\n onLazyImageLoad: function (swiper, slide, image)\n onLazyImageReady: function (swiper, slide, image)\n onKeyPress: function (swiper, keyCode)\n */\n \n };\n var initialVirtualTranslate = params && params.virtualTranslate;\n \n params = params || {};\n var originalParams = {};\n for (var param in params) {\n if (typeof params[param] === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) {\n originalParams[param] = {};\n for (var deepParam in params[param]) {\n originalParams[param][deepParam] = params[param][deepParam];\n }\n }\n else {\n originalParams[param] = params[param];\n }\n }\n for (var def in defaults) {\n if (typeof params[def] === 'undefined') {\n params[def] = defaults[def];\n }\n else if (typeof params[def] === 'object') {\n for (var deepDef in defaults[def]) {\n if (typeof params[def][deepDef] === 'undefined') {\n params[def][deepDef] = defaults[def][deepDef];\n }\n }\n }\n }\n \n // Swiper\n var s = this;\n \n // Params\n s.params = params;\n s.originalParams = originalParams;\n \n // Classname\n s.classNames = [];\n /*=========================\n Dom Library and plugins\n ===========================*/\n var $ = $;\n if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){\n $ = Dom7;\n }\n if (typeof $ === 'undefined') {\n if (typeof Dom7 === 'undefined') {\n $ = window.Dom7 || window.Zepto || window.jQuery;\n }\n else {\n $ = Dom7;\n }\n if (!$) return;\n }\n // Export it to Swiper instance\n s.$ = $;\n \n /*=========================\n Breakpoints\n ===========================*/\n s.currentBreakpoint = undefined;\n s.getActiveBreakpoint = function () {\n //Get breakpoint for window width\n if (!s.params.breakpoints) return false;\n var breakpoint = false;\n var points = [], point;\n for ( point in s.params.breakpoints ) {\n if (s.params.breakpoints.hasOwnProperty(point)) {\n points.push(point);\n }\n }\n points.sort(function (a, b) {\n return parseInt(a, 10) > parseInt(b, 10);\n });\n for (var i = 0; i < points.length; i++) {\n point = points[i];\n if (point >= window.innerWidth && !breakpoint) {\n breakpoint = point;\n }\n }\n return breakpoint || 'max';\n };\n s.setBreakpoint = function () {\n //Set breakpoint for window width and update parameters\n var breakpoint = s.getActiveBreakpoint();\n if (breakpoint && s.currentBreakpoint !== breakpoint) {\n var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;\n var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);\n for ( var param in breakPointsParams ) {\n s.params[param] = breakPointsParams[param];\n }\n s.currentBreakpoint = breakpoint;\n if(needsReLoop && s.destroyLoop) {\n s.reLoop(true);\n }\n }\n };\n // Set breakpoint on load\n if (s.params.breakpoints) {\n s.setBreakpoint();\n }\n \n /*=========================\n Preparation - Define Container, Wrapper and Pagination\n ===========================*/\n s.container = $(container);\n if (s.container.length === 0) return;\n if (s.container.length > 1) {\n var swipers = [];\n s.container.each(function () {\n var container = this;\n swipers.push(new Swiper(this, params));\n });\n return swipers;\n }\n \n // Save instance in container HTML Element and in data\n s.container[0].swiper = s;\n s.container.data('swiper', s);\n \n s.classNames.push(s.params.containerModifierClass + s.params.direction);\n \n if (s.params.freeMode) {\n s.classNames.push(s.params.containerModifierClass + 'free-mode');\n }\n if (!s.support.flexbox) {\n s.classNames.push(s.params.containerModifierClass + 'no-flexbox');\n s.params.slidesPerColumn = 1;\n }\n if (s.params.autoHeight) {\n s.classNames.push(s.params.containerModifierClass + 'autoheight');\n }\n // Enable slides progress when required\n if (s.params.parallax || s.params.watchSlidesVisibility) {\n s.params.watchSlidesProgress = true;\n }\n // Max resistance when touchReleaseOnEdges\n if (s.params.touchReleaseOnEdges) {\n s.params.resistanceRatio = 0;\n }\n // Coverflow / 3D\n if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) {\n if (s.support.transforms3d) {\n s.params.watchSlidesProgress = true;\n s.classNames.push(s.params.containerModifierClass + '3d');\n }\n else {\n s.params.effect = 'slide';\n }\n }\n if (s.params.effect !== 'slide') {\n s.classNames.push(s.params.containerModifierClass + s.params.effect);\n }\n if (s.params.effect === 'cube') {\n s.params.resistanceRatio = 0;\n s.params.slidesPerView = 1;\n s.params.slidesPerColumn = 1;\n s.params.slidesPerGroup = 1;\n s.params.centeredSlides = false;\n s.params.spaceBetween = 0;\n s.params.virtualTranslate = true;\n }\n if (s.params.effect === 'fade' || s.params.effect === 'flip') {\n s.params.slidesPerView = 1;\n s.params.slidesPerColumn = 1;\n s.params.slidesPerGroup = 1;\n s.params.watchSlidesProgress = true;\n s.params.spaceBetween = 0;\n if (typeof initialVirtualTranslate === 'undefined') {\n s.params.virtualTranslate = true;\n }\n }\n \n // Grab Cursor\n if (s.params.grabCursor && s.support.touch) {\n s.params.grabCursor = false;\n }\n \n // Wrapper\n s.wrapper = s.container.children('.' + s.params.wrapperClass);\n \n // Pagination\n if (s.params.pagination) {\n s.paginationContainer = $(s.params.pagination);\n if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {\n s.paginationContainer = s.container.find(s.params.pagination);\n }\n \n if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {\n s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable');\n }\n else {\n s.params.paginationClickable = false;\n }\n s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType);\n }\n // Next/Prev Buttons\n if (s.params.nextButton || s.params.prevButton) {\n if (s.params.nextButton) {\n s.nextButton = $(s.params.nextButton);\n if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {\n s.nextButton = s.container.find(s.params.nextButton);\n }\n }\n if (s.params.prevButton) {\n s.prevButton = $(s.params.prevButton);\n if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {\n s.prevButton = s.container.find(s.params.prevButton);\n }\n }\n }\n \n // Is Horizontal\n s.isHorizontal = function () {\n return s.params.direction === 'horizontal';\n };\n // s.isH = isH;\n \n // RTL\n s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');\n if (s.rtl) {\n s.classNames.push(s.params.containerModifierClass + 'rtl');\n }\n \n // Wrong RTL support\n if (s.rtl) {\n s.wrongRTL = s.wrapper.css('display') === '-webkit-box';\n }\n \n // Columns\n if (s.params.slidesPerColumn > 1) {\n s.classNames.push(s.params.containerModifierClass + 'multirow');\n }\n \n // Check for Android\n if (s.device.android) {\n s.classNames.push(s.params.containerModifierClass + 'android');\n }\n \n // Add classes\n s.container.addClass(s.classNames.join(' '));\n \n // Translate\n s.translate = 0;\n \n // Progress\n s.progress = 0;\n \n // Velocity\n s.velocity = 0;\n \n /*=========================\n Locks, unlocks\n ===========================*/\n s.lockSwipeToNext = function () {\n s.params.allowSwipeToNext = false;\n if (s.params.allowSwipeToPrev === false && s.params.grabCursor) {\n s.unsetGrabCursor();\n }\n };\n s.lockSwipeToPrev = function () {\n s.params.allowSwipeToPrev = false;\n if (s.params.allowSwipeToNext === false && s.params.grabCursor) {\n s.unsetGrabCursor();\n }\n };\n s.lockSwipes = function () {\n s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;\n if (s.params.grabCursor) s.unsetGrabCursor();\n };\n s.unlockSwipeToNext = function () {\n s.params.allowSwipeToNext = true;\n if (s.params.allowSwipeToPrev === true && s.params.grabCursor) {\n s.setGrabCursor();\n }\n };\n s.unlockSwipeToPrev = function () {\n s.params.allowSwipeToPrev = true;\n if (s.params.allowSwipeToNext === true && s.params.grabCursor) {\n s.setGrabCursor();\n }\n };\n s.unlockSwipes = function () {\n s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;\n if (s.params.grabCursor) s.setGrabCursor();\n };\n \n /*=========================\n Round helper\n ===========================*/\n function round(a) {\n return Math.floor(a);\n }\n /*=========================\n Set grab cursor\n ===========================*/\n s.setGrabCursor = function(moving) {\n s.container[0].style.cursor = 'move';\n s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';\n s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab';\n s.container[0].style.cursor = moving ? 'grabbing': 'grab';\n };\n s.unsetGrabCursor = function () {\n s.container[0].style.cursor = '';\n };\n if (s.params.grabCursor) {\n s.setGrabCursor();\n }\n /*=========================\n Update on Images Ready\n ===========================*/\n s.imagesToLoad = [];\n s.imagesLoaded = 0;\n \n s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) {\n var image;\n function onReady () {\n if (callback) callback();\n }\n if (!imgElement.complete || !checkForComplete) {\n if (src) {\n image = new window.Image();\n image.onload = onReady;\n image.onerror = onReady;\n if (sizes) {\n image.sizes = sizes;\n }\n if (srcset) {\n image.srcset = srcset;\n }\n if (src) {\n image.src = src;\n }\n } else {\n onReady();\n }\n \n } else {//image already loaded...\n onReady();\n }\n };\n s.preloadImages = function () {\n s.imagesToLoad = s.container.find('img');\n function _onReady() {\n if (typeof s === 'undefined' || s === null || !s) return;\n if (s.imagesLoaded !== undefined) s.imagesLoaded++;\n if (s.imagesLoaded === s.imagesToLoad.length) {\n if (s.params.updateOnImagesReady) s.update();\n s.emit('onImagesReady', s);\n }\n }\n for (var i = 0; i < s.imagesToLoad.length; i++) {\n s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), s.imagesToLoad[i].sizes || s.imagesToLoad[i].getAttribute('sizes'), true, _onReady);\n }\n };\n \n /*=========================\n Autoplay\n ===========================*/\n s.autoplayTimeoutId = undefined;\n s.autoplaying = false;\n s.autoplayPaused = false;\n function autoplay() {\n var autoplayDelay = s.params.autoplay;\n var activeSlide = s.slides.eq(s.activeIndex);\n if (activeSlide.attr('data-swiper-autoplay')) {\n autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay;\n }\n s.autoplayTimeoutId = setTimeout(function () {\n if (s.params.loop) {\n s.fixLoop();\n s._slideNext();\n s.emit('onAutoplay', s);\n }\n else {\n if (!s.isEnd) {\n s._slideNext();\n s.emit('onAutoplay', s);\n }\n else {\n if (!params.autoplayStopOnLast) {\n s._slideTo(0);\n s.emit('onAutoplay', s);\n }\n else {\n s.stopAutoplay();\n }\n }\n }\n }, autoplayDelay);\n }\n s.startAutoplay = function () {\n if (typeof s.autoplayTimeoutId !== 'undefined') return false;\n if (!s.params.autoplay) return false;\n if (s.autoplaying) return false;\n s.autoplaying = true;\n s.emit('onAutoplayStart', s);\n autoplay();\n };\n s.stopAutoplay = function (internal) {\n if (!s.autoplayTimeoutId) return;\n if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n s.autoplaying = false;\n s.autoplayTimeoutId = undefined;\n s.emit('onAutoplayStop', s);\n };\n s.pauseAutoplay = function (speed) {\n if (s.autoplayPaused) return;\n if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n s.autoplayPaused = true;\n if (speed === 0) {\n s.autoplayPaused = false;\n autoplay();\n }\n else {\n s.wrapper.transitionEnd(function () {\n if (!s) return;\n s.autoplayPaused = false;\n if (!s.autoplaying) {\n s.stopAutoplay();\n }\n else {\n autoplay();\n }\n });\n }\n };\n /*=========================\n Min/Max Translate\n ===========================*/\n s.minTranslate = function () {\n return (-s.snapGrid[0]);\n };\n s.maxTranslate = function () {\n return (-s.snapGrid[s.snapGrid.length - 1]);\n };\n /*=========================\n Slider/slides sizes\n ===========================*/\n s.updateAutoHeight = function () {\n var activeSlides = [];\n var newHeight = 0;\n var i;\n \n // Find slides currently in view\n if(s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) {\n for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) {\n var index = s.activeIndex + i;\n if(index > s.slides.length) break;\n activeSlides.push(s.slides.eq(index)[0]);\n }\n } else {\n activeSlides.push(s.slides.eq(s.activeIndex)[0]);\n }\n \n // Find new height from heighest slide in view\n for (i = 0; i < activeSlides.length; i++) {\n if (typeof activeSlides[i] !== 'undefined') {\n var height = activeSlides[i].offsetHeight;\n newHeight = height > newHeight ? height : newHeight;\n }\n }\n \n // Update Height\n if (newHeight) s.wrapper.css('height', newHeight + 'px');\n };\n s.updateContainerSize = function () {\n var width, height;\n if (typeof s.params.width !== 'undefined') {\n width = s.params.width;\n }\n else {\n width = s.container[0].clientWidth;\n }\n if (typeof s.params.height !== 'undefined') {\n height = s.params.height;\n }\n else {\n height = s.container[0].clientHeight;\n }\n if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) {\n return;\n }\n \n //Subtract paddings\n width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);\n height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);\n \n // Store values\n s.width = width;\n s.height = height;\n s.size = s.isHorizontal() ? s.width : s.height;\n };\n \n s.updateSlidesSize = function () {\n s.slides = s.wrapper.children('.' + s.params.slideClass);\n s.snapGrid = [];\n s.slidesGrid = [];\n s.slidesSizesGrid = [];\n \n var spaceBetween = s.params.spaceBetween,\n slidePosition = -s.params.slidesOffsetBefore,\n i,\n prevSlideSize = 0,\n index = 0;\n if (typeof s.size === 'undefined') return;\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;\n }\n \n s.virtualSize = -spaceBetween;\n // reset margins\n if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''});\n else s.slides.css({marginRight: '', marginBottom: ''});\n \n var slidesNumberEvenToRows;\n if (s.params.slidesPerColumn > 1) {\n if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {\n slidesNumberEvenToRows = s.slides.length;\n }\n else {\n slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;\n }\n if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {\n slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);\n }\n }\n \n // Calc slides\n var slideSize;\n var slidesPerColumn = s.params.slidesPerColumn;\n var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;\n var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);\n for (i = 0; i < s.slides.length; i++) {\n slideSize = 0;\n var slide = s.slides.eq(i);\n if (s.params.slidesPerColumn > 1) {\n // Set slides order\n var newSlideOrderIndex;\n var column, row;\n if (s.params.slidesPerColumnFill === 'column') {\n column = Math.floor(i / slidesPerColumn);\n row = i - column * slidesPerColumn;\n if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) {\n if (++row >= slidesPerColumn) {\n row = 0;\n column++;\n }\n }\n newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;\n slide\n .css({\n '-webkit-box-ordinal-group': newSlideOrderIndex,\n '-moz-box-ordinal-group': newSlideOrderIndex,\n '-ms-flex-order': newSlideOrderIndex,\n '-webkit-order': newSlideOrderIndex,\n 'order': newSlideOrderIndex\n });\n }\n else {\n row = Math.floor(i / slidesPerRow);\n column = i - row * slidesPerRow;\n }\n slide\n .css(\n 'margin-' + (s.isHorizontal() ? 'top' : 'left'),\n (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px')\n )\n .attr('data-swiper-column', column)\n .attr('data-swiper-row', row);\n \n }\n if (slide.css('display') === 'none') continue;\n if (s.params.slidesPerView === 'auto') {\n slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);\n if (s.params.roundLengths) slideSize = round(slideSize);\n }\n else {\n slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;\n if (s.params.roundLengths) slideSize = round(slideSize);\n \n if (s.isHorizontal()) {\n s.slides[i].style.width = slideSize + 'px';\n }\n else {\n s.slides[i].style.height = slideSize + 'px';\n }\n }\n s.slides[i].swiperSlideSize = slideSize;\n s.slidesSizesGrid.push(slideSize);\n \n \n if (s.params.centeredSlides) {\n slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n if(prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;\n if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;\n if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n s.slidesGrid.push(slidePosition);\n }\n else {\n if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n s.slidesGrid.push(slidePosition);\n slidePosition = slidePosition + slideSize + spaceBetween;\n }\n \n s.virtualSize += slideSize + spaceBetween;\n \n prevSlideSize = slideSize;\n \n index ++;\n }\n s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;\n var newSlidesGrid;\n \n if (\n s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {\n s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n }\n if (!s.support.flexbox || s.params.setWrapperSize) {\n if (s.isHorizontal()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});\n }\n \n if (s.params.slidesPerColumn > 1) {\n s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;\n s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;\n if (s.isHorizontal()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});\n if (s.params.centeredSlides) {\n newSlidesGrid = [];\n for (i = 0; i < s.snapGrid.length; i++) {\n if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);\n }\n s.snapGrid = newSlidesGrid;\n }\n }\n \n // Remove last grid elements depending on width\n if (!s.params.centeredSlides) {\n newSlidesGrid = [];\n for (i = 0; i < s.snapGrid.length; i++) {\n if (s.snapGrid[i] <= s.virtualSize - s.size) {\n newSlidesGrid.push(s.snapGrid[i]);\n }\n }\n s.snapGrid = newSlidesGrid;\n if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {\n s.snapGrid.push(s.virtualSize - s.size);\n }\n }\n if (s.snapGrid.length === 0) s.snapGrid = [0];\n \n if (s.params.spaceBetween !== 0) {\n if (s.isHorizontal()) {\n if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'});\n else s.slides.css({marginRight: spaceBetween + 'px'});\n }\n else s.slides.css({marginBottom: spaceBetween + 'px'});\n }\n if (s.params.watchSlidesProgress) {\n s.updateSlidesOffset();\n }\n };\n s.updateSlidesOffset = function () {\n for (var i = 0; i < s.slides.length; i++) {\n s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;\n }\n };\n \n /*=========================\n Dynamic Slides Per View\n ===========================*/\n s.currentSlidesPerView = function () {\n var spv = 1, i, j;\n if (s.params.centeredSlides) {\n var size = s.slides[s.activeIndex].swiperSlideSize;\n var breakLoop;\n for (i = s.activeIndex + 1; i < s.slides.length; i++) {\n if (s.slides[i] && !breakLoop) {\n size += s.slides[i].swiperSlideSize;\n spv ++;\n if (size > s.size) breakLoop = true;\n }\n }\n for (j = s.activeIndex - 1; j >= 0; j--) {\n if (s.slides[j] && !breakLoop) {\n size += s.slides[j].swiperSlideSize;\n spv ++;\n if (size > s.size) breakLoop = true;\n }\n }\n }\n else {\n for (i = s.activeIndex + 1; i < s.slides.length; i++) {\n if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) {\n spv++;\n }\n }\n }\n return spv;\n };\n /*=========================\n Slider/slides progress\n ===========================*/\n s.updateSlidesProgress = function (translate) {\n if (typeof translate === 'undefined') {\n translate = s.translate || 0;\n }\n if (s.slides.length === 0) return;\n if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();\n \n var offsetCenter = -translate;\n if (s.rtl) offsetCenter = translate;\n \n // Visible Slides\n s.slides.removeClass(s.params.slideVisibleClass);\n for (var i = 0; i < s.slides.length; i++) {\n var slide = s.slides[i];\n var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);\n if (s.params.watchSlidesVisibility) {\n var slideBefore = -(offsetCenter - slide.swiperSlideOffset);\n var slideAfter = slideBefore + s.slidesSizesGrid[i];\n var isVisible =\n (slideBefore >= 0 && slideBefore < s.size) ||\n (slideAfter > 0 && slideAfter <= s.size) ||\n (slideBefore <= 0 && slideAfter >= s.size);\n if (isVisible) {\n s.slides.eq(i).addClass(s.params.slideVisibleClass);\n }\n }\n slide.progress = s.rtl ? -slideProgress : slideProgress;\n }\n };\n s.updateProgress = function (translate) {\n if (typeof translate === 'undefined') {\n translate = s.translate || 0;\n }\n var translatesDiff = s.maxTranslate() - s.minTranslate();\n var wasBeginning = s.isBeginning;\n var wasEnd = s.isEnd;\n if (translatesDiff === 0) {\n s.progress = 0;\n s.isBeginning = s.isEnd = true;\n }\n else {\n s.progress = (translate - s.minTranslate()) / (translatesDiff);\n s.isBeginning = s.progress <= 0;\n s.isEnd = s.progress >= 1;\n }\n if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);\n if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);\n \n if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);\n s.emit('onProgress', s, s.progress);\n };\n s.updateActiveIndex = function () {\n var translate = s.rtl ? s.translate : -s.translate;\n var newActiveIndex, i, snapIndex;\n for (i = 0; i < s.slidesGrid.length; i ++) {\n if (typeof s.slidesGrid[i + 1] !== 'undefined') {\n if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {\n newActiveIndex = i;\n }\n else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {\n newActiveIndex = i + 1;\n }\n }\n else {\n if (translate >= s.slidesGrid[i]) {\n newActiveIndex = i;\n }\n }\n }\n // Normalize slideIndex\n if(s.params.normalizeSlideIndex){\n if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;\n }\n // for (i = 0; i < s.slidesGrid.length; i++) {\n // if (- translate >= s.slidesGrid[i]) {\n // newActiveIndex = i;\n // }\n // }\n snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);\n if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;\n \n if (newActiveIndex === s.activeIndex) {\n return;\n }\n s.snapIndex = snapIndex;\n s.previousIndex = s.activeIndex;\n s.activeIndex = newActiveIndex;\n s.updateClasses();\n s.updateRealIndex();\n };\n s.updateRealIndex = function(){\n s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10);\n };\n \n /*=========================\n Classes\n ===========================*/\n s.updateClasses = function () {\n s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass);\n var activeSlide = s.slides.eq(s.activeIndex);\n // Active classes\n activeSlide.addClass(s.params.slideActiveClass);\n if (params.loop) {\n // Duplicate to all looped slides\n if (activeSlide.hasClass(s.params.slideDuplicateClass)) {\n s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index=\"' + s.realIndex + '\"]').addClass(s.params.slideDuplicateActiveClass);\n }\n else {\n s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + s.realIndex + '\"]').addClass(s.params.slideDuplicateActiveClass);\n }\n }\n // Next Slide\n var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);\n if (s.params.loop && nextSlide.length === 0) {\n nextSlide = s.slides.eq(0);\n nextSlide.addClass(s.params.slideNextClass);\n }\n // Prev Slide\n var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);\n if (s.params.loop && prevSlide.length === 0) {\n prevSlide = s.slides.eq(-1);\n prevSlide.addClass(s.params.slidePrevClass);\n }\n if (params.loop) {\n // Duplicate to all looped slides\n if (nextSlide.hasClass(s.params.slideDuplicateClass)) {\n s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index=\"' + nextSlide.attr('data-swiper-slide-index') + '\"]').addClass(s.params.slideDuplicateNextClass);\n }\n else {\n s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + nextSlide.attr('data-swiper-slide-index') + '\"]').addClass(s.params.slideDuplicateNextClass);\n }\n if (prevSlide.hasClass(s.params.slideDuplicateClass)) {\n s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index=\"' + prevSlide.attr('data-swiper-slide-index') + '\"]').addClass(s.params.slideDuplicatePrevClass);\n }\n else {\n s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + prevSlide.attr('data-swiper-slide-index') + '\"]').addClass(s.params.slideDuplicatePrevClass);\n }\n }\n \n // Pagination\n if (s.paginationContainer && s.paginationContainer.length > 0) {\n // Current/Total\n var current,\n total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;\n if (s.params.loop) {\n current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);\n if (current > s.slides.length - 1 - s.loopedSlides * 2) {\n current = current - (s.slides.length - s.loopedSlides * 2);\n }\n if (current > total - 1) current = current - total;\n if (current < 0 && s.params.paginationType !== 'bullets') current = total + current;\n }\n else {\n if (typeof s.snapIndex !== 'undefined') {\n current = s.snapIndex;\n }\n else {\n current = s.activeIndex || 0;\n }\n }\n // Types\n if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) {\n s.bullets.removeClass(s.params.bulletActiveClass);\n if (s.paginationContainer.length > 1) {\n s.bullets.each(function () {\n if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass);\n });\n }\n else {\n s.bullets.eq(current).addClass(s.params.bulletActiveClass);\n }\n }\n if (s.params.paginationType === 'fraction') {\n s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1);\n s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total);\n }\n if (s.params.paginationType === 'progress') {\n var scale = (current + 1) / total,\n scaleX = scale,\n scaleY = 1;\n if (!s.isHorizontal()) {\n scaleY = scale;\n scaleX = 1;\n }\n s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed);\n }\n if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {\n s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));\n s.emit('onPaginationRendered', s, s.paginationContainer[0]);\n }\n }\n \n // Next/active buttons\n if (!s.params.loop) {\n if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {\n if (s.isBeginning) {\n s.prevButton.addClass(s.params.buttonDisabledClass);\n if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);\n }\n else {\n s.prevButton.removeClass(s.params.buttonDisabledClass);\n if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);\n }\n }\n if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {\n if (s.isEnd) {\n s.nextButton.addClass(s.params.buttonDisabledClass);\n if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);\n }\n else {\n s.nextButton.removeClass(s.params.buttonDisabledClass);\n if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);\n }\n }\n }\n };\n \n /*=========================\n Pagination\n ===========================*/\n s.updatePagination = function () {\n if (!s.params.pagination) return;\n if (s.paginationContainer && s.paginationContainer.length > 0) {\n var paginationHTML = '';\n if (s.params.paginationType === 'bullets') {\n var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;\n for (var i = 0; i < numberOfBullets; i++) {\n if (s.params.paginationBulletRender) {\n paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass);\n }\n else {\n paginationHTML += '<' + s.params.paginationElement+' class=\"' + s.params.bulletClass + '\">' + s.params.paginationElement + '>';\n }\n }\n s.paginationContainer.html(paginationHTML);\n s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);\n if (s.params.paginationClickable && s.params.a11y && s.a11y) {\n s.a11y.initPagination();\n }\n }\n if (s.params.paginationType === 'fraction') {\n if (s.params.paginationFractionRender) {\n paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass);\n }\n else {\n paginationHTML =\n '
' +\n ' / ' +\n '
';\n }\n s.paginationContainer.html(paginationHTML);\n }\n if (s.params.paginationType === 'progress') {\n if (s.params.paginationProgressRender) {\n paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass);\n }\n else {\n paginationHTML = '
';\n }\n s.paginationContainer.html(paginationHTML);\n }\n if (s.params.paginationType !== 'custom') {\n s.emit('onPaginationRendered', s, s.paginationContainer[0]);\n }\n }\n };\n /*=========================\n Common update method\n ===========================*/\n s.update = function (updateTranslate) {\n if (!s) return;\n s.updateContainerSize();\n s.updateSlidesSize();\n s.updateProgress();\n s.updatePagination();\n s.updateClasses();\n if (s.params.scrollbar && s.scrollbar) {\n s.scrollbar.set();\n }\n var newTranslate;\n function forceSetTranslate() {\n var translate = s.rtl ? -s.translate : s.translate;\n newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n s.setWrapperTranslate(newTranslate);\n s.updateActiveIndex();\n s.updateClasses();\n }\n if (updateTranslate) {\n var translated;\n if (s.controller && s.controller.spline) {\n s.controller.spline = undefined;\n }\n if (s.params.freeMode) {\n forceSetTranslate();\n if (s.params.autoHeight) {\n s.updateAutoHeight();\n }\n }\n else {\n if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n translated = s.slideTo(s.slides.length - 1, 0, false, true);\n }\n else {\n translated = s.slideTo(s.activeIndex, 0, false, true);\n }\n if (!translated) {\n forceSetTranslate();\n }\n }\n }\n else if (s.params.autoHeight) {\n s.updateAutoHeight();\n }\n };\n \n /*=========================\n Resize Handler\n ===========================*/\n s.onResize = function (forceUpdatePagination) {\n if (s.params.onBeforeResize) s.params.onBeforeResize(s);\n //Breakpoints\n if (s.params.breakpoints) {\n s.setBreakpoint();\n }\n \n // Disable locks on resize\n var allowSwipeToPrev = s.params.allowSwipeToPrev;\n var allowSwipeToNext = s.params.allowSwipeToNext;\n s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;\n \n s.updateContainerSize();\n s.updateSlidesSize();\n if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();\n if (s.params.scrollbar && s.scrollbar) {\n s.scrollbar.set();\n }\n if (s.controller && s.controller.spline) {\n s.controller.spline = undefined;\n }\n var slideChangedBySlideTo = false;\n if (s.params.freeMode) {\n var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n s.setWrapperTranslate(newTranslate);\n s.updateActiveIndex();\n s.updateClasses();\n \n if (s.params.autoHeight) {\n s.updateAutoHeight();\n }\n }\n else {\n s.updateClasses();\n if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);\n }\n else {\n slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);\n }\n }\n if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {\n s.lazy.load();\n }\n // Return locks after resize\n s.params.allowSwipeToPrev = allowSwipeToPrev;\n s.params.allowSwipeToNext = allowSwipeToNext;\n if (s.params.onAfterResize) s.params.onAfterResize(s);\n };\n \n /*=========================\n Events\n ===========================*/\n \n //Define Touch Events\n s.touchEventsDesktop = {start: 'mousedown', move: 'mousemove', end: 'mouseup'};\n if (window.navigator.pointerEnabled) s.touchEventsDesktop = {start: 'pointerdown', move: 'pointermove', end: 'pointerup'};\n else if (window.navigator.msPointerEnabled) s.touchEventsDesktop = {start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp'};\n s.touchEvents = {\n start : s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start,\n move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move,\n end : s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end\n };\n \n \n // WP8 Touch Events Fix\n if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {\n (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);\n }\n \n // Attach/detach events\n s.initEvents = function (detach) {\n var actionDom = detach ? 'off' : 'on';\n var action = detach ? 'removeEventListener' : 'addEventListener';\n var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];\n var target = s.support.touch ? touchEventsTarget : document;\n \n var moveCapture = s.params.nested ? true : false;\n \n //Touch Events\n if (s.browser.ie) {\n touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);\n target[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n target[action](s.touchEvents.end, s.onTouchEnd, false);\n }\n else {\n if (s.support.touch) {\n var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false;\n touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener);\n touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener);\n }\n if ((params.simulateTouch && !s.device.ios && !s.device.android) || (params.simulateTouch && !s.support.touch && s.device.ios)) {\n touchEventsTarget[action]('mousedown', s.onTouchStart, false);\n document[action]('mousemove', s.onTouchMove, moveCapture);\n document[action]('mouseup', s.onTouchEnd, false);\n }\n }\n window[action]('resize', s.onResize);\n \n // Next, Prev, Index\n if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {\n s.nextButton[actionDom]('click', s.onClickNext);\n if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);\n }\n if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {\n s.prevButton[actionDom]('click', s.onClickPrev);\n if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);\n }\n if (s.params.pagination && s.params.paginationClickable) {\n s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);\n if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);\n }\n \n // Prevent Links Clicks\n if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);\n };\n s.attachEvents = function () {\n s.initEvents();\n };\n s.detachEvents = function () {\n s.initEvents(true);\n };\n \n /*=========================\n Handle Clicks\n ===========================*/\n // Prevent Clicks\n s.allowClick = true;\n s.preventClicks = function (e) {\n if (!s.allowClick) {\n if (s.params.preventClicks) e.preventDefault();\n if (s.params.preventClicksPropagation && s.animating) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n }\n };\n // Clicks\n s.onClickNext = function (e) {\n e.preventDefault();\n if (s.isEnd && !s.params.loop) return;\n s.slideNext();\n };\n s.onClickPrev = function (e) {\n e.preventDefault();\n if (s.isBeginning && !s.params.loop) return;\n s.slidePrev();\n };\n s.onClickIndex = function (e) {\n e.preventDefault();\n var index = $(this).index() * s.params.slidesPerGroup;\n if (s.params.loop) index = index + s.loopedSlides;\n s.slideTo(index);\n };\n \n /*=========================\n Handle Touches\n ===========================*/\n function findElementInEvent(e, selector) {\n var el = $(e.target);\n if (!el.is(selector)) {\n if (typeof selector === 'string') {\n el = el.parents(selector);\n }\n else if (selector.nodeType) {\n var found;\n el.parents().each(function (index, _el) {\n if (_el === selector) found = selector;\n });\n if (!found) return undefined;\n else return selector;\n }\n }\n if (el.length === 0) {\n return undefined;\n }\n return el[0];\n }\n s.updateClickedSlide = function (e) {\n var slide = findElementInEvent(e, '.' + s.params.slideClass);\n var slideFound = false;\n if (slide) {\n for (var i = 0; i < s.slides.length; i++) {\n if (s.slides[i] === slide) slideFound = true;\n }\n }\n \n if (slide && slideFound) {\n s.clickedSlide = slide;\n s.clickedIndex = $(slide).index();\n }\n else {\n s.clickedSlide = undefined;\n s.clickedIndex = undefined;\n return;\n }\n if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {\n var slideToIndex = s.clickedIndex,\n realIndex,\n duplicatedSlides,\n slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView;\n if (s.params.loop) {\n if (s.animating) return;\n realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);\n if (s.params.centeredSlides) {\n if ((slideToIndex < s.loopedSlides - slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + slidesPerView/2)) {\n s.fixLoop();\n slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();\n setTimeout(function () {\n s.slideTo(slideToIndex);\n }, 0);\n }\n else {\n s.slideTo(slideToIndex);\n }\n }\n else {\n if (slideToIndex > s.slides.length - slidesPerView) {\n s.fixLoop();\n slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index();\n setTimeout(function () {\n s.slideTo(slideToIndex);\n }, 0);\n }\n else {\n s.slideTo(slideToIndex);\n }\n }\n }\n else {\n s.slideTo(slideToIndex);\n }\n }\n };\n \n var isTouched,\n isMoved,\n allowTouchCallbacks,\n touchStartTime,\n isScrolling,\n currentTranslate,\n startTranslate,\n allowThresholdMove,\n // Form elements to match\n formElements = 'input, select, textarea, button, video',\n // Last click time\n lastClickTime = Date.now(), clickTimeout,\n //Velocities\n velocities = [],\n allowMomentumBounce;\n \n // Animating Flag\n s.animating = false;\n \n // Touches information\n s.touches = {\n startX: 0,\n startY: 0,\n currentX: 0,\n currentY: 0,\n diff: 0\n };\n \n // Touch handlers\n var isTouchEvent, startMoving;\n s.onTouchStart = function (e) {\n if (e.originalEvent) e = e.originalEvent;\n isTouchEvent = e.type === 'touchstart';\n if (!isTouchEvent && 'which' in e && e.which === 3) return;\n if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {\n s.allowClick = true;\n return;\n }\n if (s.params.swipeHandler) {\n if (!findElementInEvent(e, s.params.swipeHandler)) return;\n }\n \n var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n \n // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore\n if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {\n return;\n }\n \n isTouched = true;\n isMoved = false;\n allowTouchCallbacks = true;\n isScrolling = undefined;\n startMoving = undefined;\n s.touches.startX = startX;\n s.touches.startY = startY;\n touchStartTime = Date.now();\n s.allowClick = true;\n s.updateContainerSize();\n s.swipeDirection = undefined;\n if (s.params.threshold > 0) allowThresholdMove = false;\n if (e.type !== 'touchstart') {\n var preventDefault = true;\n if ($(e.target).is(formElements)) preventDefault = false;\n if (document.activeElement && $(document.activeElement).is(formElements)) {\n document.activeElement.blur();\n }\n if (preventDefault) {\n e.preventDefault();\n }\n }\n s.emit('onTouchStart', s, e);\n };\n \n s.onTouchMove = function (e) {\n if (e.originalEvent) e = e.originalEvent;\n if (isTouchEvent && e.type === 'mousemove') return;\n if (e.preventedByNestedSwiper) {\n s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n return;\n }\n if (s.params.onlyExternal) {\n // isMoved = true;\n s.allowClick = false;\n if (isTouched) {\n s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n touchStartTime = Date.now();\n }\n return;\n }\n if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) {\n if (!s.isHorizontal()) {\n // Vertical\n if (\n (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate()) ||\n (s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate())\n ) {\n return;\n }\n }\n else {\n if (\n (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate()) ||\n (s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate())\n ) {\n return;\n }\n }\n }\n if (isTouchEvent && document.activeElement) {\n if (e.target === document.activeElement && $(e.target).is(formElements)) {\n isMoved = true;\n s.allowClick = false;\n return;\n }\n }\n if (allowTouchCallbacks) {\n s.emit('onTouchMove', s, e);\n }\n if (e.targetTouches && e.targetTouches.length > 1) return;\n \n s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n \n if (typeof isScrolling === 'undefined') {\n var touchAngle;\n if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) {\n isScrolling = false;\n }\n else {\n touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;\n isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);\n }\n }\n if (isScrolling) {\n s.emit('onTouchMoveOpposite', s, e);\n }\n if (typeof startMoving === 'undefined') {\n if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {\n startMoving = true;\n }\n }\n if (!isTouched) return;\n if (isScrolling) {\n isTouched = false;\n return;\n }\n if (!startMoving) {\n return;\n }\n s.allowClick = false;\n s.emit('onSliderMove', s, e);\n e.preventDefault();\n if (s.params.touchMoveStopPropagation && !s.params.nested) {\n e.stopPropagation();\n }\n \n if (!isMoved) {\n if (params.loop) {\n s.fixLoop();\n }\n startTranslate = s.getWrapperTranslate();\n s.setWrapperTransition(0);\n if (s.animating) {\n s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');\n }\n if (s.params.autoplay && s.autoplaying) {\n if (s.params.autoplayDisableOnInteraction) {\n s.stopAutoplay();\n }\n else {\n s.pauseAutoplay();\n }\n }\n allowMomentumBounce = false;\n //Grab Cursor\n if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {\n s.setGrabCursor(true);\n }\n }\n isMoved = true;\n \n var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n \n diff = diff * s.params.touchRatio;\n if (s.rtl) diff = -diff;\n \n s.swipeDirection = diff > 0 ? 'prev' : 'next';\n currentTranslate = diff + startTranslate;\n \n var disableParentSwiper = true;\n if ((diff > 0 && currentTranslate > s.minTranslate())) {\n disableParentSwiper = false;\n if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);\n }\n else if (diff < 0 && currentTranslate < s.maxTranslate()) {\n disableParentSwiper = false;\n if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);\n }\n \n if (disableParentSwiper) {\n e.preventedByNestedSwiper = true;\n }\n \n // Directions locks\n if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {\n currentTranslate = startTranslate;\n }\n if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {\n currentTranslate = startTranslate;\n }\n \n \n // Threshold\n if (s.params.threshold > 0) {\n if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {\n if (!allowThresholdMove) {\n allowThresholdMove = true;\n s.touches.startX = s.touches.currentX;\n s.touches.startY = s.touches.currentY;\n currentTranslate = startTranslate;\n s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n return;\n }\n }\n else {\n currentTranslate = startTranslate;\n return;\n }\n }\n \n if (!s.params.followFinger) return;\n \n // Update active index in free mode\n if (s.params.freeMode || s.params.watchSlidesProgress) {\n s.updateActiveIndex();\n }\n if (s.params.freeMode) {\n //Velocity\n if (velocities.length === 0) {\n velocities.push({\n position: s.touches[s.isHorizontal() ? 'startX' : 'startY'],\n time: touchStartTime\n });\n }\n velocities.push({\n position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'],\n time: (new window.Date()).getTime()\n });\n }\n // Update progress\n s.updateProgress(currentTranslate);\n // Update translate\n s.setWrapperTranslate(currentTranslate);\n };\n s.onTouchEnd = function (e) {\n if (e.originalEvent) e = e.originalEvent;\n if (allowTouchCallbacks) {\n s.emit('onTouchEnd', s, e);\n }\n allowTouchCallbacks = false;\n if (!isTouched) return;\n //Return Grab Cursor\n if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) {\n s.setGrabCursor(false);\n }\n \n // Time diff\n var touchEndTime = Date.now();\n var timeDiff = touchEndTime - touchStartTime;\n \n // Tap, doubleTap, Click\n if (s.allowClick) {\n s.updateClickedSlide(e);\n s.emit('onTap', s, e);\n if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {\n if (clickTimeout) clearTimeout(clickTimeout);\n clickTimeout = setTimeout(function () {\n if (!s) return;\n if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {\n s.paginationContainer.toggleClass(s.params.paginationHiddenClass);\n }\n s.emit('onClick', s, e);\n }, 300);\n \n }\n if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {\n if (clickTimeout) clearTimeout(clickTimeout);\n s.emit('onDoubleTap', s, e);\n }\n }\n \n lastClickTime = Date.now();\n setTimeout(function () {\n if (s) s.allowClick = true;\n }, 0);\n \n if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {\n isTouched = isMoved = false;\n return;\n }\n isTouched = isMoved = false;\n \n var currentPos;\n if (s.params.followFinger) {\n currentPos = s.rtl ? s.translate : -s.translate;\n }\n else {\n currentPos = -currentTranslate;\n }\n if (s.params.freeMode) {\n if (currentPos < -s.minTranslate()) {\n s.slideTo(s.activeIndex);\n return;\n }\n else if (currentPos > -s.maxTranslate()) {\n if (s.slides.length < s.snapGrid.length) {\n s.slideTo(s.snapGrid.length - 1);\n }\n else {\n s.slideTo(s.slides.length - 1);\n }\n return;\n }\n \n if (s.params.freeModeMomentum) {\n if (velocities.length > 1) {\n var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();\n \n var distance = lastMoveEvent.position - velocityEvent.position;\n var time = lastMoveEvent.time - velocityEvent.time;\n s.velocity = distance / time;\n s.velocity = s.velocity / 2;\n if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {\n s.velocity = 0;\n }\n // this implies that the user stopped moving a finger then released.\n // There would be no events with distance zero, so the last event is stale.\n if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) {\n s.velocity = 0;\n }\n } else {\n s.velocity = 0;\n }\n s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio;\n \n velocities.length = 0;\n var momentumDuration = 1000 * s.params.freeModeMomentumRatio;\n var momentumDistance = s.velocity * momentumDuration;\n \n var newPosition = s.translate + momentumDistance;\n if (s.rtl) newPosition = - newPosition;\n var doBounce = false;\n var afterBouncePosition;\n var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;\n if (newPosition < s.maxTranslate()) {\n if (s.params.freeModeMomentumBounce) {\n if (newPosition + s.maxTranslate() < -bounceAmount) {\n newPosition = s.maxTranslate() - bounceAmount;\n }\n afterBouncePosition = s.maxTranslate();\n doBounce = true;\n allowMomentumBounce = true;\n }\n else {\n newPosition = s.maxTranslate();\n }\n }\n else if (newPosition > s.minTranslate()) {\n if (s.params.freeModeMomentumBounce) {\n if (newPosition - s.minTranslate() > bounceAmount) {\n newPosition = s.minTranslate() + bounceAmount;\n }\n afterBouncePosition = s.minTranslate();\n doBounce = true;\n allowMomentumBounce = true;\n }\n else {\n newPosition = s.minTranslate();\n }\n }\n else if (s.params.freeModeSticky) {\n var j = 0,\n nextSlide;\n for (j = 0; j < s.snapGrid.length; j += 1) {\n if (s.snapGrid[j] > -newPosition) {\n nextSlide = j;\n break;\n }\n \n }\n if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {\n newPosition = s.snapGrid[nextSlide];\n } else {\n newPosition = s.snapGrid[nextSlide - 1];\n }\n if (!s.rtl) newPosition = - newPosition;\n }\n //Fix duration\n if (s.velocity !== 0) {\n if (s.rtl) {\n momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);\n }\n else {\n momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);\n }\n }\n else if (s.params.freeModeSticky) {\n s.slideReset();\n return;\n }\n \n if (s.params.freeModeMomentumBounce && doBounce) {\n s.updateProgress(afterBouncePosition);\n s.setWrapperTransition(momentumDuration);\n s.setWrapperTranslate(newPosition);\n s.onTransitionStart();\n s.animating = true;\n s.wrapper.transitionEnd(function () {\n if (!s || !allowMomentumBounce) return;\n s.emit('onMomentumBounce', s);\n \n s.setWrapperTransition(s.params.speed);\n s.setWrapperTranslate(afterBouncePosition);\n s.wrapper.transitionEnd(function () {\n if (!s) return;\n s.onTransitionEnd();\n });\n });\n } else if (s.velocity) {\n s.updateProgress(newPosition);\n s.setWrapperTransition(momentumDuration);\n s.setWrapperTranslate(newPosition);\n s.onTransitionStart();\n if (!s.animating) {\n s.animating = true;\n s.wrapper.transitionEnd(function () {\n if (!s) return;\n s.onTransitionEnd();\n });\n }\n \n } else {\n s.updateProgress(newPosition);\n }\n \n s.updateActiveIndex();\n }\n if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {\n s.updateProgress();\n s.updateActiveIndex();\n }\n return;\n }\n \n // Find current slide\n var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0];\n for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {\n if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {\n if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {\n stopIndex = i;\n groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];\n }\n }\n else {\n if (currentPos >= s.slidesGrid[i]) {\n stopIndex = i;\n groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];\n }\n }\n }\n \n // Find current slide size\n var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;\n \n if (timeDiff > s.params.longSwipesMs) {\n // Long touches\n if (!s.params.longSwipes) {\n s.slideTo(s.activeIndex);\n return;\n }\n if (s.swipeDirection === 'next') {\n if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);\n else s.slideTo(stopIndex);\n \n }\n if (s.swipeDirection === 'prev') {\n if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup);\n else s.slideTo(stopIndex);\n }\n }\n else {\n // Short swipes\n if (!s.params.shortSwipes) {\n s.slideTo(s.activeIndex);\n return;\n }\n if (s.swipeDirection === 'next') {\n s.slideTo(stopIndex + s.params.slidesPerGroup);\n \n }\n if (s.swipeDirection === 'prev') {\n s.slideTo(stopIndex);\n }\n }\n };\n /*=========================\n Transitions\n ===========================*/\n s._slideTo = function (slideIndex, speed) {\n return s.slideTo(slideIndex, speed, true, true);\n };\n s.slideTo = function (slideIndex, speed, runCallbacks, internal) {\n if (typeof runCallbacks === 'undefined') runCallbacks = true;\n if (typeof slideIndex === 'undefined') slideIndex = 0;\n if (slideIndex < 0) slideIndex = 0;\n s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);\n if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;\n \n var translate = - s.snapGrid[s.snapIndex];\n // Stop autoplay\n if (s.params.autoplay && s.autoplaying) {\n if (internal || !s.params.autoplayDisableOnInteraction) {\n s.pauseAutoplay(speed);\n }\n else {\n s.stopAutoplay();\n }\n }\n // Update progress\n s.updateProgress(translate);\n \n // Normalize slideIndex\n if(s.params.normalizeSlideIndex){\n for (var i = 0; i < s.slidesGrid.length; i++) {\n if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {\n slideIndex = i;\n }\n }\n }\n \n // Directions locks\n if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {\n return false;\n }\n if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {\n if ((s.activeIndex || 0) !== slideIndex ) return false;\n }\n \n // Update Index\n if (typeof speed === 'undefined') speed = s.params.speed;\n s.previousIndex = s.activeIndex || 0;\n s.activeIndex = slideIndex;\n s.updateRealIndex();\n if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {\n // Update Height\n if (s.params.autoHeight) {\n s.updateAutoHeight();\n }\n s.updateClasses();\n if (s.params.effect !== 'slide') {\n s.setWrapperTranslate(translate);\n }\n return false;\n }\n s.updateClasses();\n s.onTransitionStart(runCallbacks);\n \n if (speed === 0 || s.browser.lteIE9) {\n s.setWrapperTranslate(translate);\n s.setWrapperTransition(0);\n s.onTransitionEnd(runCallbacks);\n }\n else {\n s.setWrapperTranslate(translate);\n s.setWrapperTransition(speed);\n if (!s.animating) {\n s.animating = true;\n s.wrapper.transitionEnd(function () {\n if (!s) return;\n s.onTransitionEnd(runCallbacks);\n });\n }\n \n }\n \n return true;\n };\n \n s.onTransitionStart = function (runCallbacks) {\n if (typeof runCallbacks === 'undefined') runCallbacks = true;\n if (s.params.autoHeight) {\n s.updateAutoHeight();\n }\n if (s.lazy) s.lazy.onTransitionStart();\n if (runCallbacks) {\n s.emit('onTransitionStart', s);\n if (s.activeIndex !== s.previousIndex) {\n s.emit('onSlideChangeStart', s);\n if (s.activeIndex > s.previousIndex) {\n s.emit('onSlideNextStart', s);\n }\n else {\n s.emit('onSlidePrevStart', s);\n }\n }\n \n }\n };\n s.onTransitionEnd = function (runCallbacks) {\n s.animating = false;\n s.setWrapperTransition(0);\n if (typeof runCallbacks === 'undefined') runCallbacks = true;\n if (s.lazy) s.lazy.onTransitionEnd();\n if (runCallbacks) {\n s.emit('onTransitionEnd', s);\n if (s.activeIndex !== s.previousIndex) {\n s.emit('onSlideChangeEnd', s);\n if (s.activeIndex > s.previousIndex) {\n s.emit('onSlideNextEnd', s);\n }\n else {\n s.emit('onSlidePrevEnd', s);\n }\n }\n }\n if (s.params.history && s.history) {\n s.history.setHistory(s.params.history, s.activeIndex);\n }\n if (s.params.hashnav && s.hashnav) {\n s.hashnav.setHash();\n }\n \n };\n s.slideNext = function (runCallbacks, speed, internal) {\n if (s.params.loop) {\n if (s.animating) return false;\n s.fixLoop();\n var clientLeft = s.container[0].clientLeft;\n return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n }\n else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n };\n s._slideNext = function (speed) {\n return s.slideNext(true, speed, true);\n };\n s.slidePrev = function (runCallbacks, speed, internal) {\n if (s.params.loop) {\n if (s.animating) return false;\n s.fixLoop();\n var clientLeft = s.container[0].clientLeft;\n return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n }\n else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n };\n s._slidePrev = function (speed) {\n return s.slidePrev(true, speed, true);\n };\n s.slideReset = function (runCallbacks, speed, internal) {\n return s.slideTo(s.activeIndex, speed, runCallbacks);\n };\n \n s.disableTouchControl = function () {\n s.params.onlyExternal = true;\n return true;\n };\n s.enableTouchControl = function () {\n s.params.onlyExternal = false;\n return true;\n };\n \n /*=========================\n Translate/transition helpers\n ===========================*/\n s.setWrapperTransition = function (duration, byController) {\n s.wrapper.transition(duration);\n if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n s.effects[s.params.effect].setTransition(duration);\n }\n if (s.params.parallax && s.parallax) {\n s.parallax.setTransition(duration);\n }\n if (s.params.scrollbar && s.scrollbar) {\n s.scrollbar.setTransition(duration);\n }\n if (s.params.control && s.controller) {\n s.controller.setTransition(duration, byController);\n }\n s.emit('onSetTransition', s, duration);\n };\n s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {\n var x = 0, y = 0, z = 0;\n if (s.isHorizontal()) {\n x = s.rtl ? -translate : translate;\n }\n else {\n y = translate;\n }\n \n if (s.params.roundLengths) {\n x = round(x);\n y = round(y);\n }\n \n if (!s.params.virtualTranslate) {\n if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');\n else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');\n }\n \n s.translate = s.isHorizontal() ? x : y;\n \n // Check if we need to update progress\n var progress;\n var translatesDiff = s.maxTranslate() - s.minTranslate();\n if (translatesDiff === 0) {\n progress = 0;\n }\n else {\n progress = (translate - s.minTranslate()) / (translatesDiff);\n }\n if (progress !== s.progress) {\n s.updateProgress(translate);\n }\n \n if (updateActiveIndex) s.updateActiveIndex();\n if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n s.effects[s.params.effect].setTranslate(s.translate);\n }\n if (s.params.parallax && s.parallax) {\n s.parallax.setTranslate(s.translate);\n }\n if (s.params.scrollbar && s.scrollbar) {\n s.scrollbar.setTranslate(s.translate);\n }\n if (s.params.control && s.controller) {\n s.controller.setTranslate(s.translate, byController);\n }\n s.emit('onSetTranslate', s, s.translate);\n };\n \n s.getTranslate = function (el, axis) {\n var matrix, curTransform, curStyle, transformMatrix;\n \n // automatic axis detection\n if (typeof axis === 'undefined') {\n axis = 'x';\n }\n \n if (s.params.virtualTranslate) {\n return s.rtl ? -s.translate : s.translate;\n }\n \n curStyle = window.getComputedStyle(el, null);\n if (window.WebKitCSSMatrix) {\n curTransform = curStyle.transform || curStyle.webkitTransform;\n if (curTransform.split(',').length > 6) {\n curTransform = curTransform.split(', ').map(function(a){\n return a.replace(',','.');\n }).join(', ');\n }\n // Some old versions of Webkit choke when 'none' is passed; pass\n // empty string instead in this case\n transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n }\n else {\n transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n matrix = transformMatrix.toString().split(',');\n }\n \n if (axis === 'x') {\n //Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix)\n curTransform = transformMatrix.m41;\n //Crazy IE10 Matrix\n else if (matrix.length === 16)\n curTransform = parseFloat(matrix[12]);\n //Normal Browsers\n else\n curTransform = parseFloat(matrix[4]);\n }\n if (axis === 'y') {\n //Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix)\n curTransform = transformMatrix.m42;\n //Crazy IE10 Matrix\n else if (matrix.length === 16)\n curTransform = parseFloat(matrix[13]);\n //Normal Browsers\n else\n curTransform = parseFloat(matrix[5]);\n }\n if (s.rtl && curTransform) curTransform = -curTransform;\n return curTransform || 0;\n };\n s.getWrapperTranslate = function (axis) {\n if (typeof axis === 'undefined') {\n axis = s.isHorizontal() ? 'x' : 'y';\n }\n return s.getTranslate(s.wrapper[0], axis);\n };\n \n /*=========================\n Observer\n ===========================*/\n s.observers = [];\n function initObserver(target, options) {\n options = options || {};\n // create an observer instance\n var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n var observer = new ObserverFunc(function (mutations) {\n mutations.forEach(function (mutation) {\n s.onResize(true);\n s.emit('onObserverUpdate', s, mutation);\n });\n });\n \n observer.observe(target, {\n attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n childList: typeof options.childList === 'undefined' ? true : options.childList,\n characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n });\n \n s.observers.push(observer);\n }\n s.initObservers = function () {\n if (s.params.observeParents) {\n var containerParents = s.container.parents();\n for (var i = 0; i < containerParents.length; i++) {\n initObserver(containerParents[i]);\n }\n }\n \n // Observe container\n initObserver(s.container[0], {childList: false});\n \n // Observe wrapper\n initObserver(s.wrapper[0], {attributes: false});\n };\n s.disconnectObservers = function () {\n for (var i = 0; i < s.observers.length; i++) {\n s.observers[i].disconnect();\n }\n s.observers = [];\n };\n /*=========================\n Loop\n ===========================*/\n // Create looped slides\n s.createLoop = function () {\n // Remove duplicated slides\n s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n \n var slides = s.wrapper.children('.' + s.params.slideClass);\n \n if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;\n \n s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);\n s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;\n if (s.loopedSlides > slides.length) {\n s.loopedSlides = slides.length;\n }\n \n var prependSlides = [], appendSlides = [], i;\n slides.each(function (index, el) {\n var slide = $(this);\n if (index < s.loopedSlides) appendSlides.push(el);\n if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);\n slide.attr('data-swiper-slide-index', index);\n });\n for (i = 0; i < appendSlides.length; i++) {\n s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n }\n for (i = prependSlides.length - 1; i >= 0; i--) {\n s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n }\n };\n s.destroyLoop = function () {\n s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n s.slides.removeAttr('data-swiper-slide-index');\n };\n s.reLoop = function (updatePosition) {\n var oldIndex = s.activeIndex - s.loopedSlides;\n s.destroyLoop();\n s.createLoop();\n s.updateSlidesSize();\n if (updatePosition) {\n s.slideTo(oldIndex + s.loopedSlides, 0, false);\n }\n \n };\n s.fixLoop = function () {\n var newIndex;\n //Fix For Negative Oversliding\n if (s.activeIndex < s.loopedSlides) {\n newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;\n newIndex = newIndex + s.loopedSlides;\n s.slideTo(newIndex, 0, false, true);\n }\n //Fix For Positive Oversliding\n else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) {\n newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;\n newIndex = newIndex + s.loopedSlides;\n s.slideTo(newIndex, 0, false, true);\n }\n };\n /*=========================\n Append/Prepend/Remove Slides\n ===========================*/\n s.appendSlide = function (slides) {\n if (s.params.loop) {\n s.destroyLoop();\n }\n if (typeof slides === 'object' && slides.length) {\n for (var i = 0; i < slides.length; i++) {\n if (slides[i]) s.wrapper.append(slides[i]);\n }\n }\n else {\n s.wrapper.append(slides);\n }\n if (s.params.loop) {\n s.createLoop();\n }\n if (!(s.params.observer && s.support.observer)) {\n s.update(true);\n }\n };\n s.prependSlide = function (slides) {\n if (s.params.loop) {\n s.destroyLoop();\n }\n var newActiveIndex = s.activeIndex + 1;\n if (typeof slides === 'object' && slides.length) {\n for (var i = 0; i < slides.length; i++) {\n if (slides[i]) s.wrapper.prepend(slides[i]);\n }\n newActiveIndex = s.activeIndex + slides.length;\n }\n else {\n s.wrapper.prepend(slides);\n }\n if (s.params.loop) {\n s.createLoop();\n }\n if (!(s.params.observer && s.support.observer)) {\n s.update(true);\n }\n s.slideTo(newActiveIndex, 0, false);\n };\n s.removeSlide = function (slidesIndexes) {\n if (s.params.loop) {\n s.destroyLoop();\n s.slides = s.wrapper.children('.' + s.params.slideClass);\n }\n var newActiveIndex = s.activeIndex,\n indexToRemove;\n if (typeof slidesIndexes === 'object' && slidesIndexes.length) {\n for (var i = 0; i < slidesIndexes.length; i++) {\n indexToRemove = slidesIndexes[i];\n if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n if (indexToRemove < newActiveIndex) newActiveIndex--;\n }\n newActiveIndex = Math.max(newActiveIndex, 0);\n }\n else {\n indexToRemove = slidesIndexes;\n if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n if (indexToRemove < newActiveIndex) newActiveIndex--;\n newActiveIndex = Math.max(newActiveIndex, 0);\n }\n \n if (s.params.loop) {\n s.createLoop();\n }\n \n if (!(s.params.observer && s.support.observer)) {\n s.update(true);\n }\n if (s.params.loop) {\n s.slideTo(newActiveIndex + s.loopedSlides, 0, false);\n }\n else {\n s.slideTo(newActiveIndex, 0, false);\n }\n \n };\n s.removeAllSlides = function () {\n var slidesIndexes = [];\n for (var i = 0; i < s.slides.length; i++) {\n slidesIndexes.push(i);\n }\n s.removeSlide(slidesIndexes);\n };\n \n \n /*=========================\n Effects\n ===========================*/\n s.effects = {\n fade: {\n setTranslate: function () {\n for (var i = 0; i < s.slides.length; i++) {\n var slide = s.slides.eq(i);\n var offset = slide[0].swiperSlideOffset;\n var tx = -offset;\n if (!s.params.virtualTranslate) tx = tx - s.translate;\n var ty = 0;\n if (!s.isHorizontal()) {\n ty = tx;\n tx = 0;\n }\n var slideOpacity = s.params.fade.crossFade ?\n Math.max(1 - Math.abs(slide[0].progress), 0) :\n 1 + Math.min(Math.max(slide[0].progress, -1), 0);\n slide\n .css({\n opacity: slideOpacity\n })\n .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');\n \n }\n \n },\n setTransition: function (duration) {\n s.slides.transition(duration);\n if (s.params.virtualTranslate && duration !== 0) {\n var eventTriggered = false;\n s.slides.transitionEnd(function () {\n if (eventTriggered) return;\n if (!s) return;\n eventTriggered = true;\n s.animating = false;\n var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];\n for (var i = 0; i < triggerEvents.length; i++) {\n s.wrapper.trigger(triggerEvents[i]);\n }\n });\n }\n }\n },\n flip: {\n setTranslate: function () {\n for (var i = 0; i < s.slides.length; i++) {\n var slide = s.slides.eq(i);\n var progress = slide[0].progress;\n if (s.params.flip.limitRotation) {\n progress = Math.max(Math.min(slide[0].progress, 1), -1);\n }\n var offset = slide[0].swiperSlideOffset;\n var rotate = -180 * progress,\n rotateY = rotate,\n rotateX = 0,\n tx = -offset,\n ty = 0;\n if (!s.isHorizontal()) {\n ty = tx;\n tx = 0;\n rotateX = -rotateY;\n rotateY = 0;\n }\n else if (s.rtl) {\n rotateY = -rotateY;\n }\n \n slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length;\n \n if (s.params.flip.slideShadows) {\n //Set shadows\n var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n if (shadowBefore.length === 0) {\n shadowBefore = $('
');\n slide.append(shadowBefore);\n }\n if (shadowAfter.length === 0) {\n shadowAfter = $('
');\n slide.append(shadowAfter);\n }\n if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);\n if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);\n }\n \n slide\n .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');\n }\n },\n setTransition: function (duration) {\n s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n if (s.params.virtualTranslate && duration !== 0) {\n var eventTriggered = false;\n s.slides.eq(s.activeIndex).transitionEnd(function () {\n if (eventTriggered) return;\n if (!s) return;\n if (!$(this).hasClass(s.params.slideActiveClass)) return;\n eventTriggered = true;\n s.animating = false;\n var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];\n for (var i = 0; i < triggerEvents.length; i++) {\n s.wrapper.trigger(triggerEvents[i]);\n }\n });\n }\n }\n },\n cube: {\n setTranslate: function () {\n var wrapperRotate = 0, cubeShadow;\n if (s.params.cube.shadow) {\n if (s.isHorizontal()) {\n cubeShadow = s.wrapper.find('.swiper-cube-shadow');\n if (cubeShadow.length === 0) {\n cubeShadow = $('
');\n s.wrapper.append(cubeShadow);\n }\n cubeShadow.css({height: s.width + 'px'});\n }\n else {\n cubeShadow = s.container.find('.swiper-cube-shadow');\n if (cubeShadow.length === 0) {\n cubeShadow = $('
');\n s.container.append(cubeShadow);\n }\n }\n }\n for (var i = 0; i < s.slides.length; i++) {\n var slide = s.slides.eq(i);\n var slideAngle = i * 90;\n var round = Math.floor(slideAngle / 360);\n if (s.rtl) {\n slideAngle = -slideAngle;\n round = Math.floor(-slideAngle / 360);\n }\n var progress = Math.max(Math.min(slide[0].progress, 1), -1);\n var tx = 0, ty = 0, tz = 0;\n if (i % 4 === 0) {\n tx = - round * 4 * s.size;\n tz = 0;\n }\n else if ((i - 1) % 4 === 0) {\n tx = 0;\n tz = - round * 4 * s.size;\n }\n else if ((i - 2) % 4 === 0) {\n tx = s.size + round * 4 * s.size;\n tz = s.size;\n }\n else if ((i - 3) % 4 === 0) {\n tx = - s.size;\n tz = 3 * s.size + s.size * 4 * round;\n }\n if (s.rtl) {\n tx = -tx;\n }\n \n if (!s.isHorizontal()) {\n ty = tx;\n tx = 0;\n }\n \n var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';\n if (progress <= 1 && progress > -1) {\n wrapperRotate = i * 90 + progress * 90;\n if (s.rtl) wrapperRotate = -i * 90 - progress * 90;\n }\n slide.transform(transform);\n if (s.params.cube.slideShadows) {\n //Set shadows\n var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n if (shadowBefore.length === 0) {\n shadowBefore = $('
');\n slide.append(shadowBefore);\n }\n if (shadowAfter.length === 0) {\n shadowAfter = $('
');\n slide.append(shadowAfter);\n }\n if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);\n if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);\n }\n }\n s.wrapper.css({\n '-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n '-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n '-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n 'transform-origin': '50% 50% -' + (s.size / 2) + 'px'\n });\n \n if (s.params.cube.shadow) {\n if (s.isHorizontal()) {\n cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')');\n }\n else {\n var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;\n var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);\n var scale1 = s.params.cube.shadowScale,\n scale2 = s.params.cube.shadowScale / multiplier,\n offset = s.params.cube.shadowOffset;\n cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)');\n }\n }\n var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0;\n s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)');\n },\n setTransition: function (duration) {\n s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n if (s.params.cube.shadow && !s.isHorizontal()) {\n s.container.find('.swiper-cube-shadow').transition(duration);\n }\n }\n },\n coverflow: {\n setTranslate: function () {\n var transform = s.translate;\n var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2;\n var rotate = s.isHorizontal() ? s.params.coverflow.rotate: -s.params.coverflow.rotate;\n var translate = s.params.coverflow.depth;\n //Each slide offset from center\n for (var i = 0, length = s.slides.length; i < length; i++) {\n var slide = s.slides.eq(i);\n var slideSize = s.slidesSizesGrid[i];\n var slideOffset = slide[0].swiperSlideOffset;\n var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;\n \n var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0;\n var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier;\n // var rotateZ = 0\n var translateZ = -translate * Math.abs(offsetMultiplier);\n \n var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * (offsetMultiplier);\n var translateX = s.isHorizontal() ? s.params.coverflow.stretch * (offsetMultiplier) : 0;\n \n //Fix for ultra small values\n if (Math.abs(translateX) < 0.001) translateX = 0;\n if (Math.abs(translateY) < 0.001) translateY = 0;\n if (Math.abs(translateZ) < 0.001) translateZ = 0;\n if (Math.abs(rotateY) < 0.001) rotateY = 0;\n if (Math.abs(rotateX) < 0.001) rotateX = 0;\n \n var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';\n \n slide.transform(slideTransform);\n slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;\n if (s.params.coverflow.slideShadows) {\n //Set shadows\n var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n if (shadowBefore.length === 0) {\n shadowBefore = $('
');\n slide.append(shadowBefore);\n }\n if (shadowAfter.length === 0) {\n shadowAfter = $('
');\n slide.append(shadowAfter);\n }\n if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;\n if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0;\n }\n }\n \n //Set correct perspective for IE10\n if (s.browser.ie) {\n var ws = s.wrapper[0].style;\n ws.perspectiveOrigin = center + 'px 50%';\n }\n },\n setTransition: function (duration) {\n s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n }\n }\n };\n \n \n /*=========================\n Images Lazy Loading\n ===========================*/\n s.lazy = {\n initialImageLoaded: false,\n loadImageInSlide: function (index, loadInDuplicate) {\n if (typeof index === 'undefined') return;\n if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;\n if (s.slides.length === 0) return;\n \n var slide = s.slides.eq(index);\n var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')');\n if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) {\n img = img.add(slide[0]);\n }\n if (img.length === 0) return;\n \n img.each(function () {\n var _img = $(this);\n _img.addClass(s.params.lazyStatusLoadingClass);\n var background = _img.attr('data-background');\n var src = _img.attr('data-src'),\n srcset = _img.attr('data-srcset'),\n sizes = _img.attr('data-sizes');\n s.loadImage(_img[0], (src || background), srcset, sizes, false, function () {\n if (typeof s === 'undefined' || s === null || !s) return;\n if (background) {\n _img.css('background-image', 'url(\"' + background + '\")');\n _img.removeAttr('data-background');\n }\n else {\n if (srcset) {\n _img.attr('srcset', srcset);\n _img.removeAttr('data-srcset');\n }\n if (sizes) {\n _img.attr('sizes', sizes);\n _img.removeAttr('data-sizes');\n }\n if (src) {\n _img.attr('src', src);\n _img.removeAttr('data-src');\n }\n \n }\n \n _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass);\n slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove();\n if (s.params.loop && loadInDuplicate) {\n var slideOriginalIndex = slide.attr('data-swiper-slide-index');\n if (slide.hasClass(s.params.slideDuplicateClass)) {\n var originalSlide = s.wrapper.children('[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]:not(.' + s.params.slideDuplicateClass + ')');\n s.lazy.loadImageInSlide(originalSlide.index(), false);\n }\n else {\n var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]');\n s.lazy.loadImageInSlide(duplicatedSlide.index(), false);\n }\n }\n s.emit('onLazyImageReady', s, slide[0], _img[0]);\n });\n \n s.emit('onLazyImageLoad', s, slide[0], _img[0]);\n });\n \n },\n load: function () {\n var i;\n var slidesPerView = s.params.slidesPerView;\n if (slidesPerView === 'auto') {\n slidesPerView = 0;\n }\n if (!s.lazy.initialImageLoaded) s.lazy.initialImageLoaded = true;\n if (s.params.watchSlidesVisibility) {\n s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {\n s.lazy.loadImageInSlide($(this).index());\n });\n }\n else {\n if (slidesPerView > 1) {\n for (i = s.activeIndex; i < s.activeIndex + slidesPerView ; i++) {\n if (s.slides[i]) s.lazy.loadImageInSlide(i);\n }\n }\n else {\n s.lazy.loadImageInSlide(s.activeIndex);\n }\n }\n if (s.params.lazyLoadingInPrevNext) {\n if (slidesPerView > 1 || (s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1)) {\n var amount = s.params.lazyLoadingInPrevNextAmount;\n var spv = slidesPerView;\n var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length);\n var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0);\n // Next Slides\n for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) {\n if (s.slides[i]) s.lazy.loadImageInSlide(i);\n }\n // Prev Slides\n for (i = minIndex; i < s.activeIndex ; i++) {\n if (s.slides[i]) s.lazy.loadImageInSlide(i);\n }\n }\n else {\n var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);\n if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());\n \n var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);\n if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());\n }\n }\n },\n onTransitionStart: function () {\n if (s.params.lazyLoading) {\n if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) {\n s.lazy.load();\n }\n }\n },\n onTransitionEnd: function () {\n if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {\n s.lazy.load();\n }\n }\n };\n \n \n /*=========================\n Scrollbar\n ===========================*/\n s.scrollbar = {\n isTouched: false,\n setDragPosition: function (e) {\n var sb = s.scrollbar;\n var x = 0, y = 0;\n var translate;\n var pointerPosition = s.isHorizontal() ?\n ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) :\n ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ;\n var position = (pointerPosition) - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2;\n var positionMin = -s.minTranslate() * sb.moveDivider;\n var positionMax = -s.maxTranslate() * sb.moveDivider;\n if (position < positionMin) {\n position = positionMin;\n }\n else if (position > positionMax) {\n position = positionMax;\n }\n position = -position / sb.moveDivider;\n s.updateProgress(position);\n s.setWrapperTranslate(position, true);\n },\n dragStart: function (e) {\n var sb = s.scrollbar;\n sb.isTouched = true;\n e.preventDefault();\n e.stopPropagation();\n \n sb.setDragPosition(e);\n clearTimeout(sb.dragTimeout);\n \n sb.track.transition(0);\n if (s.params.scrollbarHide) {\n sb.track.css('opacity', 1);\n }\n s.wrapper.transition(100);\n sb.drag.transition(100);\n s.emit('onScrollbarDragStart', s);\n },\n dragMove: function (e) {\n var sb = s.scrollbar;\n if (!sb.isTouched) return;\n if (e.preventDefault) e.preventDefault();\n else e.returnValue = false;\n sb.setDragPosition(e);\n s.wrapper.transition(0);\n sb.track.transition(0);\n sb.drag.transition(0);\n s.emit('onScrollbarDragMove', s);\n },\n dragEnd: function (e) {\n var sb = s.scrollbar;\n if (!sb.isTouched) return;\n sb.isTouched = false;\n if (s.params.scrollbarHide) {\n clearTimeout(sb.dragTimeout);\n sb.dragTimeout = setTimeout(function () {\n sb.track.css('opacity', 0);\n sb.track.transition(400);\n }, 1000);\n \n }\n s.emit('onScrollbarDragEnd', s);\n if (s.params.scrollbarSnapOnRelease) {\n s.slideReset();\n }\n },\n draggableEvents: (function () {\n if ((s.params.simulateTouch === false && !s.support.touch)) return s.touchEventsDesktop;\n else return s.touchEvents;\n })(),\n enableDraggable: function () {\n var sb = s.scrollbar;\n var target = s.support.touch ? sb.track : document;\n $(sb.track).on(sb.draggableEvents.start, sb.dragStart);\n $(target).on(sb.draggableEvents.move, sb.dragMove);\n $(target).on(sb.draggableEvents.end, sb.dragEnd);\n },\n disableDraggable: function () {\n var sb = s.scrollbar;\n var target = s.support.touch ? sb.track : document;\n $(sb.track).off(sb.draggableEvents.start, sb.dragStart);\n $(target).off(sb.draggableEvents.move, sb.dragMove);\n $(target).off(sb.draggableEvents.end, sb.dragEnd);\n },\n set: function () {\n if (!s.params.scrollbar) return;\n var sb = s.scrollbar;\n sb.track = $(s.params.scrollbar);\n if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {\n sb.track = s.container.find(s.params.scrollbar);\n }\n sb.drag = sb.track.find('.swiper-scrollbar-drag');\n if (sb.drag.length === 0) {\n sb.drag = $('
');\n sb.track.append(sb.drag);\n }\n sb.drag[0].style.width = '';\n sb.drag[0].style.height = '';\n sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;\n \n sb.divider = s.size / s.virtualSize;\n sb.moveDivider = sb.divider * (sb.trackSize / s.size);\n sb.dragSize = sb.trackSize * sb.divider;\n \n if (s.isHorizontal()) {\n sb.drag[0].style.width = sb.dragSize + 'px';\n }\n else {\n sb.drag[0].style.height = sb.dragSize + 'px';\n }\n \n if (sb.divider >= 1) {\n sb.track[0].style.display = 'none';\n }\n else {\n sb.track[0].style.display = '';\n }\n if (s.params.scrollbarHide) {\n sb.track[0].style.opacity = 0;\n }\n },\n setTranslate: function () {\n if (!s.params.scrollbar) return;\n var diff;\n var sb = s.scrollbar;\n var translate = s.translate || 0;\n var newPos;\n \n var newSize = sb.dragSize;\n newPos = (sb.trackSize - sb.dragSize) * s.progress;\n if (s.rtl && s.isHorizontal()) {\n newPos = -newPos;\n if (newPos > 0) {\n newSize = sb.dragSize - newPos;\n newPos = 0;\n }\n else if (-newPos + sb.dragSize > sb.trackSize) {\n newSize = sb.trackSize + newPos;\n }\n }\n else {\n if (newPos < 0) {\n newSize = sb.dragSize + newPos;\n newPos = 0;\n }\n else if (newPos + sb.dragSize > sb.trackSize) {\n newSize = sb.trackSize - newPos;\n }\n }\n if (s.isHorizontal()) {\n if (s.support.transforms3d) {\n sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)');\n }\n else {\n sb.drag.transform('translateX(' + (newPos) + 'px)');\n }\n sb.drag[0].style.width = newSize + 'px';\n }\n else {\n if (s.support.transforms3d) {\n sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)');\n }\n else {\n sb.drag.transform('translateY(' + (newPos) + 'px)');\n }\n sb.drag[0].style.height = newSize + 'px';\n }\n if (s.params.scrollbarHide) {\n clearTimeout(sb.timeout);\n sb.track[0].style.opacity = 1;\n sb.timeout = setTimeout(function () {\n sb.track[0].style.opacity = 0;\n sb.track.transition(400);\n }, 1000);\n }\n },\n setTransition: function (duration) {\n if (!s.params.scrollbar) return;\n s.scrollbar.drag.transition(duration);\n }\n };\n \n \n /*=========================\n Controller\n ===========================*/\n s.controller = {\n LinearSpline: function (x, y) {\n var binarySearch = (function() {\n var maxIndex, minIndex, guess;\n return function(array, val) {\n minIndex = -1;\n maxIndex = array.length;\n while (maxIndex - minIndex > 1)\n if (array[guess = maxIndex + minIndex >> 1] <= val) {\n minIndex = guess;\n } else {\n maxIndex = guess;\n }\n return maxIndex;\n };\n })();\n this.x = x;\n this.y = y;\n this.lastIndex = x.length - 1;\n // Given an x value (x2), return the expected y2 value:\n // (x1,y1) is the known point before given value,\n // (x3,y3) is the known point after given value.\n var i1, i3;\n var l = this.x.length;\n \n this.interpolate = function (x2) {\n if (!x2) return 0;\n \n // Get the indexes of x1 and x3 (the array indexes before and after given x2):\n i3 = binarySearch(this.x, x2);\n i1 = i3 - 1;\n \n // We have our indexes i1 & i3, so we can calculate already:\n // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1\n return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];\n };\n },\n //xxx: for now i will just save one spline function to to\n getInterpolateFunction: function(c){\n if(!s.controller.spline) s.controller.spline = s.params.loop ?\n new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) :\n new s.controller.LinearSpline(s.snapGrid, c.snapGrid);\n },\n setTranslate: function (translate, byController) {\n var controlled = s.params.control;\n var multiplier, controlledTranslate;\n function setControlledTranslate(c) {\n // this will create an Interpolate function based on the snapGrids\n // x is the Grid of the scrolled scroller and y will be the controlled scroller\n // it makes sense to create this only once and recall it for the interpolation\n // the function does a lot of value caching for performance\n translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;\n if (s.params.controlBy === 'slide') {\n s.controller.getInterpolateFunction(c);\n // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid\n // but it did not work out\n controlledTranslate = -s.controller.spline.interpolate(-translate);\n }\n \n if(!controlledTranslate || s.params.controlBy === 'container'){\n multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());\n controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();\n }\n \n if (s.params.controlInverse) {\n controlledTranslate = c.maxTranslate() - controlledTranslate;\n }\n c.updateProgress(controlledTranslate);\n c.setWrapperTranslate(controlledTranslate, false, s);\n c.updateActiveIndex();\n }\n if (Array.isArray(controlled)) {\n for (var i = 0; i < controlled.length; i++) {\n if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n setControlledTranslate(controlled[i]);\n }\n }\n }\n else if (controlled instanceof Swiper && byController !== controlled) {\n \n setControlledTranslate(controlled);\n }\n },\n setTransition: function (duration, byController) {\n var controlled = s.params.control;\n var i;\n function setControlledTransition(c) {\n c.setWrapperTransition(duration, s);\n if (duration !== 0) {\n c.onTransitionStart();\n c.wrapper.transitionEnd(function(){\n if (!controlled) return;\n if (c.params.loop && s.params.controlBy === 'slide') {\n c.fixLoop();\n }\n c.onTransitionEnd();\n \n });\n }\n }\n if (Array.isArray(controlled)) {\n for (i = 0; i < controlled.length; i++) {\n if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n setControlledTransition(controlled[i]);\n }\n }\n }\n else if (controlled instanceof Swiper && byController !== controlled) {\n setControlledTransition(controlled);\n }\n }\n };\n \n \n /*=========================\n Parallax\n ===========================*/\n function setParallaxTransform(el, progress) {\n el = $(el);\n var p, pX, pY;\n var rtlFactor = s.rtl ? -1 : 1;\n \n p = el.attr('data-swiper-parallax') || '0';\n pX = el.attr('data-swiper-parallax-x');\n pY = el.attr('data-swiper-parallax-y');\n if (pX || pY) {\n pX = pX || '0';\n pY = pY || '0';\n }\n else {\n if (s.isHorizontal()) {\n pX = p;\n pY = '0';\n }\n else {\n pY = p;\n pX = '0';\n }\n }\n \n if ((pX).indexOf('%') >= 0) {\n pX = parseInt(pX, 10) * progress * rtlFactor + '%';\n }\n else {\n pX = pX * progress * rtlFactor + 'px' ;\n }\n if ((pY).indexOf('%') >= 0) {\n pY = parseInt(pY, 10) * progress + '%';\n }\n else {\n pY = pY * progress + 'px' ;\n }\n \n el.transform('translate3d(' + pX + ', ' + pY + ',0px)');\n }\n s.parallax = {\n setTranslate: function () {\n s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n setParallaxTransform(this, s.progress);\n \n });\n s.slides.each(function () {\n var slide = $(this);\n slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {\n var progress = Math.min(Math.max(slide[0].progress, -1), 1);\n setParallaxTransform(this, progress);\n });\n });\n },\n setTransition: function (duration) {\n if (typeof duration === 'undefined') duration = s.params.speed;\n s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n var el = $(this);\n var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;\n if (duration === 0) parallaxDuration = 0;\n el.transition(parallaxDuration);\n });\n }\n };\n \n \n /*=========================\n Zoom\n ===========================*/\n s.zoom = {\n // \"Global\" Props\n scale: 1,\n currentScale: 1,\n isScaling: false,\n gesture: {\n slide: undefined,\n slideWidth: undefined,\n slideHeight: undefined,\n image: undefined,\n imageWrap: undefined,\n zoomMax: s.params.zoomMax\n },\n image: {\n isTouched: undefined,\n isMoved: undefined,\n currentX: undefined,\n currentY: undefined,\n minX: undefined,\n minY: undefined,\n maxX: undefined,\n maxY: undefined,\n width: undefined,\n height: undefined,\n startX: undefined,\n startY: undefined,\n touchesStart: {},\n touchesCurrent: {}\n },\n velocity: {\n x: undefined,\n y: undefined,\n prevPositionX: undefined,\n prevPositionY: undefined,\n prevTime: undefined\n },\n // Calc Scale From Multi-touches\n getDistanceBetweenTouches: function (e) {\n if (e.targetTouches.length < 2) return 1;\n var x1 = e.targetTouches[0].pageX,\n y1 = e.targetTouches[0].pageY,\n x2 = e.targetTouches[1].pageX,\n y2 = e.targetTouches[1].pageY;\n var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n return distance;\n },\n // Events\n onGestureStart: function (e) {\n var z = s.zoom;\n if (!s.support.gestures) {\n if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) {\n return;\n }\n z.gesture.scaleStart = z.getDistanceBetweenTouches(e);\n }\n if (!z.gesture.slide || !z.gesture.slide.length) {\n z.gesture.slide = $(this);\n if (z.gesture.slide.length === 0) z.gesture.slide = s.slides.eq(s.activeIndex);\n z.gesture.image = z.gesture.slide.find('img, svg, canvas');\n z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);\n z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax ;\n if (z.gesture.imageWrap.length === 0) {\n z.gesture.image = undefined;\n return;\n }\n }\n z.gesture.image.transition(0);\n z.isScaling = true;\n },\n onGestureChange: function (e) {\n var z = s.zoom;\n if (!s.support.gestures) {\n if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) {\n return;\n }\n z.gesture.scaleMove = z.getDistanceBetweenTouches(e);\n }\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n if (s.support.gestures) {\n z.scale = e.scale * z.currentScale;\n }\n else {\n z.scale = (z.gesture.scaleMove / z.gesture.scaleStart) * z.currentScale;\n }\n if (z.scale > z.gesture.zoomMax) {\n z.scale = z.gesture.zoomMax - 1 + Math.pow((z.scale - z.gesture.zoomMax + 1), 0.5);\n }\n if (z.scale < s.params.zoomMin) {\n z.scale = s.params.zoomMin + 1 - Math.pow((s.params.zoomMin - z.scale + 1), 0.5);\n }\n z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')');\n },\n onGestureEnd: function (e) {\n var z = s.zoom;\n if (!s.support.gestures) {\n if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) {\n return;\n }\n }\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin);\n z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')');\n z.currentScale = z.scale;\n z.isScaling = false;\n if (z.scale === 1) z.gesture.slide = undefined;\n },\n onTouchStart: function (s, e) {\n var z = s.zoom;\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n if (z.image.isTouched) return;\n if (s.device.os === 'android') e.preventDefault();\n z.image.isTouched = true;\n z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n },\n onTouchMove: function (e) {\n var z = s.zoom;\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n s.allowClick = false;\n if (!z.image.isTouched || !z.gesture.slide) return;\n \n if (!z.image.isMoved) {\n z.image.width = z.gesture.image[0].offsetWidth;\n z.image.height = z.gesture.image[0].offsetHeight;\n z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0;\n z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0;\n z.gesture.slideWidth = z.gesture.slide[0].offsetWidth;\n z.gesture.slideHeight = z.gesture.slide[0].offsetHeight;\n z.gesture.imageWrap.transition(0);\n if (s.rtl) z.image.startX = -z.image.startX;\n if (s.rtl) z.image.startY = -z.image.startY;\n }\n // Define if we need image drag\n var scaledWidth = z.image.width * z.scale;\n var scaledHeight = z.image.height * z.scale;\n \n if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) return;\n \n z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0);\n z.image.maxX = -z.image.minX;\n z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0);\n z.image.maxY = -z.image.minY;\n \n z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n \n if (!z.image.isMoved && !z.isScaling) {\n if (s.isHorizontal() &&\n (Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x) ||\n (Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x)\n ) {\n z.image.isTouched = false;\n return;\n }\n else if (!s.isHorizontal() &&\n (Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y) ||\n (Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y)\n ) {\n z.image.isTouched = false;\n return;\n }\n }\n e.preventDefault();\n e.stopPropagation();\n \n z.image.isMoved = true;\n z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;\n z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;\n \n if (z.image.currentX < z.image.minX) {\n z.image.currentX = z.image.minX + 1 - Math.pow((z.image.minX - z.image.currentX + 1), 0.8);\n }\n if (z.image.currentX > z.image.maxX) {\n z.image.currentX = z.image.maxX - 1 + Math.pow((z.image.currentX - z.image.maxX + 1), 0.8);\n }\n \n if (z.image.currentY < z.image.minY) {\n z.image.currentY = z.image.minY + 1 - Math.pow((z.image.minY - z.image.currentY + 1), 0.8);\n }\n if (z.image.currentY > z.image.maxY) {\n z.image.currentY = z.image.maxY - 1 + Math.pow((z.image.currentY - z.image.maxY + 1), 0.8);\n }\n \n //Velocity\n if (!z.velocity.prevPositionX) z.velocity.prevPositionX = z.image.touchesCurrent.x;\n if (!z.velocity.prevPositionY) z.velocity.prevPositionY = z.image.touchesCurrent.y;\n if (!z.velocity.prevTime) z.velocity.prevTime = Date.now();\n z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;\n z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;\n if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2) z.velocity.x = 0;\n if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2) z.velocity.y = 0;\n z.velocity.prevPositionX = z.image.touchesCurrent.x;\n z.velocity.prevPositionY = z.image.touchesCurrent.y;\n z.velocity.prevTime = Date.now();\n \n z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');\n },\n onTouchEnd: function (s, e) {\n var z = s.zoom;\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n if (!z.image.isTouched || !z.image.isMoved) {\n z.image.isTouched = false;\n z.image.isMoved = false;\n return;\n }\n z.image.isTouched = false;\n z.image.isMoved = false;\n var momentumDurationX = 300;\n var momentumDurationY = 300;\n var momentumDistanceX = z.velocity.x * momentumDurationX;\n var newPositionX = z.image.currentX + momentumDistanceX;\n var momentumDistanceY = z.velocity.y * momentumDurationY;\n var newPositionY = z.image.currentY + momentumDistanceY;\n \n //Fix duration\n if (z.velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);\n if (z.velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);\n var momentumDuration = Math.max(momentumDurationX, momentumDurationY);\n \n z.image.currentX = newPositionX;\n z.image.currentY = newPositionY;\n \n // Define if we need image drag\n var scaledWidth = z.image.width * z.scale;\n var scaledHeight = z.image.height * z.scale;\n z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0);\n z.image.maxX = -z.image.minX;\n z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0);\n z.image.maxY = -z.image.minY;\n z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);\n z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);\n \n z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');\n },\n onTransitionEnd: function (s) {\n var z = s.zoom;\n if (z.gesture.slide && s.previousIndex !== s.activeIndex) {\n z.gesture.image.transform('translate3d(0,0,0) scale(1)');\n z.gesture.imageWrap.transform('translate3d(0,0,0)');\n z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;\n z.scale = z.currentScale = 1;\n }\n },\n // Toggle Zoom\n toggleZoom: function (s, e) {\n var z = s.zoom;\n if (!z.gesture.slide) {\n z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex);\n z.gesture.image = z.gesture.slide.find('img, svg, canvas');\n z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass);\n }\n if (!z.gesture.image || z.gesture.image.length === 0) return;\n \n var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight;\n \n if (typeof z.image.touchesStart.x === 'undefined' && e) {\n touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX;\n touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY;\n }\n else {\n touchX = z.image.touchesStart.x;\n touchY = z.image.touchesStart.y;\n }\n \n if (z.scale && z.scale !== 1) {\n // Zoom Out\n z.scale = z.currentScale = 1;\n z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)');\n z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)');\n z.gesture.slide = undefined;\n }\n else {\n // Zoom In\n z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax;\n if (e) {\n slideWidth = z.gesture.slide[0].offsetWidth;\n slideHeight = z.gesture.slide[0].offsetHeight;\n offsetX = z.gesture.slide.offset().left;\n offsetY = z.gesture.slide.offset().top;\n diffX = offsetX + slideWidth/2 - touchX;\n diffY = offsetY + slideHeight/2 - touchY;\n \n imageWidth = z.gesture.image[0].offsetWidth;\n imageHeight = z.gesture.image[0].offsetHeight;\n scaledWidth = imageWidth * z.scale;\n scaledHeight = imageHeight * z.scale;\n \n translateMinX = Math.min((slideWidth / 2 - scaledWidth / 2), 0);\n translateMinY = Math.min((slideHeight / 2 - scaledHeight / 2), 0);\n translateMaxX = -translateMinX;\n translateMaxY = -translateMinY;\n \n translateX = diffX * z.scale;\n translateY = diffY * z.scale;\n \n if (translateX < translateMinX) {\n translateX = translateMinX;\n }\n if (translateX > translateMaxX) {\n translateX = translateMaxX;\n }\n \n if (translateY < translateMinY) {\n translateY = translateMinY;\n }\n if (translateY > translateMaxY) {\n translateY = translateMaxY;\n }\n }\n else {\n translateX = 0;\n translateY = 0;\n }\n z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)');\n z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')');\n }\n },\n // Attach/Detach Events\n attachEvents: function (detach) {\n var action = detach ? 'off' : 'on';\n \n if (s.params.zoom) {\n var target = s.slides;\n var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false;\n // Scale image\n if (s.support.gestures) {\n s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener);\n s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener);\n s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener);\n }\n else if (s.touchEvents.start === 'touchstart') {\n s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener);\n s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener);\n s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener);\n }\n \n // Move image\n s[action]('touchStart', s.zoom.onTouchStart);\n s.slides.each(function (index, slide){\n if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) {\n $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove);\n }\n });\n s[action]('touchEnd', s.zoom.onTouchEnd);\n \n // Scale Out\n s[action]('transitionEnd', s.zoom.onTransitionEnd);\n if (s.params.zoomToggle) {\n s.on('doubleTap', s.zoom.toggleZoom);\n }\n }\n },\n init: function () {\n s.zoom.attachEvents();\n },\n destroy: function () {\n s.zoom.attachEvents(true);\n }\n };\n \n \n /*=========================\n Plugins API. Collect all and init all plugins\n ===========================*/\n s._plugins = [];\n for (var plugin in s.plugins) {\n var p = s.plugins[plugin](s, s.params[plugin]);\n if (p) s._plugins.push(p);\n }\n // Method to call all plugins event/method\n s.callPlugins = function (eventName) {\n for (var i = 0; i < s._plugins.length; i++) {\n if (eventName in s._plugins[i]) {\n s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n }\n }\n };\n \n \n /*=========================\n Events/Callbacks/Plugins Emitter\n ===========================*/\n function normalizeEventName (eventName) {\n if (eventName.indexOf('on') !== 0) {\n if (eventName[0] !== eventName[0].toUpperCase()) {\n eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);\n }\n else {\n eventName = 'on' + eventName;\n }\n }\n return eventName;\n }\n s.emitterEventListeners = {\n \n };\n s.emit = function (eventName) {\n // Trigger callbacks\n if (s.params[eventName]) {\n s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n }\n var i;\n // Trigger events\n if (s.emitterEventListeners[eventName]) {\n for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n }\n }\n // Trigger plugins\n if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n };\n s.on = function (eventName, handler) {\n eventName = normalizeEventName(eventName);\n if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];\n s.emitterEventListeners[eventName].push(handler);\n return s;\n };\n s.off = function (eventName, handler) {\n var i;\n eventName = normalizeEventName(eventName);\n if (typeof handler === 'undefined') {\n // Remove all handlers for such event\n s.emitterEventListeners[eventName] = [];\n return s;\n }\n if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;\n for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);\n }\n return s;\n };\n s.once = function (eventName, handler) {\n eventName = normalizeEventName(eventName);\n var _handler = function () {\n handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);\n s.off(eventName, _handler);\n };\n s.on(eventName, _handler);\n return s;\n };\n \n \n // Accessibility tools\n s.a11y = {\n makeFocusable: function ($el) {\n $el.attr('tabIndex', '0');\n return $el;\n },\n addRole: function ($el, role) {\n $el.attr('role', role);\n return $el;\n },\n \n addLabel: function ($el, label) {\n $el.attr('aria-label', label);\n return $el;\n },\n \n disable: function ($el) {\n $el.attr('aria-disabled', true);\n return $el;\n },\n \n enable: function ($el) {\n $el.attr('aria-disabled', false);\n return $el;\n },\n \n onEnterKey: function (event) {\n if (event.keyCode !== 13) return;\n if ($(event.target).is(s.params.nextButton)) {\n s.onClickNext(event);\n if (s.isEnd) {\n s.a11y.notify(s.params.lastSlideMessage);\n }\n else {\n s.a11y.notify(s.params.nextSlideMessage);\n }\n }\n else if ($(event.target).is(s.params.prevButton)) {\n s.onClickPrev(event);\n if (s.isBeginning) {\n s.a11y.notify(s.params.firstSlideMessage);\n }\n else {\n s.a11y.notify(s.params.prevSlideMessage);\n }\n }\n if ($(event.target).is('.' + s.params.bulletClass)) {\n $(event.target)[0].click();\n }\n },\n \n liveRegion: $('
'),\n \n notify: function (message) {\n var notification = s.a11y.liveRegion;\n if (notification.length === 0) return;\n notification.html('');\n notification.html(message);\n },\n init: function () {\n // Setup accessibility\n if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {\n s.a11y.makeFocusable(s.nextButton);\n s.a11y.addRole(s.nextButton, 'button');\n s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);\n }\n if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {\n s.a11y.makeFocusable(s.prevButton);\n s.a11y.addRole(s.prevButton, 'button');\n s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);\n }\n \n $(s.container).append(s.a11y.liveRegion);\n },\n initPagination: function () {\n if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {\n s.bullets.each(function () {\n var bullet = $(this);\n s.a11y.makeFocusable(bullet);\n s.a11y.addRole(bullet, 'button');\n s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));\n });\n }\n },\n destroy: function () {\n if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();\n }\n };\n \n \n /*=========================\n Init/Destroy\n ===========================*/\n s.init = function () {\n if (s.params.loop) s.createLoop();\n s.updateContainerSize();\n s.updateSlidesSize();\n s.updatePagination();\n if (s.params.scrollbar && s.scrollbar) {\n s.scrollbar.set();\n if (s.params.scrollbarDraggable) {\n s.scrollbar.enableDraggable();\n }\n }\n if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n if (!s.params.loop) s.updateProgress();\n s.effects[s.params.effect].setTranslate();\n }\n if (s.params.loop) {\n s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);\n }\n else {\n s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);\n if (s.params.initialSlide === 0) {\n if (s.parallax && s.params.parallax) s.parallax.setTranslate();\n if (s.lazy && s.params.lazyLoading) {\n s.lazy.load();\n s.lazy.initialImageLoaded = true;\n }\n }\n }\n s.attachEvents();\n if (s.params.observer && s.support.observer) {\n s.initObservers();\n }\n if (s.params.preloadImages && !s.params.lazyLoading) {\n s.preloadImages();\n }\n if (s.params.zoom && s.zoom) {\n s.zoom.init();\n }\n if (s.params.autoplay) {\n s.startAutoplay();\n }\n if (s.params.keyboardControl) {\n if (s.enableKeyboardControl) s.enableKeyboardControl();\n }\n if (s.params.mousewheelControl) {\n if (s.enableMousewheelControl) s.enableMousewheelControl();\n }\n // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history\n if (s.params.hashnavReplaceState) {\n s.params.replaceState = s.params.hashnavReplaceState;\n }\n if (s.params.history) {\n if (s.history) s.history.init();\n }\n if (s.params.hashnav) {\n if (s.hashnav) s.hashnav.init();\n }\n if (s.params.a11y && s.a11y) s.a11y.init();\n s.emit('onInit', s);\n };\n \n // Cleanup dynamic styles\n s.cleanupStyles = function () {\n // Container\n s.container.removeClass(s.classNames.join(' ')).removeAttr('style');\n \n // Wrapper\n s.wrapper.removeAttr('style');\n \n // Slides\n if (s.slides && s.slides.length) {\n s.slides\n .removeClass([\n s.params.slideVisibleClass,\n s.params.slideActiveClass,\n s.params.slideNextClass,\n s.params.slidePrevClass\n ].join(' '))\n .removeAttr('style')\n .removeAttr('data-swiper-column')\n .removeAttr('data-swiper-row');\n }\n \n // Pagination/Bullets\n if (s.paginationContainer && s.paginationContainer.length) {\n s.paginationContainer.removeClass(s.params.paginationHiddenClass);\n }\n if (s.bullets && s.bullets.length) {\n s.bullets.removeClass(s.params.bulletActiveClass);\n }\n \n // Buttons\n if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);\n if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);\n \n // Scrollbar\n if (s.params.scrollbar && s.scrollbar) {\n if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');\n if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');\n }\n };\n \n // Destroy\n s.destroy = function (deleteInstance, cleanupStyles) {\n // Detach evebts\n s.detachEvents();\n // Stop autoplay\n s.stopAutoplay();\n // Disable draggable\n if (s.params.scrollbar && s.scrollbar) {\n if (s.params.scrollbarDraggable) {\n s.scrollbar.disableDraggable();\n }\n }\n // Destroy loop\n if (s.params.loop) {\n s.destroyLoop();\n }\n // Cleanup styles\n if (cleanupStyles) {\n s.cleanupStyles();\n }\n // Disconnect observer\n s.disconnectObservers();\n \n // Destroy zoom\n if (s.params.zoom && s.zoom) {\n s.zoom.destroy();\n }\n // Disable keyboard/mousewheel\n if (s.params.keyboardControl) {\n if (s.disableKeyboardControl) s.disableKeyboardControl();\n }\n if (s.params.mousewheelControl) {\n if (s.disableMousewheelControl) s.disableMousewheelControl();\n }\n // Disable a11y\n if (s.params.a11y && s.a11y) s.a11y.destroy();\n // Delete history popstate\n if (s.params.history && !s.params.replaceState) {\n window.removeEventListener('popstate', s.history.setHistoryPopState);\n }\n if (s.params.hashnav && s.hashnav) {\n s.hashnav.destroy();\n }\n // Destroy callback\n s.emit('onDestroy');\n // Delete instance\n if (deleteInstance !== false) s = null;\n };\n \n s.init();\n \n \n \n // Return swiper instance\n return s;\n };\n \n /*==================================================\n Prototype\n ====================================================*/\n Swiper.prototype = {\n isSafari: (function () {\n var ua = window.navigator.userAgent.toLowerCase();\n return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);\n })(),\n isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),\n isArray: function (arr) {\n return Object.prototype.toString.apply(arr) === '[object Array]';\n },\n /*==================================================\n Browser\n ====================================================*/\n browser: {\n ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,\n ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1),\n lteIE9: (function() {\n // create temporary DIV\n var div = document.createElement('div');\n // add content to tmp DIV which is wrapped into the IE HTML conditional statement\n div.innerHTML = '';\n // return true / false value based on what will browser render\n return div.getElementsByTagName('i').length === 1;\n })()\n },\n /*==================================================\n Devices\n ====================================================*/\n device: (function () {\n var ua = window.navigator.userAgent;\n var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/);\n var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n var ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n var iphone = !ipad && ua.match(/(iPhone\\sOS|iOS)\\s([\\d_]+)/);\n return {\n ios: ipad || iphone || ipod,\n android: android\n };\n })(),\n /*==================================================\n Feature Detection\n ====================================================*/\n support: {\n touch : (window.Modernizr && Modernizr.touch === true) || (function () {\n return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);\n })(),\n \n transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {\n var div = document.createElement('div').style;\n return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);\n })(),\n \n flexbox: (function () {\n var div = document.createElement('div').style;\n var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');\n for (var i = 0; i < styles.length; i++) {\n if (styles[i] in div) return true;\n }\n })(),\n \n observer: (function () {\n return ('MutationObserver' in window || 'WebkitMutationObserver' in window);\n })(),\n \n passiveListener: (function () {\n var supportsPassive = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function() {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassiveListener', null, opts);\n } catch (e) {}\n return supportsPassive;\n })(),\n \n gestures: (function () {\n return 'ongesturestart' in window;\n })()\n },\n /*==================================================\n Plugins\n ====================================================*/\n plugins: {}\n };\n \n","})();\n"]}