diff --git a/assets/bxSlider/images/bx_loader.gif b/assets/bxSlider/images/bx_loader.gif new file mode 100644 index 0000000..f4ff40e Binary files /dev/null and b/assets/bxSlider/images/bx_loader.gif differ diff --git a/assets/bxSlider/images/controls.png b/assets/bxSlider/images/controls.png new file mode 100644 index 0000000..28918dd Binary files /dev/null and b/assets/bxSlider/images/controls.png differ diff --git a/assets/bxSlider/jquery.bxslider.css b/assets/bxSlider/jquery.bxslider.css new file mode 100644 index 0000000..2afc0f3 --- /dev/null +++ b/assets/bxSlider/jquery.bxslider.css @@ -0,0 +1,177 @@ +/** VARIABLES +===================================*/ +/** RESET AND LAYOUT +===================================*/ +.bx-wrapper { + position: relative; + margin-bottom: 60px; + padding: 0; + *zoom: 1; + -ms-touch-action: pan-y; + touch-action: pan-y; +} +.bx-wrapper img { + max-width: 100%; + display: block; +} +.bxslider { + margin: 0; + padding: 0; +} +ul.bxslider { + list-style: none; +} +.bx-viewport { + /*fix other elements on the page moving (on Chrome)*/ + -webkit-transform: translatez(0); +} +/** THEME +===================================*/ +.bx-wrapper { + -moz-box-shadow: 0 0 5px #ccc; + -webkit-box-shadow: 0 0 5px #ccc; + box-shadow: 0 0 5px #ccc; + border: 5px solid #fff; + background: #fff; +} +.bx-wrapper .bx-pager, +.bx-wrapper .bx-controls-auto { + position: absolute; + bottom: -30px; + width: 100%; +} +/* LOADER */ +.bx-wrapper .bx-loading { + min-height: 50px; + background: url('images/bx_loader.gif') center center no-repeat #ffffff; + height: 100%; + width: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 2000; +} +/* PAGER */ +.bx-wrapper .bx-pager { + text-align: center; + font-size: .85em; + font-family: Arial; + font-weight: bold; + color: #666; + padding-top: 20px; +} +.bx-wrapper .bx-pager.bx-default-pager a { + background: #666; + text-indent: -9999px; + display: block; + width: 10px; + height: 10px; + margin: 0 5px; + outline: 0; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} +.bx-wrapper .bx-pager.bx-default-pager a:hover, +.bx-wrapper .bx-pager.bx-default-pager a.active, +.bx-wrapper .bx-pager.bx-default-pager a:focus { + background: #000; +} +.bx-wrapper .bx-pager-item, +.bx-wrapper .bx-controls-auto .bx-controls-auto-item { + display: inline-block; + vertical-align: bottom; + *zoom: 1; + *display: inline; +} +.bx-wrapper .bx-pager-item { + font-size: 0; + line-height: 0; +} +/* DIRECTION CONTROLS (NEXT / PREV) */ +.bx-wrapper .bx-prev { + left: 10px; + background: url('images/controls.png') no-repeat 0 -32px; +} +.bx-wrapper .bx-prev:hover, +.bx-wrapper .bx-prev:focus { + background-position: 0 0; +} +.bx-wrapper .bx-next { + right: 10px; + background: url('images/controls.png') no-repeat -43px -32px; +} +.bx-wrapper .bx-next:hover, +.bx-wrapper .bx-next:focus { + background-position: -43px 0; +} +.bx-wrapper .bx-controls-direction a { + position: absolute; + top: 50%; + margin-top: -16px; + outline: 0; + width: 32px; + height: 32px; + text-indent: -9999px; + z-index: 9999; +} +.bx-wrapper .bx-controls-direction a.disabled { + display: none; +} +/* AUTO CONTROLS (START / STOP) */ +.bx-wrapper .bx-controls-auto { + text-align: center; +} +.bx-wrapper .bx-controls-auto .bx-start { + display: block; + text-indent: -9999px; + width: 10px; + height: 11px; + outline: 0; + background: url('images/controls.png') -86px -11px no-repeat; + margin: 0 3px; +} +.bx-wrapper .bx-controls-auto .bx-start:hover, +.bx-wrapper .bx-controls-auto .bx-start.active, +.bx-wrapper .bx-controls-auto .bx-start:focus { + background-position: -86px 0; +} +.bx-wrapper .bx-controls-auto .bx-stop { + display: block; + text-indent: -9999px; + width: 9px; + height: 11px; + outline: 0; + background: url('images/controls.png') -86px -44px no-repeat; + margin: 0 3px; +} +.bx-wrapper .bx-controls-auto .bx-stop:hover, +.bx-wrapper .bx-controls-auto .bx-stop.active, +.bx-wrapper .bx-controls-auto .bx-stop:focus { + background-position: -86px -33px; +} +/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */ +.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager { + text-align: left; + width: 80%; +} +.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto { + right: 0; + width: 35px; +} +/* IMAGE CAPTIONS */ +.bx-wrapper .bx-caption { + position: absolute; + bottom: 0; + left: 0; + background: #666; + background: rgba(80, 80, 80, 0.75); + width: 100%; +} +.bx-wrapper .bx-caption span { + color: #fff; + font-family: Arial; + display: block; + font-size: .85em; + padding: 10px; +} diff --git a/assets/bxSlider/jquery.bxslider.js b/assets/bxSlider/jquery.bxslider.js new file mode 100644 index 0000000..67ac4d8 --- /dev/null +++ b/assets/bxSlider/jquery.bxslider.js @@ -0,0 +1,1607 @@ +/** + * bxSlider v4.2.12 + * Copyright 2013-2015 Steven Wanderski + * Written while drinking Belgian ales and listening to jazz + * Licensed under MIT (http://opensource.org/licenses/MIT) + */ + +;(function($) { + + var defaults = { + + // GENERAL + mode: 'horizontal', + slideSelector: '', + infiniteLoop: true, + hideControlOnEnd: false, + speed: 500, + easing: null, + slideMargin: 0, + startSlide: 0, + randomStart: false, + captions: false, + ticker: false, + tickerHover: false, + adaptiveHeight: false, + adaptiveHeightSpeed: 500, + video: false, + useCSS: true, + preloadImages: 'visible', + responsive: true, + slideZIndex: 50, + wrapperClass: 'bx-wrapper', + + // TOUCH + touchEnabled: true, + swipeThreshold: 50, + oneToOneTouch: true, + preventDefaultSwipeX: true, + preventDefaultSwipeY: false, + + // ACCESSIBILITY + ariaLive: true, + ariaHidden: true, + + // KEYBOARD + keyboardEnabled: false, + + // PAGER + pager: true, + pagerType: 'full', + pagerShortSeparator: ' / ', + pagerSelector: null, + buildPager: null, + pagerCustom: null, + + // CONTROLS + controls: true, + nextText: 'Next', + prevText: 'Prev', + nextSelector: null, + prevSelector: null, + autoControls: false, + startText: 'Start', + stopText: 'Stop', + autoControlsCombine: false, + autoControlsSelector: null, + + // AUTO + auto: false, + pause: 4000, + autoStart: true, + autoDirection: 'next', + stopAutoOnClick: false, + autoHover: false, + autoDelay: 0, + autoSlideForOnePage: false, + + // CAROUSEL + minSlides: 1, + maxSlides: 1, + moveSlides: 0, + slideWidth: 0, + shrinkItems: false, + + // CALLBACKS + onSliderLoad: function() { return true; }, + onSlideBefore: function() { return true; }, + onSlideAfter: function() { return true; }, + onSlideNext: function() { return true; }, + onSlidePrev: function() { return true; }, + onSliderResize: function() { return true; } + }; + + $.fn.bxSlider = function(options) { + + if (this.length === 0) { + return this; + } + + // support multiple elements + if (this.length > 1) { + this.each(function() { + $(this).bxSlider(options); + }); + return this; + } + + // create a namespace to be used throughout the plugin + var slider = {}, + // set a reference to our slider element + el = this, + // get the original window dimens (thanks a lot IE) + windowWidth = $(window).width(), + windowHeight = $(window).height(); + + // Return if slider is already initialized + if ($(el).data('bxSlider')) { return; } + + /** + * =================================================================================== + * = PRIVATE FUNCTIONS + * =================================================================================== + */ + + /** + * Initializes namespace settings to be used throughout plugin + */ + var init = function() { + // Return if slider is already initialized + if ($(el).data('bxSlider')) { return; } + // merge user-supplied options with the defaults + slider.settings = $.extend({}, defaults, options); + // parse slideWidth setting + slider.settings.slideWidth = parseInt(slider.settings.slideWidth); + // store the original children + slider.children = el.children(slider.settings.slideSelector); + // check if actual number of slides is less than minSlides / maxSlides + if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; } + if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; } + // if random start, set the startSlide setting to random number + if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); } + // store active slide information + slider.active = { index: slider.settings.startSlide }; + // store if the slider is in carousel mode (displaying / moving multiple slides) + slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false; + // if carousel, force preloadImages = 'all' + if (slider.carousel) { slider.settings.preloadImages = 'all'; } + // calculate the min / max width thresholds based on min / max number of slides + // used to setup and update carousel slides dimensions + slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin); + slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); + // store the current state of the slider (if currently animating, working is true) + slider.working = false; + // initialize the controls object + slider.controls = {}; + // initialize an auto interval + slider.interval = null; + // determine which property to use for transitions + slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left'; + // determine if hardware acceleration can be used + slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() { + // create our test div element + var div = document.createElement('div'), + // css transition properties + props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; + // test for each property + for (var i = 0; i < props.length; i++) { + if (div.style[props[i]] !== undefined) { + slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase(); + slider.animProp = '-' + slider.cssPrefix + '-transform'; + return true; + } + } + return false; + }()); + // if vertical mode always make maxSlides and minSlides equal + if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; } + // save original style data + el.data('origStyle', el.attr('style')); + el.children(slider.settings.slideSelector).each(function() { + $(this).data('origStyle', $(this).attr('style')); + }); + + // perform all DOM / CSS modifications + setup(); + }; + + /** + * Performs all DOM and CSS modifications + */ + var setup = function() { + var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible) + + // wrap el in a wrapper + el.wrap('
'); + // store a namespace reference to .bx-viewport + slider.viewport = el.parent(); + + // add aria-live if the setting is enabled and ticker mode is disabled + if (slider.settings.ariaLive && !slider.settings.ticker) { + slider.viewport.attr('aria-live', 'polite'); + } + // add a loading div to display while images are loading + slider.loader = $('
'); + slider.viewport.prepend(slider.loader); + // set el to a massive width, to hold any needed slides + // also strip any margin and padding from el + el.css({ + width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto', + position: 'relative' + }); + // if using CSS, add the easing property + if (slider.usingCSS && slider.settings.easing) { + el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing); + // if not using CSS and no easing value was supplied, use the default JS animation easing (swing) + } else if (!slider.settings.easing) { + slider.settings.easing = 'swing'; + } + // make modifications to the viewport (.bx-viewport) + slider.viewport.css({ + width: '100%', + overflow: 'hidden', + position: 'relative' + }); + slider.viewport.parent().css({ + maxWidth: getViewportMaxWidth() + }); + // apply css to all slider children + slider.children.css({ + float: slider.settings.mode === 'horizontal' ? 'left' : 'none', + listStyle: 'none', + position: 'relative' + }); + // apply the calculated width after the float is applied to prevent scrollbar interference + slider.children.css('width', getSlideWidth()); + // if slideMargin is supplied, add the css + if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); } + if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); } + // if "fade" mode, add positioning and z-index CSS + if (slider.settings.mode === 'fade') { + slider.children.css({ + position: 'absolute', + zIndex: 0, + display: 'none' + }); + // prepare the z-index on the showing element + slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'}); + } + // create an element to contain all slider controls (pager, start / stop, etc) + slider.controls.el = $('
'); + // if captions are requested, add them + if (slider.settings.captions) { appendCaptions(); } + // check if startSlide is last slide + slider.active.last = slider.settings.startSlide === getPagerQty() - 1; + // if video is true, set up the fitVids plugin + if (slider.settings.video) { el.fitVids(); } + if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; } + // only check for control addition if not in "ticker" mode + if (!slider.settings.ticker) { + // if controls are requested, add them + if (slider.settings.controls) { appendControls(); } + // if auto is true, and auto controls are requested, add them + if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); } + // if pager is requested, add it + if (slider.settings.pager) { appendPager(); } + // if any control option is requested, add the controls wrapper + if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); } + // if ticker mode, do not allow a pager + } else { + slider.settings.pager = false; + } + loadElements(preloadSelector, start); + }; + + var loadElements = function(selector, callback) { + var total = selector.find('img:not([src=""]), iframe').length, + count = 0; + if (total === 0) { + callback(); + return; + } + selector.find('img:not([src=""]), iframe').each(function() { + $(this).one('load error', function() { + if (++count === total) { callback(); } + }).each(function() { + if (this.complete) { $(this).trigger('load'); } + }); + }); + }; + + /** + * Start the slider + */ + var start = function() { + // if infinite loop, prepare additional slides + if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) { + var slice = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides, + sliceAppend = slider.children.slice(0, slice).clone(true).addClass('bx-clone'), + slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone'); + if (slider.settings.ariaHidden) { + sliceAppend.attr('aria-hidden', true); + slicePrepend.attr('aria-hidden', true); + } + el.append(sliceAppend).prepend(slicePrepend); + } + // remove the loading DOM element + slider.loader.remove(); + // set the left / top position of "el" + setSlidePosition(); + // if "vertical" mode, always use adaptiveHeight to prevent odd behavior + if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; } + // set the viewport height + slider.viewport.height(getViewportHeight()); + // make sure everything is positioned just right (same as a window resize) + el.redrawSlider(); + // onSliderLoad callback + slider.settings.onSliderLoad.call(el, slider.active.index); + // slider has been fully initialized + slider.initialized = true; + // bind the resize call to the window + if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); } + // if auto is true and has more than 1 page, start the show + if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); } + // if ticker is true, start the ticker + if (slider.settings.ticker) { initTicker(); } + // if pager is requested, make the appropriate pager link active + if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); } + // check for any updates to the controls (like hideControlOnEnd updates) + if (slider.settings.controls) { updateDirectionControls(); } + // if touchEnabled is true, setup the touch events + if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); } + // if keyboardEnabled is true, setup the keyboard events + if (slider.settings.keyboardEnabled && !slider.settings.ticker) { + $(document).keydown(keyPress); + } + }; + + /** + * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value + */ + var getViewportHeight = function() { + var height = 0; + // first determine which children (slides) should be used in our height calculation + var children = $(); + // if mode is not "vertical" and adaptiveHeight is false, include all children + if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) { + children = slider.children; + } else { + // if not carousel, return the single active child + if (!slider.carousel) { + children = slider.children.eq(slider.active.index); + // if carousel, return a slice of children + } else { + // get the individual slide index + var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy(); + // add the current slide to the children + children = slider.children.eq(currentIndex); + // cycle through the remaining "showing" slides + for (i = 1; i <= slider.settings.maxSlides - 1; i++) { + // if looped back to the start + if (currentIndex + i >= slider.children.length) { + children = children.add(slider.children.eq(i - 1)); + } else { + children = children.add(slider.children.eq(currentIndex + i)); + } + } + } + } + // if "vertical" mode, calculate the sum of the heights of the children + if (slider.settings.mode === 'vertical') { + children.each(function(index) { + height += $(this).outerHeight(); + }); + // add user-supplied margins + if (slider.settings.slideMargin > 0) { + height += slider.settings.slideMargin * (slider.settings.minSlides - 1); + } + // if not "vertical" mode, calculate the max height of the children + } else { + height = Math.max.apply(Math, children.map(function() { + return $(this).outerHeight(false); + }).get()); + } + + if (slider.viewport.css('box-sizing') === 'border-box') { + height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) + + parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width')); + } else if (slider.viewport.css('box-sizing') === 'padding-box') { + height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')); + } + + return height; + }; + + /** + * Returns the calculated width to be used for the outer wrapper / viewport + */ + var getViewportMaxWidth = function() { + var width = '100%'; + if (slider.settings.slideWidth > 0) { + if (slider.settings.mode === 'horizontal') { + width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); + } else { + width = slider.settings.slideWidth; + } + } + return width; + }; + + /** + * Returns the calculated width to be applied to each slide + */ + var getSlideWidth = function() { + var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width + wrapWidth = slider.viewport.width(); // get the current viewport width + // if slide width was not supplied, or is larger than the viewport use the viewport width + if (slider.settings.slideWidth === 0 || + (slider.settings.slideWidth > wrapWidth && !slider.carousel) || + slider.settings.mode === 'vertical') { + newElWidth = wrapWidth; + // if carousel, use the thresholds to determine the width + } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') { + if (wrapWidth > slider.maxThreshold) { + return newElWidth; + } else if (wrapWidth < slider.minThreshold) { + newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides; + } else if (slider.settings.shrinkItems) { + newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin); + } + } + return newElWidth; + }; + + /** + * Returns the number of slides currently visible in the viewport (includes partially visible slides) + */ + var getNumberSlidesShowing = function() { + var slidesShowing = 1, + childWidth = null; + if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) { + // if viewport is smaller than minThreshold, return minSlides + if (slider.viewport.width() < slider.minThreshold) { + slidesShowing = slider.settings.minSlides; + // if viewport is larger than maxThreshold, return maxSlides + } else if (slider.viewport.width() > slider.maxThreshold) { + slidesShowing = slider.settings.maxSlides; + // if viewport is between min / max thresholds, divide viewport width by first child width + } else { + childWidth = slider.children.first().width() + slider.settings.slideMargin; + slidesShowing = Math.floor((slider.viewport.width() + + slider.settings.slideMargin) / childWidth); + } + // if "vertical" mode, slides showing will always be minSlides + } else if (slider.settings.mode === 'vertical') { + slidesShowing = slider.settings.minSlides; + } + return slidesShowing; + }; + + /** + * Returns the number of pages (one full viewport of slides is one "page") + */ + var getPagerQty = function() { + var pagerQty = 0, + breakPoint = 0, + counter = 0; + // if moveSlides is specified by the user + if (slider.settings.moveSlides > 0) { + if (slider.settings.infiniteLoop) { + pagerQty = Math.ceil(slider.children.length / getMoveBy()); + } else { + // when breakpoint goes above children length, counter is the number of pages + while (breakPoint < slider.children.length) { + ++pagerQty; + breakPoint = counter + getNumberSlidesShowing(); + counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing(); + } + } + // if moveSlides is 0 (auto) divide children length by sides showing, then round up + } else { + pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing()); + } + return pagerQty; + }; + + /** + * Returns the number of individual slides by which to shift the slider + */ + var getMoveBy = function() { + // if moveSlides was set by the user and moveSlides is less than number of slides showing + if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) { + return slider.settings.moveSlides; + } + // if moveSlides is 0 (auto) + return getNumberSlidesShowing(); + }; + + /** + * Sets the slider's (el) left or top position + */ + var setSlidePosition = function() { + var position, lastChild, lastShowingIndex; + // if last slide, not infinite loop, and number of children is larger than specified maxSlides + if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) { + if (slider.settings.mode === 'horizontal') { + // get the last child's position + lastChild = slider.children.last(); + position = lastChild.position(); + // set the left position + setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0); + } else if (slider.settings.mode === 'vertical') { + // get the last showing index's position + lastShowingIndex = slider.children.length - slider.settings.minSlides; + position = slider.children.eq(lastShowingIndex).position(); + // set the top position + setPositionProperty(-position.top, 'reset', 0); + } + // if not last slide + } else { + // get the position of the first showing slide + position = slider.children.eq(slider.active.index * getMoveBy()).position(); + // check for last slide + if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; } + // set the respective position + if (position !== undefined) { + if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } + else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } + } + } + }; + + /** + * Sets the el's animating property position (which in turn will sometimes animate el). + * If using CSS, sets the transform property. If not using CSS, sets the top / left property. + * + * @param value (int) + * - the animating property's value + * + * @param type (string) 'slide', 'reset', 'ticker' + * - the type of instance for which the function is being + * + * @param duration (int) + * - the amount of time (in ms) the transition should occupy + * + * @param params (array) optional + * - an optional parameter containing any variables that need to be passed in + */ + var setPositionProperty = function(value, type, duration, params) { + var animateObj, propValue; + // use CSS transform + if (slider.usingCSS) { + // determine the translate3d value + propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)'; + // add the CSS transition-duration + el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's'); + if (type === 'slide') { + // set the property value + el.css(slider.animProp, propValue); + if (duration !== 0) { + // bind a callback method - executes when CSS transition completes + el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { + //make sure it's the correct one + if (!$(e.target).is(el)) { return; } + // unbind the callback + el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); + updateAfterSlideTransition(); + }); + } else { //duration = 0 + updateAfterSlideTransition(); + } + } else if (type === 'reset') { + el.css(slider.animProp, propValue); + } else if (type === 'ticker') { + // make the transition use 'linear' + el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear'); + el.css(slider.animProp, propValue); + if (duration !== 0) { + el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) { + //make sure it's the correct one + if (!$(e.target).is(el)) { return; } + // unbind the callback + el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); + // reset the position + setPositionProperty(params.resetValue, 'reset', 0); + // start the loop again + tickerLoop(); + }); + } else { //duration = 0 + setPositionProperty(params.resetValue, 'reset', 0); + tickerLoop(); + } + } + // use JS animate + } else { + animateObj = {}; + animateObj[slider.animProp] = value; + if (type === 'slide') { + el.animate(animateObj, duration, slider.settings.easing, function() { + updateAfterSlideTransition(); + }); + } else if (type === 'reset') { + el.css(slider.animProp, value); + } else if (type === 'ticker') { + el.animate(animateObj, duration, 'linear', function() { + setPositionProperty(params.resetValue, 'reset', 0); + // run the recursive loop after animation + tickerLoop(); + }); + } + } + }; + + /** + * Populates the pager with proper amount of pages + */ + var populatePager = function() { + var pagerHtml = '', + linkContent = '', + pagerQty = getPagerQty(); + // loop through each pager item + for (var i = 0; i < pagerQty; i++) { + linkContent = ''; + // if a buildPager function is supplied, use it to get pager link value, else use index + 1 + if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) { + linkContent = slider.settings.buildPager(i); + slider.pagerEl.addClass('bx-custom-pager'); + } else { + linkContent = i + 1; + slider.pagerEl.addClass('bx-default-pager'); + } + // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1; + // add the markup to the string + pagerHtml += ''; + } + // populate the pager element with pager links + slider.pagerEl.html(pagerHtml); + }; + + /** + * Appends the pager to the controls element + */ + var appendPager = function() { + if (!slider.settings.pagerCustom) { + // create the pager DOM element + slider.pagerEl = $('
'); + // if a pager selector was supplied, populate it with the pager + if (slider.settings.pagerSelector) { + $(slider.settings.pagerSelector).html(slider.pagerEl); + // if no pager selector was supplied, add it after the wrapper + } else { + slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl); + } + // populate the pager + populatePager(); + } else { + slider.pagerEl = $(slider.settings.pagerCustom); + } + // assign the pager click binding + slider.pagerEl.on('click touchend', 'a', clickPagerBind); + }; + + /** + * Appends prev / next controls to the controls element + */ + var appendControls = function() { + slider.controls.next = $('' + slider.settings.nextText + ''); + slider.controls.prev = $('' + slider.settings.prevText + ''); + // bind click actions to the controls + slider.controls.next.bind('click touchend', clickNextBind); + slider.controls.prev.bind('click touchend', clickPrevBind); + // if nextSelector was supplied, populate it + if (slider.settings.nextSelector) { + $(slider.settings.nextSelector).append(slider.controls.next); + } + // if prevSelector was supplied, populate it + if (slider.settings.prevSelector) { + $(slider.settings.prevSelector).append(slider.controls.prev); + } + // if no custom selectors were supplied + if (!slider.settings.nextSelector && !slider.settings.prevSelector) { + // add the controls to the DOM + slider.controls.directionEl = $('
'); + // add the control elements to the directionEl + slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next); + // slider.viewport.append(slider.controls.directionEl); + slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl); + } + }; + + /** + * Appends start / stop auto controls to the controls element + */ + var appendControlsAuto = function() { + slider.controls.start = $(''); + slider.controls.stop = $(''); + // add the controls to the DOM + slider.controls.autoEl = $('
'); + // bind click actions to the controls + slider.controls.autoEl.on('click', '.bx-start', clickStartBind); + slider.controls.autoEl.on('click', '.bx-stop', clickStopBind); + // if autoControlsCombine, insert only the "start" control + if (slider.settings.autoControlsCombine) { + slider.controls.autoEl.append(slider.controls.start); + // if autoControlsCombine is false, insert both controls + } else { + slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop); + } + // if auto controls selector was supplied, populate it with the controls + if (slider.settings.autoControlsSelector) { + $(slider.settings.autoControlsSelector).html(slider.controls.autoEl); + // if auto controls selector was not supplied, add it after the wrapper + } else { + slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl); + } + // update the auto controls + updateAutoControls(slider.settings.autoStart ? 'stop' : 'start'); + }; + + /** + * Appends image captions to the DOM + */ + var appendCaptions = function() { + // cycle through each child + slider.children.each(function(index) { + // get the image title attribute + var title = $(this).find('img:first').attr('title'); + // append the caption + if (title !== undefined && ('' + title).length) { + $(this).append('
' + title + '
'); + } + }); + }; + + /** + * Click next binding + * + * @param e (event) + * - DOM event object + */ + var clickNextBind = function(e) { + e.preventDefault(); + if (slider.controls.el.hasClass('disabled')) { return; } + // if auto show is running, stop it + if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } + el.goToNextSlide(); + }; + + /** + * Click prev binding + * + * @param e (event) + * - DOM event object + */ + var clickPrevBind = function(e) { + e.preventDefault(); + if (slider.controls.el.hasClass('disabled')) { return; } + // if auto show is running, stop it + if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } + el.goToPrevSlide(); + }; + + /** + * Click start binding + * + * @param e (event) + * - DOM event object + */ + var clickStartBind = function(e) { + el.startAuto(); + e.preventDefault(); + }; + + /** + * Click stop binding + * + * @param e (event) + * - DOM event object + */ + var clickStopBind = function(e) { + el.stopAuto(); + e.preventDefault(); + }; + + /** + * Click pager binding + * + * @param e (event) + * - DOM event object + */ + var clickPagerBind = function(e) { + var pagerLink, pagerIndex; + e.preventDefault(); + if (slider.controls.el.hasClass('disabled')) { + return; + } + // if auto show is running, stop it + if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); } + pagerLink = $(e.currentTarget); + if (pagerLink.attr('data-slide-index') !== undefined) { + pagerIndex = parseInt(pagerLink.attr('data-slide-index')); + // if clicked pager link is not active, continue with the goToSlide call + if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); } + } + }; + + /** + * Updates the pager links with an active class + * + * @param slideIndex (int) + * - index of slide to make active + */ + var updatePagerActive = function(slideIndex) { + // if "short" pager type + var len = slider.children.length; // nb of children + if (slider.settings.pagerType === 'short') { + if (slider.settings.maxSlides > 1) { + len = Math.ceil(slider.children.length / slider.settings.maxSlides); + } + slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len); + return; + } + // remove all pager active classes + slider.pagerEl.find('a').removeClass('active'); + // apply the active class for all pagers + slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); }); + }; + + /** + * Performs needed actions after a slide transition + */ + var updateAfterSlideTransition = function() { + // if infinite loop is true + if (slider.settings.infiniteLoop) { + var position = ''; + // first slide + if (slider.active.index === 0) { + // set the new position + position = slider.children.eq(0).position(); + // carousel, last slide + } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) { + position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position(); + // last slide + } else if (slider.active.index === slider.children.length - 1) { + position = slider.children.eq(slider.children.length - 1).position(); + } + if (position) { + if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); } + else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); } + } + } + // declare that the transition is complete + slider.working = false; + // onSlideAfter callback + slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); + }; + + /** + * Updates the auto controls state (either active, or combined switch) + * + * @param state (string) "start", "stop" + * - the new state of the auto show + */ + var updateAutoControls = function(state) { + // if autoControlsCombine is true, replace the current control with the new state + if (slider.settings.autoControlsCombine) { + slider.controls.autoEl.html(slider.controls[state]); + // if autoControlsCombine is false, apply the "active" class to the appropriate control + } else { + slider.controls.autoEl.find('a').removeClass('active'); + slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active'); + } + }; + + /** + * Updates the direction controls (checks if either should be hidden) + */ + var updateDirectionControls = function() { + if (getPagerQty() === 1) { + slider.controls.prev.addClass('disabled'); + slider.controls.next.addClass('disabled'); + } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) { + // if first slide + if (slider.active.index === 0) { + slider.controls.prev.addClass('disabled'); + slider.controls.next.removeClass('disabled'); + // if last slide + } else if (slider.active.index === getPagerQty() - 1) { + slider.controls.next.addClass('disabled'); + slider.controls.prev.removeClass('disabled'); + // if any slide in the middle + } else { + slider.controls.prev.removeClass('disabled'); + slider.controls.next.removeClass('disabled'); + } + } + }; + + /** + * Initializes the auto process + */ + var initAuto = function() { + // if autoDelay was supplied, launch the auto show using a setTimeout() call + if (slider.settings.autoDelay > 0) { + var timeout = setTimeout(el.startAuto, slider.settings.autoDelay); + // if autoDelay was not supplied, start the auto show normally + } else { + el.startAuto(); + + //add focus and blur events to ensure its running if timeout gets paused + $(window).focus(function() { + el.startAuto(); + }).blur(function() { + el.stopAuto(); + }); + } + // if autoHover is requested + if (slider.settings.autoHover) { + // on el hover + el.hover(function() { + // if the auto show is currently playing (has an active interval) + if (slider.interval) { + // stop the auto show and pass true argument which will prevent control update + el.stopAuto(true); + // create a new autoPaused value which will be used by the relative "mouseout" event + slider.autoPaused = true; + } + }, function() { + // if the autoPaused value was created be the prior "mouseover" event + if (slider.autoPaused) { + // start the auto show and pass true argument which will prevent control update + el.startAuto(true); + // reset the autoPaused value + slider.autoPaused = null; + } + }); + } + }; + + /** + * Initializes the ticker process + */ + var initTicker = function() { + var startPosition = 0, + position, transform, value, idx, ratio, property, newSpeed, totalDimens; + // if autoDirection is "next", append a clone of the entire slider + if (slider.settings.autoDirection === 'next') { + el.append(slider.children.clone().addClass('bx-clone')); + // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position + } else { + el.prepend(slider.children.clone().addClass('bx-clone')); + position = slider.children.first().position(); + startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top; + } + setPositionProperty(startPosition, 'reset', 0); + // do not allow controls in ticker mode + slider.settings.pager = false; + slider.settings.controls = false; + slider.settings.autoControls = false; + // if autoHover is requested + if (slider.settings.tickerHover) { + if (slider.usingCSS) { + idx = slider.settings.mode === 'horizontal' ? 4 : 5; + slider.viewport.hover(function() { + transform = el.css('-' + slider.cssPrefix + '-transform'); + value = parseFloat(transform.split(',')[idx]); + setPositionProperty(value, 'reset', 0); + }, function() { + totalDimens = 0; + slider.children.each(function(index) { + totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); + }); + // calculate the speed ratio (used to determine the new speed to finish the paused animation) + ratio = slider.settings.speed / totalDimens; + // determine which property to use + property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; + // calculate the new speed + newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value)))); + tickerLoop(newSpeed); + }); + } else { + // on el hover + slider.viewport.hover(function() { + el.stop(); + }, function() { + // calculate the total width of children (used to calculate the speed ratio) + totalDimens = 0; + slider.children.each(function(index) { + totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); + }); + // calculate the speed ratio (used to determine the new speed to finish the paused animation) + ratio = slider.settings.speed / totalDimens; + // determine which property to use + property = slider.settings.mode === 'horizontal' ? 'left' : 'top'; + // calculate the new speed + newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property))))); + tickerLoop(newSpeed); + }); + } + } + // start the ticker loop + tickerLoop(); + }; + + /** + * Runs a continuous loop, news ticker-style + */ + var tickerLoop = function(resumeSpeed) { + var speed = resumeSpeed ? resumeSpeed : slider.settings.speed, + position = {left: 0, top: 0}, + reset = {left: 0, top: 0}, + animateProperty, resetValue, params; + + // if "next" animate left position to last child, then reset left to 0 + if (slider.settings.autoDirection === 'next') { + position = el.find('.bx-clone').first().position(); + // if "prev" animate left position to 0, then reset left to first non-clone child + } else { + reset = slider.children.first().position(); + } + animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top; + resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top; + params = {resetValue: resetValue}; + setPositionProperty(animateProperty, 'ticker', speed, params); + }; + + /** + * Check if el is on screen + */ + var isOnScreen = function(el) { + var win = $(window), + viewport = { + top: win.scrollTop(), + left: win.scrollLeft() + }, + bounds = el.offset(); + + viewport.right = viewport.left + win.width(); + viewport.bottom = viewport.top + win.height(); + bounds.right = bounds.left + el.outerWidth(); + bounds.bottom = bounds.top + el.outerHeight(); + + return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); + }; + + /** + * Initializes keyboard events + */ + var keyPress = function(e) { + var activeElementTag = document.activeElement.tagName.toLowerCase(), + tagFilters = 'input|textarea', + p = new RegExp(activeElementTag,['i']), + result = p.exec(tagFilters); + + if (result == null && isOnScreen(el)) { + if (e.keyCode === 39) { + clickNextBind(e); + return false; + } else if (e.keyCode === 37) { + clickPrevBind(e); + return false; + } + } + }; + + /** + * Initializes touch events + */ + var initTouch = function() { + // initialize object to contain all touch values + slider.touch = { + start: {x: 0, y: 0}, + end: {x: 0, y: 0} + }; + slider.viewport.bind('touchstart MSPointerDown pointerdown', onTouchStart); + + //for browsers that have implemented pointer events and fire a click after + //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not + slider.viewport.on('click', '.bxslider a', function(e) { + if (slider.viewport.hasClass('click-disabled')) { + e.preventDefault(); + slider.viewport.removeClass('click-disabled'); + } + }); + }; + + /** + * Event handler for "touchstart" + * + * @param e (event) + * - DOM event object + */ + var onTouchStart = function(e) { + //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls + slider.controls.el.addClass('disabled'); + + if (slider.working) { + e.preventDefault(); + slider.controls.el.removeClass('disabled'); + } else { + // record the original position when touch starts + slider.touch.originalPos = el.position(); + var orig = e.originalEvent, + touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig]; + // record the starting touch x, y coordinates + slider.touch.start.x = touchPoints[0].pageX; + slider.touch.start.y = touchPoints[0].pageY; + + if (slider.viewport.get(0).setPointerCapture) { + slider.pointerId = orig.pointerId; + slider.viewport.get(0).setPointerCapture(slider.pointerId); + } + // bind a "touchmove" event to the viewport + slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove); + // bind a "touchend" event to the viewport + slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd); + slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel); + } + }; + + /** + * Cancel Pointer for Windows Phone + * + * @param e (event) + * - DOM event object + */ + var onPointerCancel = function(e) { + /* onPointerCancel handler is needed to deal with situations when a touchend + doesn't fire after a touchstart (this happens on windows phones only) */ + setPositionProperty(slider.touch.originalPos.left, 'reset', 0); + + //remove handlers + slider.controls.el.removeClass('disabled'); + slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel); + slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove); + slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd); + if (slider.viewport.get(0).releasePointerCapture) { + slider.viewport.get(0).releasePointerCapture(slider.pointerId); + } + }; + + /** + * Event handler for "touchmove" + * + * @param e (event) + * - DOM event object + */ + var onTouchMove = function(e) { + var orig = e.originalEvent, + touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], + // if scrolling on y axis, do not prevent default + xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x), + yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y), + value = 0, + change = 0; + + // x axis swipe + if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) { + e.preventDefault(); + // y axis swipe + } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) { + e.preventDefault(); + } + if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) { + // if horizontal, drag along x axis + if (slider.settings.mode === 'horizontal') { + change = touchPoints[0].pageX - slider.touch.start.x; + value = slider.touch.originalPos.left + change; + // if vertical, drag along y axis + } else { + change = touchPoints[0].pageY - slider.touch.start.y; + value = slider.touch.originalPos.top + change; + } + setPositionProperty(value, 'reset', 0); + } + }; + + /** + * Event handler for "touchend" + * + * @param e (event) + * - DOM event object + */ + var onTouchEnd = function(e) { + slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove); + //enable slider controls as soon as user stops interacing with slides + slider.controls.el.removeClass('disabled'); + var orig = e.originalEvent, + touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig], + value = 0, + distance = 0; + // record end x, y positions + slider.touch.end.x = touchPoints[0].pageX; + slider.touch.end.y = touchPoints[0].pageY; + // if fade mode, check if absolute x distance clears the threshold + if (slider.settings.mode === 'fade') { + distance = Math.abs(slider.touch.start.x - slider.touch.end.x); + if (distance >= slider.settings.swipeThreshold) { + if (slider.touch.start.x > slider.touch.end.x) { + el.goToNextSlide(); + } else { + el.goToPrevSlide(); + } + el.stopAuto(); + } + // not fade mode + } else { + // calculate distance and el's animate property + if (slider.settings.mode === 'horizontal') { + distance = slider.touch.end.x - slider.touch.start.x; + value = slider.touch.originalPos.left; + } else { + distance = slider.touch.end.y - slider.touch.start.y; + value = slider.touch.originalPos.top; + } + // if not infinite loop and first / last slide, do not attempt a slide transition + if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) { + setPositionProperty(value, 'reset', 200); + } else { + // check if distance clears threshold + if (Math.abs(distance) >= slider.settings.swipeThreshold) { + if (distance < 0) { + el.goToNextSlide(); + } else { + el.goToPrevSlide(); + } + el.stopAuto(); + } else { + // el.animate(property, 200); + setPositionProperty(value, 'reset', 200); + } + } + } + slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd); + if (slider.viewport.get(0).releasePointerCapture) { + slider.viewport.get(0).releasePointerCapture(slider.pointerId); + } + }; + + /** + * Window resize event callback + */ + var resizeWindow = function(e) { + // don't do anything if slider isn't initialized. + if (!slider.initialized) { return; } + // Delay if slider working. + if (slider.working) { + window.setTimeout(resizeWindow, 10); + } else { + // get the new window dimens (again, thank you IE) + var windowWidthNew = $(window).width(), + windowHeightNew = $(window).height(); + // make sure that it is a true window resize + // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements + // are resized. Can you just die already?* + if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) { + // set the new window dimens + windowWidth = windowWidthNew; + windowHeight = windowHeightNew; + // update all dynamic elements + el.redrawSlider(); + // Call user resize handler + slider.settings.onSliderResize.call(el, slider.active.index); + } + } + }; + + /** + * Adds an aria-hidden=true attribute to each element + * + * @param startVisibleIndex (int) + * - the first visible element's index + */ + var applyAriaHiddenAttributes = function(startVisibleIndex) { + var numberOfSlidesShowing = getNumberSlidesShowing(); + // only apply attributes if the setting is enabled and not in ticker mode + if (slider.settings.ariaHidden && !slider.settings.ticker) { + // add aria-hidden=true to all elements + slider.children.attr('aria-hidden', 'true'); + // get the visible elements and change to aria-hidden=false + slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false'); + } + }; + + /** + * Returns index according to present page range + * + * @param slideOndex (int) + * - the desired slide index + */ + var setSlideIndex = function(slideIndex) { + if (slideIndex < 0) { + if (slider.settings.infiniteLoop) { + return getPagerQty() - 1; + }else { + //we don't go to undefined slides + return slider.active.index; + } + // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop) + } else if (slideIndex >= getPagerQty()) { + if (slider.settings.infiniteLoop) { + return 0; + } else { + //we don't move to undefined pages + return slider.active.index; + } + // set active index to requested slide + } else { + return slideIndex; + } + }; + + /** + * =================================================================================== + * = PUBLIC FUNCTIONS + * =================================================================================== + */ + + /** + * Performs slide transition to the specified slide + * + * @param slideIndex (int) + * - the destination slide's index (zero-based) + * + * @param direction (string) + * - INTERNAL USE ONLY - the direction of travel ("prev" / "next") + */ + el.goToSlide = function(slideIndex, direction) { + // onSlideBefore, onSlideNext, onSlidePrev callbacks + // Allow transition canceling based on returned value + var performTransition = true, + moveBy = 0, + position = {left: 0, top: 0}, + lastChild = null, + lastShowingIndex, eq, value, requestEl; + // store the old index + slider.oldIndex = slider.active.index; + //set new index + slider.active.index = setSlideIndex(slideIndex); + + // if plugin is currently in motion, ignore request + if (slider.working || slider.active.index === slider.oldIndex) { return; } + // declare that plugin is in motion + slider.working = true; + + performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); + + // If transitions canceled, reset and return + if (typeof (performTransition) !== 'undefined' && !performTransition) { + slider.active.index = slider.oldIndex; // restore old index + slider.working = false; // is not in motion + return; + } + + if (direction === 'next') { + // Prevent canceling in future functions or lack there-of from negating previous commands to cancel + if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { + performTransition = false; + } + } else if (direction === 'prev') { + // Prevent canceling in future functions or lack there-of from negating previous commands to cancel + if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) { + performTransition = false; + } + } + + // check if last slide + slider.active.last = slider.active.index >= getPagerQty() - 1; + // update the pager with active class + if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); } + // // check for direction control update + if (slider.settings.controls) { updateDirectionControls(); } + // if slider is set to mode: "fade" + if (slider.settings.mode === 'fade') { + // if adaptiveHeight is true and next height is different from current height, animate to the new height + if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { + slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); + } + // fade out the visible child and reset its z-index value + slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0}); + // fade in the newly requested slide + slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() { + $(this).css('zIndex', slider.settings.slideZIndex); + updateAfterSlideTransition(); + }); + // slider mode is not "fade" + } else { + // if adaptiveHeight is true and next height is different from current height, animate to the new height + if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) { + slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); + } + // if carousel and not infinite loop + if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) { + if (slider.settings.mode === 'horizontal') { + // get the last child position + lastChild = slider.children.eq(slider.children.length - 1); + position = lastChild.position(); + // calculate the position of the last slide + moveBy = slider.viewport.width() - lastChild.outerWidth(); + } else { + // get last showing index position + lastShowingIndex = slider.children.length - slider.settings.minSlides; + position = slider.children.eq(lastShowingIndex).position(); + } + // horizontal carousel, going previous while on first slide (infiniteLoop mode) + } else if (slider.carousel && slider.active.last && direction === 'prev') { + // get the last child position + eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides); + lastChild = el.children('.bx-clone').eq(eq); + position = lastChild.position(); + // if infinite loop and "Next" is clicked on the last slide + } else if (direction === 'next' && slider.active.index === 0) { + // get the last clone position + position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position(); + slider.active.last = false; + // normal non-zero requests + } else if (slideIndex >= 0) { + //parseInt is applied to allow floats for slides/page + requestEl = slideIndex * parseInt(getMoveBy()); + position = slider.children.eq(requestEl).position(); + } + + /* If the position doesn't exist + * (e.g. if you destroy the slider on a next click), + * it doesn't throw an error. + */ + if (typeof (position) !== 'undefined') { + value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top; + // plugin values to be animated + setPositionProperty(value, 'slide', slider.settings.speed); + } else { + slider.working = false; + } + } + if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } + }; + + /** + * Transitions to the next slide in the show + */ + el.goToNextSlide = function() { + // if infiniteLoop is false and last page is showing, disregard call + if (!slider.settings.infiniteLoop && slider.active.last) { return; } + var pagerIndex = parseInt(slider.active.index) + 1; + el.goToSlide(pagerIndex, 'next'); + }; + + /** + * Transitions to the prev slide in the show + */ + el.goToPrevSlide = function() { + // if infiniteLoop is false and last page is showing, disregard call + if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; } + var pagerIndex = parseInt(slider.active.index) - 1; + el.goToSlide(pagerIndex, 'prev'); + }; + + /** + * Starts the auto show + * + * @param preventControlUpdate (boolean) + * - if true, auto controls state will not be updated + */ + el.startAuto = function(preventControlUpdate) { + // if an interval already exists, disregard call + if (slider.interval) { return; } + // create an interval + slider.interval = setInterval(function() { + if (slider.settings.autoDirection === 'next') { + el.goToNextSlide(); + } else { + el.goToPrevSlide(); + } + }, slider.settings.pause); + // if auto controls are displayed and preventControlUpdate is not true + if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); } + }; + + /** + * Stops the auto show + * + * @param preventControlUpdate (boolean) + * - if true, auto controls state will not be updated + */ + el.stopAuto = function(preventControlUpdate) { + // if no interval exists, disregard call + if (!slider.interval) { return; } + // clear the interval + clearInterval(slider.interval); + slider.interval = null; + // if auto controls are displayed and preventControlUpdate is not true + if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); } + }; + + /** + * Returns current slide index (zero-based) + */ + el.getCurrentSlide = function() { + return slider.active.index; + }; + + /** + * Returns current slide element + */ + el.getCurrentSlideElement = function() { + return slider.children.eq(slider.active.index); + }; + + /** + * Returns a slide element + * @param index (int) + * - The index (zero-based) of the element you want returned. + */ + el.getSlideElement = function(index) { + return slider.children.eq(index); + }; + + /** + * Returns number of slides in show + */ + el.getSlideCount = function() { + return slider.children.length; + }; + + /** + * Return slider.working variable + */ + el.isWorking = function() { + return slider.working; + }; + + /** + * Update all dynamic slider elements + */ + el.redrawSlider = function() { + // resize all children in ratio to new screen size + slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth()); + // adjust the height + slider.viewport.css('height', getViewportHeight()); + // update the slide position + if (!slider.settings.ticker) { setSlidePosition(); } + // if active.last was true before the screen resize, we want + // to keep it last no matter what screen size we end on + if (slider.active.last) { slider.active.index = getPagerQty() - 1; } + // if the active index (page) no longer exists due to the resize, simply set the index as last + if (slider.active.index >= getPagerQty()) { slider.active.last = true; } + // if a pager is being displayed and a custom pager is not being used, update it + if (slider.settings.pager && !slider.settings.pagerCustom) { + populatePager(); + updatePagerActive(slider.active.index); + } + if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); } + }; + + /** + * Destroy the current instance of the slider (revert everything back to original state) + */ + el.destroySlider = function() { + // don't do anything if slider has already been destroyed + if (!slider.initialized) { return; } + slider.initialized = false; + $('.bx-clone', this).remove(); + slider.children.each(function() { + if ($(this).data('origStyle') !== undefined) { + $(this).attr('style', $(this).data('origStyle')); + } else { + $(this).removeAttr('style'); + } + }); + if ($(this).data('origStyle') !== undefined) { + this.attr('style', $(this).data('origStyle')); + } else { + $(this).removeAttr('style'); + } + $(this).unwrap().unwrap(); + if (slider.controls.el) { slider.controls.el.remove(); } + if (slider.controls.next) { slider.controls.next.remove(); } + if (slider.controls.prev) { slider.controls.prev.remove(); } + if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); } + $('.bx-caption', this).remove(); + if (slider.controls.autoEl) { slider.controls.autoEl.remove(); } + clearInterval(slider.interval); + if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); } + if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); } + //remove self reference in data + $(this).removeData('bxSlider'); + }; + + /** + * Reload the slider (revert all DOM changes, and re-initialize) + */ + el.reloadSlider = function(settings) { + if (settings !== undefined) { options = settings; } + el.destroySlider(); + init(); + //store reference to self in order to access public functions later + $(el).data('bxSlider', this); + }; + + init(); + + $(el).data('bxSlider', this); + + // returns the current jQuery object + return this; + }; + +})(jQuery); diff --git a/assets/bxSlider/jquery.bxslider.min.css b/assets/bxSlider/jquery.bxslider.min.css new file mode 100644 index 0000000..a91cb96 --- /dev/null +++ b/assets/bxSlider/jquery.bxslider.min.css @@ -0,0 +1 @@ +.bx-wrapper{position:relative;margin-bottom:60px;padding:0;-ms-touch-action:pan-y;touch-action:pan-y;-moz-box-shadow:0 0 5px #ccc;-webkit-box-shadow:0 0 5px #ccc;box-shadow:0 0 5px #ccc;border:5px solid #fff;background:#fff}.bx-wrapper img{max-width:100%;display:block}.bxslider{margin:0;padding:0}ul.bxslider{list-style:none}.bx-viewport{-webkit-transform:translatez(0)}.bx-wrapper .bx-controls-auto,.bx-wrapper .bx-pager{position:absolute;bottom:-30px;width:100%}.bx-wrapper .bx-loading{min-height:50px;background:url(images/bx_loader.gif) center center no-repeat #fff;height:100%;width:100%;position:absolute;top:0;left:0;z-index:2000}.bx-wrapper .bx-pager{text-align:center;font-size:.85em;font-family:Arial;font-weight:700;color:#666;padding-top:20px}.bx-wrapper .bx-pager.bx-default-pager a{background:#666;text-indent:-9999px;display:block;width:10px;height:10px;margin:0 5px;outline:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.bx-wrapper .bx-pager.bx-default-pager a.active,.bx-wrapper .bx-pager.bx-default-pager a:focus,.bx-wrapper .bx-pager.bx-default-pager a:hover{background:#000}.bx-wrapper .bx-controls-auto .bx-controls-auto-item,.bx-wrapper .bx-pager-item{display:inline-block;vertical-align:bottom}.bx-wrapper .bx-pager-item{font-size:0;line-height:0}.bx-wrapper .bx-prev{left:10px;background:url(images/controls.png) 0 -32px no-repeat}.bx-wrapper .bx-prev:focus,.bx-wrapper .bx-prev:hover{background-position:0 0}.bx-wrapper .bx-next{right:10px;background:url(images/controls.png) -43px -32px no-repeat}.bx-wrapper .bx-next:focus,.bx-wrapper .bx-next:hover{background-position:-43px 0}.bx-wrapper .bx-controls-direction a{position:absolute;top:50%;margin-top:-16px;outline:0;width:32px;height:32px;text-indent:-9999px;z-index:9999}.bx-wrapper .bx-controls-direction a.disabled{display:none}.bx-wrapper .bx-controls-auto{text-align:center}.bx-wrapper .bx-controls-auto .bx-start{display:block;text-indent:-9999px;width:10px;height:11px;outline:0;background:url(images/controls.png) -86px -11px no-repeat;margin:0 3px}.bx-wrapper .bx-controls-auto .bx-start.active,.bx-wrapper .bx-controls-auto .bx-start:focus,.bx-wrapper .bx-controls-auto .bx-start:hover{background-position:-86px 0}.bx-wrapper .bx-controls-auto .bx-stop{display:block;text-indent:-9999px;width:9px;height:11px;outline:0;background:url(images/controls.png) -86px -44px no-repeat;margin:0 3px}.bx-wrapper .bx-controls-auto .bx-stop.active,.bx-wrapper .bx-controls-auto .bx-stop:focus,.bx-wrapper .bx-controls-auto .bx-stop:hover{background-position:-86px -33px}.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager{text-align:left;width:80%}.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto{right:0;width:35px}.bx-wrapper .bx-caption{position:absolute;bottom:0;left:0;background:#666;background:rgba(80,80,80,.75);width:100%}.bx-wrapper .bx-caption span{color:#fff;font-family:Arial;display:block;font-size:.85em;padding:10px} \ No newline at end of file diff --git a/assets/bxSlider/jquery.bxslider.min.js b/assets/bxSlider/jquery.bxslider.min.js new file mode 100644 index 0000000..16e64c0 --- /dev/null +++ b/assets/bxSlider/jquery.bxslider.min.js @@ -0,0 +1,7 @@ +/** + * bxSlider v4.2.12 + * Copyright 2013-2015 Steven Wanderski + * Written while drinking Belgian ales and listening to jazz + * Licensed under MIT (http://opensource.org/licenses/MIT) + */ +!function(t){var e={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,ariaLive:!0,ariaHidden:!0,keyboardEnabled:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",stopAutoOnClick:!1,autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,shrinkItems:!1,onSliderLoad:function(){return!0},onSlideBefore:function(){return!0},onSlideAfter:function(){return!0},onSlideNext:function(){return!0},onSlidePrev:function(){return!0},onSliderResize:function(){return!0}};t.fn.bxSlider=function(n){if(0===this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var s={},o=this,r=t(window).width(),a=t(window).height();if(!t(o).data("bxSlider")){var l=function(){t(o).data("bxSlider")||(s.settings=t.extend({},e,n),s.settings.slideWidth=parseInt(s.settings.slideWidth),s.children=o.children(s.settings.slideSelector),s.children.length1||s.settings.maxSlides>1,s.carousel&&(s.settings.preloadImages="all"),s.minThreshold=s.settings.minSlides*s.settings.slideWidth+(s.settings.minSlides-1)*s.settings.slideMargin,s.maxThreshold=s.settings.maxSlides*s.settings.slideWidth+(s.settings.maxSlides-1)*s.settings.slideMargin,s.working=!1,s.controls={},s.interval=null,s.animProp="vertical"===s.settings.mode?"top":"left",s.usingCSS=s.settings.useCSS&&"fade"!==s.settings.mode&&function(){for(var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"],i=0;i
'),s.viewport=o.parent(),s.settings.ariaLive&&!s.settings.ticker&&s.viewport.attr("aria-live","polite"),s.loader=t('
'),s.viewport.prepend(s.loader),o.css({width:"horizontal"===s.settings.mode?1e3*s.children.length+215+"%":"auto",position:"relative"}),s.usingCSS&&s.settings.easing?o.css("-"+s.cssPrefix+"-transition-timing-function",s.settings.easing):s.settings.easing||(s.settings.easing="swing"),s.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),s.viewport.parent().css({maxWidth:u()}),s.children.css({float:"horizontal"===s.settings.mode?"left":"none",listStyle:"none",position:"relative"}),s.children.css("width",h()),"horizontal"===s.settings.mode&&s.settings.slideMargin>0&&s.children.css("marginRight",s.settings.slideMargin),"vertical"===s.settings.mode&&s.settings.slideMargin>0&&s.children.css("marginBottom",s.settings.slideMargin),"fade"===s.settings.mode&&(s.children.css({position:"absolute",zIndex:0,display:"none"}),s.children.eq(s.settings.startSlide).css({zIndex:s.settings.slideZIndex,display:"block"})),s.controls.el=t('
'),s.settings.captions&&P(),s.active.last=s.settings.startSlide===f()-1,s.settings.video&&o.fitVids(),("all"===s.settings.preloadImages||s.settings.ticker)&&(e=s.children),s.settings.ticker?s.settings.pager=!1:(s.settings.controls&&C(),s.settings.auto&&s.settings.autoControls&&T(),s.settings.pager&&w(),(s.settings.controls||s.settings.autoControls||s.settings.pager)&&s.viewport.after(s.controls.el)),c(e,g)},c=function(e,i){var n=e.find('img:not([src=""]), iframe').length,s=0;return 0===n?void i():void e.find('img:not([src=""]), iframe').each(function(){t(this).one("load error",function(){++s===n&&i()}).each(function(){this.complete&&t(this).trigger("load")})})},g=function(){if(s.settings.infiniteLoop&&"fade"!==s.settings.mode&&!s.settings.ticker){var e="vertical"===s.settings.mode?s.settings.minSlides:s.settings.maxSlides,i=s.children.slice(0,e).clone(!0).addClass("bx-clone"),n=s.children.slice(-e).clone(!0).addClass("bx-clone");s.settings.ariaHidden&&(i.attr("aria-hidden",!0),n.attr("aria-hidden",!0)),o.append(i).prepend(n)}s.loader.remove(),m(),"vertical"===s.settings.mode&&(s.settings.adaptiveHeight=!0),s.viewport.height(p()),o.redrawSlider(),s.settings.onSliderLoad.call(o,s.active.index),s.initialized=!0,s.settings.responsive&&t(window).bind("resize",Z),s.settings.auto&&s.settings.autoStart&&(f()>1||s.settings.autoSlideForOnePage)&&H(),s.settings.ticker&&W(),s.settings.pager&&I(s.settings.startSlide),s.settings.controls&&D(),s.settings.touchEnabled&&!s.settings.ticker&&N(),s.settings.keyboardEnabled&&!s.settings.ticker&&t(document).keydown(F)},p=function(){var e=0,n=t();if("vertical"===s.settings.mode||s.settings.adaptiveHeight)if(s.carousel){var o=1===s.settings.moveSlides?s.active.index:s.active.index*x();for(n=s.children.eq(o),i=1;i<=s.settings.maxSlides-1;i++)n=o+i>=s.children.length?n.add(s.children.eq(i-1)):n.add(s.children.eq(o+i))}else n=s.children.eq(s.active.index);else n=s.children;return"vertical"===s.settings.mode?(n.each(function(i){e+=t(this).outerHeight()}),s.settings.slideMargin>0&&(e+=s.settings.slideMargin*(s.settings.minSlides-1))):e=Math.max.apply(Math,n.map(function(){return t(this).outerHeight(!1)}).get()),"border-box"===s.viewport.css("box-sizing")?e+=parseFloat(s.viewport.css("padding-top"))+parseFloat(s.viewport.css("padding-bottom"))+parseFloat(s.viewport.css("border-top-width"))+parseFloat(s.viewport.css("border-bottom-width")):"padding-box"===s.viewport.css("box-sizing")&&(e+=parseFloat(s.viewport.css("padding-top"))+parseFloat(s.viewport.css("padding-bottom"))),e},u=function(){var t="100%";return s.settings.slideWidth>0&&(t="horizontal"===s.settings.mode?s.settings.maxSlides*s.settings.slideWidth+(s.settings.maxSlides-1)*s.settings.slideMargin:s.settings.slideWidth),t},h=function(){var t=s.settings.slideWidth,e=s.viewport.width();if(0===s.settings.slideWidth||s.settings.slideWidth>e&&!s.carousel||"vertical"===s.settings.mode)t=e;else if(s.settings.maxSlides>1&&"horizontal"===s.settings.mode){if(e>s.maxThreshold)return t;e0?s.viewport.width()s.maxThreshold?t=s.settings.maxSlides:(e=s.children.first().width()+s.settings.slideMargin,t=Math.floor((s.viewport.width()+s.settings.slideMargin)/e)):"vertical"===s.settings.mode&&(t=s.settings.minSlides),t},f=function(){var t=0,e=0,i=0;if(s.settings.moveSlides>0)if(s.settings.infiniteLoop)t=Math.ceil(s.children.length/x());else for(;e0&&s.settings.moveSlides<=v()?s.settings.moveSlides:v()},m=function(){var t,e,i;s.children.length>s.settings.maxSlides&&s.active.last&&!s.settings.infiniteLoop?"horizontal"===s.settings.mode?(e=s.children.last(),t=e.position(),S(-(t.left-(s.viewport.width()-e.outerWidth())),"reset",0)):"vertical"===s.settings.mode&&(i=s.children.length-s.settings.minSlides,t=s.children.eq(i).position(),S(-t.top,"reset",0)):(t=s.children.eq(s.active.index*x()).position(),s.active.index===f()-1&&(s.active.last=!0),void 0!==t&&("horizontal"===s.settings.mode?S(-t.left,"reset",0):"vertical"===s.settings.mode&&S(-t.top,"reset",0)))},S=function(e,i,n,r){var a,l;s.usingCSS?(l="vertical"===s.settings.mode?"translate3d(0, "+e+"px, 0)":"translate3d("+e+"px, 0, 0)",o.css("-"+s.cssPrefix+"-transition-duration",n/1e3+"s"),"slide"===i?(o.css(s.animProp,l),0!==n?o.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(e){t(e.target).is(o)&&(o.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),q())}):q()):"reset"===i?o.css(s.animProp,l):"ticker"===i&&(o.css("-"+s.cssPrefix+"-transition-timing-function","linear"),o.css(s.animProp,l),0!==n?o.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(e){t(e.target).is(o)&&(o.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),S(r.resetValue,"reset",0),L())}):(S(r.resetValue,"reset",0),L()))):(a={},a[s.animProp]=e,"slide"===i?o.animate(a,n,s.settings.easing,function(){q()}):"reset"===i?o.css(s.animProp,e):"ticker"===i&&o.animate(a,n,"linear",function(){S(r.resetValue,"reset",0),L()}))},b=function(){for(var e="",i="",n=f(),o=0;o'+i+"
";s.pagerEl.html(e)},w=function(){s.settings.pagerCustom?s.pagerEl=t(s.settings.pagerCustom):(s.pagerEl=t('
'),s.settings.pagerSelector?t(s.settings.pagerSelector).html(s.pagerEl):s.controls.el.addClass("bx-has-pager").append(s.pagerEl),b()),s.pagerEl.on("click touchend","a",z)},C=function(){s.controls.next=t(''+s.settings.nextText+""),s.controls.prev=t(''+s.settings.prevText+""),s.controls.next.bind("click touchend",E),s.controls.prev.bind("click touchend",k),s.settings.nextSelector&&t(s.settings.nextSelector).append(s.controls.next),s.settings.prevSelector&&t(s.settings.prevSelector).append(s.controls.prev),s.settings.nextSelector||s.settings.prevSelector||(s.controls.directionEl=t('
'),s.controls.directionEl.append(s.controls.prev).append(s.controls.next),s.controls.el.addClass("bx-has-controls-direction").append(s.controls.directionEl))},T=function(){s.controls.start=t('"),s.controls.stop=t('"),s.controls.autoEl=t('
'),s.controls.autoEl.on("click",".bx-start",M),s.controls.autoEl.on("click",".bx-stop",y),s.settings.autoControlsCombine?s.controls.autoEl.append(s.controls.start):s.controls.autoEl.append(s.controls.start).append(s.controls.stop),s.settings.autoControlsSelector?t(s.settings.autoControlsSelector).html(s.controls.autoEl):s.controls.el.addClass("bx-has-controls-auto").append(s.controls.autoEl),A(s.settings.autoStart?"stop":"start")},P=function(){s.children.each(function(e){var i=t(this).find("img:first").attr("title");void 0!==i&&(""+i).length&&t(this).append('
'+i+"
")})},E=function(t){t.preventDefault(),s.controls.el.hasClass("disabled")||(s.settings.auto&&s.settings.stopAutoOnClick&&o.stopAuto(),o.goToNextSlide())},k=function(t){t.preventDefault(),s.controls.el.hasClass("disabled")||(s.settings.auto&&s.settings.stopAutoOnClick&&o.stopAuto(),o.goToPrevSlide())},M=function(t){o.startAuto(),t.preventDefault()},y=function(t){o.stopAuto(),t.preventDefault()},z=function(e){var i,n;e.preventDefault(),s.controls.el.hasClass("disabled")||(s.settings.auto&&s.settings.stopAutoOnClick&&o.stopAuto(),i=t(e.currentTarget),void 0!==i.attr("data-slide-index")&&(n=parseInt(i.attr("data-slide-index")),n!==s.active.index&&o.goToSlide(n)))},I=function(e){var i=s.children.length;return"short"===s.settings.pagerType?(s.settings.maxSlides>1&&(i=Math.ceil(s.children.length/s.settings.maxSlides)),void s.pagerEl.html(e+1+s.settings.pagerShortSeparator+i)):(s.pagerEl.find("a").removeClass("active"),void s.pagerEl.each(function(i,n){t(n).find("a").eq(e).addClass("active")}))},q=function(){if(s.settings.infiniteLoop){var t="";0===s.active.index?t=s.children.eq(0).position():s.active.index===f()-1&&s.carousel?t=s.children.eq((f()-1)*x()).position():s.active.index===s.children.length-1&&(t=s.children.eq(s.children.length-1).position()),t&&("horizontal"===s.settings.mode?S(-t.left,"reset",0):"vertical"===s.settings.mode&&S(-t.top,"reset",0))}s.working=!1,s.settings.onSlideAfter.call(o,s.children.eq(s.active.index),s.oldIndex,s.active.index)},A=function(t){s.settings.autoControlsCombine?s.controls.autoEl.html(s.controls[t]):(s.controls.autoEl.find("a").removeClass("active"),s.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},D=function(){1===f()?(s.controls.prev.addClass("disabled"),s.controls.next.addClass("disabled")):!s.settings.infiniteLoop&&s.settings.hideControlOnEnd&&(0===s.active.index?(s.controls.prev.addClass("disabled"),s.controls.next.removeClass("disabled")):s.active.index===f()-1?(s.controls.next.addClass("disabled"),s.controls.prev.removeClass("disabled")):(s.controls.prev.removeClass("disabled"),s.controls.next.removeClass("disabled")))},H=function(){if(s.settings.autoDelay>0){setTimeout(o.startAuto,s.settings.autoDelay)}else o.startAuto(),t(window).focus(function(){o.startAuto()}).blur(function(){o.stopAuto()});s.settings.autoHover&&o.hover(function(){s.interval&&(o.stopAuto(!0),s.autoPaused=!0)},function(){s.autoPaused&&(o.startAuto(!0),s.autoPaused=null)})},W=function(){var e,i,n,r,a,l,d,c,g=0;"next"===s.settings.autoDirection?o.append(s.children.clone().addClass("bx-clone")):(o.prepend(s.children.clone().addClass("bx-clone")),e=s.children.first().position(),g="horizontal"===s.settings.mode?-e.left:-e.top),S(g,"reset",0),s.settings.pager=!1,s.settings.controls=!1,s.settings.autoControls=!1,s.settings.tickerHover&&(s.usingCSS?(r="horizontal"===s.settings.mode?4:5,s.viewport.hover(function(){i=o.css("-"+s.cssPrefix+"-transform"),n=parseFloat(i.split(",")[r]),S(n,"reset",0)},function(){c=0,s.children.each(function(e){c+="horizontal"===s.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)}),a=s.settings.speed/c,l="horizontal"===s.settings.mode?"left":"top",d=a*(c-Math.abs(parseInt(n))),L(d)})):s.viewport.hover(function(){o.stop()},function(){c=0,s.children.each(function(e){c+="horizontal"===s.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)}),a=s.settings.speed/c,l="horizontal"===s.settings.mode?"left":"top",d=a*(c-Math.abs(parseInt(o.css(l)))),L(d)})),L()},L=function(t){var e,i,n,r=t?t:s.settings.speed,a={left:0,top:0},l={left:0,top:0};"next"===s.settings.autoDirection?a=o.find(".bx-clone").first().position():l=s.children.first().position(),e="horizontal"===s.settings.mode?-a.left:-a.top,i="horizontal"===s.settings.mode?-l.left:-l.top,n={resetValue:i},S(e,"ticker",r,n)},O=function(e){var i=t(window),n={top:i.scrollTop(),left:i.scrollLeft()},s=e.offset();return n.right=n.left+i.width(),n.bottom=n.top+i.height(),s.right=s.left+e.outerWidth(),s.bottom=s.top+e.outerHeight(),!(n.rights.right||n.bottoms.bottom)},F=function(t){var e=document.activeElement.tagName.toLowerCase(),i="input|textarea",n=new RegExp(e,["i"]),s=n.exec(i);if(null==s&&O(o)){if(39===t.keyCode)return E(t),!1;if(37===t.keyCode)return k(t),!1}},N=function(){s.touch={start:{x:0,y:0},end:{x:0,y:0}},s.viewport.bind("touchstart MSPointerDown pointerdown",X),s.viewport.on("click",".bxslider a",function(t){s.viewport.hasClass("click-disabled")&&(t.preventDefault(),s.viewport.removeClass("click-disabled"))})},X=function(t){if(s.controls.el.addClass("disabled"),s.working)t.preventDefault(),s.controls.el.removeClass("disabled");else{s.touch.originalPos=o.position();var e=t.originalEvent,i="undefined"!=typeof e.changedTouches?e.changedTouches:[e];s.touch.start.x=i[0].pageX,s.touch.start.y=i[0].pageY,s.viewport.get(0).setPointerCapture&&(s.pointerId=e.pointerId,s.viewport.get(0).setPointerCapture(s.pointerId)),s.viewport.bind("touchmove MSPointerMove pointermove",V),s.viewport.bind("touchend MSPointerUp pointerup",R),s.viewport.bind("MSPointerCancel pointercancel",Y)}},Y=function(t){S(s.touch.originalPos.left,"reset",0),s.controls.el.removeClass("disabled"),s.viewport.unbind("MSPointerCancel pointercancel",Y),s.viewport.unbind("touchmove MSPointerMove pointermove",V),s.viewport.unbind("touchend MSPointerUp pointerup",R),s.viewport.get(0).releasePointerCapture&&s.viewport.get(0).releasePointerCapture(s.pointerId)},V=function(t){var e=t.originalEvent,i="undefined"!=typeof e.changedTouches?e.changedTouches:[e],n=Math.abs(i[0].pageX-s.touch.start.x),o=Math.abs(i[0].pageY-s.touch.start.y),r=0,a=0;3*n>o&&s.settings.preventDefaultSwipeX?t.preventDefault():3*o>n&&s.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!==s.settings.mode&&s.settings.oneToOneTouch&&("horizontal"===s.settings.mode?(a=i[0].pageX-s.touch.start.x,r=s.touch.originalPos.left+a):(a=i[0].pageY-s.touch.start.y,r=s.touch.originalPos.top+a),S(r,"reset",0))},R=function(t){s.viewport.unbind("touchmove MSPointerMove pointermove",V),s.controls.el.removeClass("disabled");var e=t.originalEvent,i="undefined"!=typeof e.changedTouches?e.changedTouches:[e],n=0,r=0;s.touch.end.x=i[0].pageX,s.touch.end.y=i[0].pageY,"fade"===s.settings.mode?(r=Math.abs(s.touch.start.x-s.touch.end.x),r>=s.settings.swipeThreshold&&(s.touch.start.x>s.touch.end.x?o.goToNextSlide():o.goToPrevSlide(),o.stopAuto())):("horizontal"===s.settings.mode?(r=s.touch.end.x-s.touch.start.x,n=s.touch.originalPos.left):(r=s.touch.end.y-s.touch.start.y,n=s.touch.originalPos.top),!s.settings.infiniteLoop&&(0===s.active.index&&r>0||s.active.last&&r<0)?S(n,"reset",200):Math.abs(r)>=s.settings.swipeThreshold?(r<0?o.goToNextSlide():o.goToPrevSlide(),o.stopAuto()):S(n,"reset",200)),s.viewport.unbind("touchend MSPointerUp pointerup",R),s.viewport.get(0).releasePointerCapture&&s.viewport.get(0).releasePointerCapture(s.pointerId)},Z=function(e){if(s.initialized)if(s.working)window.setTimeout(Z,10);else{var i=t(window).width(),n=t(window).height();r===i&&a===n||(r=i,a=n,o.redrawSlider(),s.settings.onSliderResize.call(o,s.active.index))}},B=function(t){var e=v();s.settings.ariaHidden&&!s.settings.ticker&&(s.children.attr("aria-hidden","true"),s.children.slice(t,t+e).attr("aria-hidden","false"))},U=function(t){return t<0?s.settings.infiniteLoop?f()-1:s.active.index:t>=f()?s.settings.infiniteLoop?0:s.active.index:t};return o.goToSlide=function(e,i){var n,r,a,l,d=!0,c=0,g={left:0,top:0},u=null;if(s.oldIndex=s.active.index,s.active.index=U(e),!s.working&&s.active.index!==s.oldIndex){if(s.working=!0,d=s.settings.onSlideBefore.call(o,s.children.eq(s.active.index),s.oldIndex,s.active.index),"undefined"!=typeof d&&!d)return s.active.index=s.oldIndex,void(s.working=!1);"next"===i?s.settings.onSlideNext.call(o,s.children.eq(s.active.index),s.oldIndex,s.active.index)||(d=!1):"prev"===i&&(s.settings.onSlidePrev.call(o,s.children.eq(s.active.index),s.oldIndex,s.active.index)||(d=!1)),s.active.last=s.active.index>=f()-1,(s.settings.pager||s.settings.pagerCustom)&&I(s.active.index),s.settings.controls&&D(),"fade"===s.settings.mode?(s.settings.adaptiveHeight&&s.viewport.height()!==p()&&s.viewport.animate({height:p()},s.settings.adaptiveHeightSpeed),s.children.filter(":visible").fadeOut(s.settings.speed).css({zIndex:0}),s.children.eq(s.active.index).css("zIndex",s.settings.slideZIndex+1).fadeIn(s.settings.speed,function(){t(this).css("zIndex",s.settings.slideZIndex),q()})):(s.settings.adaptiveHeight&&s.viewport.height()!==p()&&s.viewport.animate({height:p()},s.settings.adaptiveHeightSpeed),!s.settings.infiniteLoop&&s.carousel&&s.active.last?"horizontal"===s.settings.mode?(u=s.children.eq(s.children.length-1),g=u.position(),c=s.viewport.width()-u.outerWidth()):(n=s.children.length-s.settings.minSlides,g=s.children.eq(n).position()):s.carousel&&s.active.last&&"prev"===i?(r=1===s.settings.moveSlides?s.settings.maxSlides-x():(f()-1)*x()-(s.children.length-s.settings.maxSlides),u=o.children(".bx-clone").eq(r),g=u.position()):"next"===i&&0===s.active.index?(g=o.find("> .bx-clone").eq(s.settings.maxSlides).position(),s.active.last=!1):e>=0&&(l=e*parseInt(x()),g=s.children.eq(l).position()),"undefined"!=typeof g?(a="horizontal"===s.settings.mode?-(g.left-c):-g.top,S(a,"slide",s.settings.speed)):s.working=!1),s.settings.ariaHidden&&B(s.active.index*x())}},o.goToNextSlide=function(){if(s.settings.infiniteLoop||!s.active.last){var t=parseInt(s.active.index)+1;o.goToSlide(t,"next")}},o.goToPrevSlide=function(){if(s.settings.infiniteLoop||0!==s.active.index){var t=parseInt(s.active.index)-1;o.goToSlide(t,"prev")}},o.startAuto=function(t){s.interval||(s.interval=setInterval(function(){"next"===s.settings.autoDirection?o.goToNextSlide():o.goToPrevSlide()},s.settings.pause),s.settings.autoControls&&t!==!0&&A("stop"))},o.stopAuto=function(t){s.interval&&(clearInterval(s.interval),s.interval=null,s.settings.autoControls&&t!==!0&&A("start"))},o.getCurrentSlide=function(){return s.active.index},o.getCurrentSlideElement=function(){return s.children.eq(s.active.index)},o.getSlideElement=function(t){return s.children.eq(t)},o.getSlideCount=function(){return s.children.length},o.isWorking=function(){return s.working},o.redrawSlider=function(){s.children.add(o.find(".bx-clone")).outerWidth(h()),s.viewport.css("height",p()),s.settings.ticker||m(),s.active.last&&(s.active.index=f()-1),s.active.index>=f()&&(s.active.last=!0),s.settings.pager&&!s.settings.pagerCustom&&(b(),I(s.active.index)),s.settings.ariaHidden&&B(s.active.index*x())},o.destroySlider=function(){s.initialized&&(s.initialized=!1,t(".bx-clone",this).remove(),s.children.each(function(){void 0!==t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!==t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),s.controls.el&&s.controls.el.remove(),s.controls.next&&s.controls.next.remove(),s.controls.prev&&s.controls.prev.remove(),s.pagerEl&&s.settings.controls&&!s.settings.pagerCustom&&s.pagerEl.remove(),t(".bx-caption",this).remove(),s.controls.autoEl&&s.controls.autoEl.remove(),clearInterval(s.interval),s.settings.responsive&&t(window).unbind("resize",Z),s.settings.keyboardEnabled&&t(document).unbind("keydown",F),t(this).removeData("bxSlider"))},o.reloadSlider=function(e){void 0!==e&&(n=e),o.destroySlider(),l(),t(o).data("bxSlider",this)},l(),t(o).data("bxSlider",this),this}}}(jQuery); \ No newline at end of file diff --git a/assets/bxSlider/vendor/jquery.easing.1.3.js b/assets/bxSlider/vendor/jquery.easing.1.3.js new file mode 100644 index 0000000..ef74321 --- /dev/null +++ b/assets/bxSlider/vendor/jquery.easing.1.3.js @@ -0,0 +1,205 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +jQuery.easing['jswing'] = jQuery.easing['swing']; + +jQuery.extend( jQuery.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert(jQuery.easing.default); + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/assets/bxSlider/vendor/jquery.fitvids.js b/assets/bxSlider/vendor/jquery.fitvids.js new file mode 100644 index 0000000..d464f93 --- /dev/null +++ b/assets/bxSlider/vendor/jquery.fitvids.js @@ -0,0 +1,80 @@ +/*global jQuery */ +/*jshint multistr:true browser:true */ +/*! +* FitVids 1.0 +* +* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com +* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ +* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ +* +* Date: Thu Sept 01 18:00:00 2011 -0500 +*/ + +(function( $ ){ + + "use strict"; + + $.fn.fitVids = function( options ) { + var settings = { + customSelector: null + }; + + var div = document.createElement('div'), + ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; + + div.className = 'fit-vids-style'; + div.innerHTML = '­'; + + ref.parentNode.insertBefore(div,ref); + + if ( options ) { + $.extend( settings, options ); + } + + return this.each(function(){ + var selectors = [ + "iframe[src*='player.vimeo.com']", + "iframe[src*='www.youtube.com']", + "iframe[src*='www.kickstarter.com']", + "object", + "embed" + ]; + + if (settings.customSelector) { + selectors.push(settings.customSelector); + } + + var $allVideos = $(this).find(selectors.join(',')); + + $allVideos.each(function(){ + var $this = $(this); + if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } + var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), + width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), + aspectRatio = height / width; + if(!$this.attr('id')){ + var videoID = 'fitvid' + Math.floor(Math.random()*999999); + $this.attr('id', videoID); + } + $this.wrap('
').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); + $this.removeAttr('height').removeAttr('width'); + }); + }); + }; +})( jQuery ); diff --git a/assets/core/core.js b/assets/core/core.js index fa41c59..5c9dd07 100644 --- a/assets/core/core.js +++ b/assets/core/core.js @@ -80,8 +80,11 @@ kit.config = kit.config || {}; plugin = this.plugins[pluginId] = defaultPlugin; } + /** + * @todo !!! + */ if( - this.__checkState(pluginId, stateList.installed) || + (this.__checkState(pluginId, stateList.installed) && typeof config.loader === 'function') || ( (plugin.stateInit.loading || this.__checkState(pluginId, stateList.loaded)) && typeof config === 'object' ) @@ -96,6 +99,16 @@ kit.config = kit.config || {}; config = plugin.config; config.loader = loader; config.type = 'loader'; + if(this.__checkState(pluginId, stateList.registered)) { + if(this.__checkState(pluginId, stateList.loaded)){ + plugin.stateInit.installing = false; + } + //console.log(`PluginManager.register(${pluginId}): (${plugin.state} > ${stateList.registered})`); + plugin.state = stateList.registered; + if(plugin.config.autoRequire) { + this.require(pluginId); + } + } } if(typeof config === 'object') { @@ -152,6 +165,10 @@ kit.config = kit.config || {}; if(!this.__checkState(pluginId, stateList.registered)) { plugin.state = stateList.registered; plugin.config.onRegister(plugin); + var event = new CustomEvent("onRegister" + plugin.id + "Plugin", { + "detail": {plugin: plugin} + }); + document.dispatchEvent(event); } return true; @@ -227,12 +244,13 @@ kit.config = kit.config || {}; var loadNode = getFileLoadNode(src); if (loadNode) { global.config.debug && console.warn(`Скрипт ${src} уже загружен`); - self.__ready(resolve, [loadNode]); + // self.__ready(resolve, [loadNode]); + resolve(); } else { - script = document.createElement('script'); + var script = document.createElement('script'); script.src = '' + src + '?__pm' + (new Date()).getTime(); - script.onload = () => resolve(script); - script.onerror = () => reject(new Error(`Ошибка загрузки скрипта ${src}`)); + script.onload = function() {resolve(script);}; + script.onerror = function() {reject(new Error(`Ошибка загрузки скрипта ${src}`));}; document.head.append(script); } }).then(resolveCallback, rejectCallback); @@ -260,8 +278,9 @@ kit.config = kit.config || {}; var loadNode = getFileLoadNode(src); if(loadNode){ self.__ready(resolve, [src, true]); + // resolve(src, true); } else { - script = document.createElement('script'); + var script = document.createElement('script'); script.src = '' + src + '?__pm' + (new Date()).getTime(); script.onload = () => checkResolve(src, true); script.onerror = () => checkResolve(src, false); @@ -276,7 +295,8 @@ kit.config = kit.config || {}; var loadNode = getFileLoadNode(src); if(loadNode) { global.config.debug && console.warn(`Стиль ${src} уже загружен`); - self.__ready(resolve, [src]); + // self.__ready(resolve, [src]); + resolve(); } else { var link = document.createElement('link'); link.rel = 'stylesheet'; @@ -322,14 +342,15 @@ kit.config = kit.config || {}; }.bind(this); var setSkipLoadPromise = function (depsPromise) { - var noJsPromise, noImportPromise; + var jsPromiseExists = true, importPromiseExists = true; if(configModule.js.length === 0) { - noJsPromise = true; + jsPromiseExists = false; } if((!configModule.module && configModule.type === 'import') || (configModule.type === 'loader' && typeof configModule.loader === 'function')) { - noImportPromise = true; + importPromiseExists = false; } - plugin.skipLoadPromise = noImportPromise && noJsPromise && !depsPromise; + plugin.skipLoadPromise = !importPromiseExists && !jsPromiseExists && !depsPromise; + return plugin.skipLoadPromise; }.bind(this); @@ -358,6 +379,10 @@ kit.config = kit.config || {}; plugin.state = stateList.loaded; plugin.skipLoadPromise = true; configModule.onLoad.call(plugin.module.exports); + var event = new CustomEvent("onLoad" + plugin.id + "Plugin", { + "detail": {plugin: plugin} + }); + document.dispatchEvent(event); callback(); }.bind(this)); @@ -397,7 +422,7 @@ kit.config = kit.config || {}; } if(plugin.stateInit.installing) { - //console.log('PluginManager.install: plugin ' + pluginId + ' уже устанавливается'); + //console.warn(`PluginManager.install(${pluginId}): уже устанавливается (${plugin.state}).`); this.__exec(pluginId, callback); return this; } @@ -420,20 +445,37 @@ kit.config = kit.config || {}; }.bind(this)) } }.bind(this); + var installed = false; + /** + * @todo !!! + */ if(plugin.config.type === moduleTypeList.loader && typeof plugin.config.loader === 'function') { - var returnData = plugin.config.loader.bind(module.exports).call(module.exports, module, module.exports, this.require.bind(this), global); + // var returnData = plugin.config.loader.bind(module.exports).call(module.exports, module, module.exports, this.require.bind(this), global); + var returnData = plugin.config.loader.bind(window).call(module.exports, module, module.exports, this.require.bind(this), global); setGlobalExtension(pluginId, plugin.config.alias, returnData); - + installed = true; } else if(plugin.config.type === moduleTypeList.import && typeof plugin.config.module === 'string') { setGlobalExtension(pluginId, plugin.config.alias, (typeof module.exports === 'object' && module.exports.default !== undefined)?module.exports.default:module.exports); + installed = true; } - console.log('%cPluginManager.install: plugin ' + pluginId + ' установлен', "color: green;"); - plugin.state = stateList.installed; + if(installed){ + console.log(`%cPluginManager.install(${pluginId}): installed (${plugin.state} > ${stateList.installed}).`, "color: green;"); + plugin.state = stateList.installed; + } + + return installed; }.bind(this); this.__exec(pluginId, function(){ - installer(); - plugin.config.onInstall.call(module.exports, plugin); + if(!this.__checkState(pluginId, stateList.installed)) { + if(installer()){ + plugin.config.onInstall.call(module.exports, plugin); + var event = new CustomEvent("onInstall" + plugin.id + "Plugin", { + "detail": {plugin: plugin} + }); + document.dispatchEvent(event); + } + } callback(); }.bind(this)); @@ -445,6 +487,7 @@ kit.config = kit.config || {}; * @param {string} pluginId * @param {callback} callback * @return {boolean} + * @memberOf {kit} */ __proto.require = function (pluginId, callback) { @@ -536,13 +579,13 @@ kit.config = kit.config || {}; __proto.__exec = function (pluginId, callback, argArr = []) { - var module = this.plugins[pluginId]; + var plugin = this.plugins[pluginId]; var exec = function(_callback, argArr){ - if(module.skipLoadPromise) { + if(plugin.skipLoadPromise) { _callback.apply(this, argArr); } else { - module.promise = module.promise.then(function(){ + plugin.promise = plugin.promise.then(function(){ _callback.apply(this, argArr); }.bind(this)); } @@ -575,9 +618,11 @@ kit.config = kit.config || {}; }; /** + * @param {(string|string[])} deps + * @param {function} callback * @memberOf kit */ - __proto.ready = function(deps, callback) { + __proto.ready = function(deps, callback = undefined) { if(typeof deps === 'function') { callback = deps; deps = []; @@ -657,7 +702,9 @@ kit.config = kit.config || {}; global.ready = manager.ready.bind(manager); global.exec = manager.exec.bind(manager); global.require = manager.require.bind(manager); - /** @type {kit} */ + /** + * @var __pmGlobal__ + */ window.__pmGlobal__ = global; })(kit); diff --git a/assets/core/core.register.js b/assets/core/core.register.js index 5d0f7a9..5c91659 100644 --- a/assets/core/core.register.js +++ b/assets/core/core.register.js @@ -28,11 +28,12 @@ __PluginManager__.registerPlugins({ module: '/support.js', type: 'loader', }, - jQuery: { + jquery: { path: __pmConfig__.assetsPath + '/jquery', module: '/jquery.min.js', type: 'loader', - alias: '$', + alias: ['$', 'jQuery'], + autoRequire: true, }, popper: { path: __pmConfig__.assetsPath + '/popper', @@ -132,7 +133,7 @@ __PluginManager__.registerPlugins({ module: '/toolkit.js', type: 'loader', css: ['/toolkit.css'], - deps: ['jQuery', 'mask'], + deps: ['jQuery', 'mask', 'support'], }, Modal: { path: __pmConfig__.assetsPath + '/modal', @@ -317,7 +318,44 @@ __PluginManager__.registerPlugins({ alias: ['mustache.js'], js: '/mustache.js', deps: [], - } + }, + bxSlider: { + path: __pmConfig__.assetsPath + '/bxSlider', + module: '/jquery.bxslider.min.js', + css: [ + '/jquery.bxslider.min.css', + ], + type: 'import', + deps: ['jQuery'], + }, + selectric: { + path: __pmConfig__.assetsPath + '/selectric', + module: '/jquery.selectric.min.js', + css: [ + '/selectric.css', + ], + type: 'import', + alias: ['jquerySelectric'], + deps: ['jQuery'], + }, + jBox: { + path: __pmConfig__.assetsPath + '/jBox', + module: '/jBox.min.js', + css: [ + '/jBox.min.css', + ], + type: 'import', + deps: ['jQuery'], + }, + intlTelInput: { + path: __pmConfig__.assetsPath + '/intl-tel-input', + module: '/js/intlTelInput.min.js', + css: [ + '/css/intlTelInput.min.css', + ], + type: 'import', + alias: ['intl-tel-input'], + }, }); __pmConfig__.debug && (function(){ diff --git a/assets/intl-tel-input/css/demo.css b/assets/intl-tel-input/css/demo.css new file mode 100644 index 0000000..b2d9053 --- /dev/null +++ b/assets/intl-tel-input/css/demo.css @@ -0,0 +1,51 @@ +* { + box-sizing: border-box; +} + +body { + margin: 20px; + font-size: 14px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #555; +} + +input, +button { + height: 35px; + margin: 0; + padding: 6px 12px; + border-radius: 2px; + font-family: inherit; + font-size: 100%; + color: inherit; +} +input[disabled], +button[disabled] { + background-color: #eee; +} + +input, +select { + border: 1px solid #ccc; + width: 220px; +} + +input::placeholder { + color: #bbb; +} + +button { + color: #fff; + background-color: #428bca; + border: 1px solid #357ebd; + margin-left: 5px; +} +button:hover { + background-color: #3276b1; + border-color: #285e8e; + cursor: pointer; +} + +.notice { + margin-top: 15px; +} \ No newline at end of file diff --git a/assets/intl-tel-input/css/intlTelInput.css b/assets/intl-tel-input/css/intlTelInput.css new file mode 100644 index 0000000..c933ada --- /dev/null +++ b/assets/intl-tel-input/css/intlTelInput.css @@ -0,0 +1,1316 @@ +.iti { + position: relative; + display: inline-block; +} +.iti * { + box-sizing: border-box; +} +.iti__hide { + display: none; +} +.iti__v-hide { + visibility: hidden; +} +.iti input.iti__tel-input, +.iti input.iti__tel-input[type=text], +.iti input.iti__tel-input[type=tel] { + position: relative; + z-index: 0; + margin-top: 0 !important; + margin-bottom: 0 !important; + padding-right: 36px; + margin-right: 0; +} +.iti__flag-container { + position: absolute; + top: 0; + bottom: 0; + right: 0; + padding: 1px; +} +.iti__selected-flag { + z-index: 1; + position: relative; + display: flex; + align-items: center; + height: 100%; + padding: 0 6px 0 8px; +} +.iti__arrow { + margin-left: 6px; + width: 0; + height: 0; + border-left: 3px solid transparent; + border-right: 3px solid transparent; + border-top: 4px solid #555; +} +[dir=rtl] .iti__arrow { + margin-right: 6px; + margin-left: 0; +} +.iti__arrow--up { + border-top: none; + border-bottom: 4px solid #555; +} +.iti__dropdown-content { + border-radius: 3px; + background-color: white; +} +.iti--inline-dropdown .iti__dropdown-content { + position: absolute; + z-index: 2; + margin-top: 3px; + margin-left: -1px; + border: 1px solid #ccc; + box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); +} +.iti__dropdown-content--dropup { + bottom: 100%; + margin-bottom: 3px; +} +.iti__search-input { + width: 100%; + border-width: 0; + border-radius: 3px; + padding: 9px 12px; +} +.iti__search-input + .iti__country-list { + border-top: 1px solid #ccc; +} +.iti__country-list { + list-style: none; + padding: 0; + margin: 0; + overflow-y: scroll; + -webkit-overflow-scrolling: touch; +} +.iti--inline-dropdown .iti__country-list { + max-height: 185px; +} +.iti--flexible-dropdown-width .iti__country-list { + white-space: nowrap; +} +@media (max-width: 500px) { + .iti--flexible-dropdown-width .iti__country-list { + white-space: normal; + } +} +.iti__flag-box { + display: inline-block; + width: 20px; +} +.iti__divider { + padding-bottom: 5px; + margin-bottom: 5px; + border-bottom: 1px solid #ccc; +} +.iti__country { + display: flex; + align-items: center; + padding: 8px 8px; + outline: none; +} +.iti__dial-code { + color: #999; +} +.iti__country.iti__highlight { + background-color: rgba(0, 0, 0, 0.05); +} +.iti__flag-box, .iti__country-name { + margin-right: 8px; +} +[dir=rtl] .iti__flag-box, [dir=rtl] .iti__country-name { + margin-right: 0; + margin-left: 8px; +} +.iti--allow-dropdown input.iti__tel-input, +.iti--allow-dropdown input.iti__tel-input[type=text], +.iti--allow-dropdown input.iti__tel-input[type=tel], .iti--show-selected-dial-code input.iti__tel-input, +.iti--show-selected-dial-code input.iti__tel-input[type=text], +.iti--show-selected-dial-code input.iti__tel-input[type=tel] { + padding-right: 6px; + padding-left: 52px; + margin-left: 0; +} +[dir=rtl] .iti--allow-dropdown input.iti__tel-input, +[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=text], +[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=tel], [dir=rtl] .iti--show-selected-dial-code input.iti__tel-input, +[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=text], +[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=tel] { + padding-right: 52px; + padding-left: 6px; + margin-right: 0; +} +.iti--allow-dropdown .iti__flag-container, .iti--show-selected-dial-code .iti__flag-container { + right: auto; + left: 0; +} +[dir=rtl] .iti--allow-dropdown .iti__flag-container, [dir=rtl] .iti--show-selected-dial-code .iti__flag-container { + right: 0; + left: auto; +} +.iti--allow-dropdown .iti__flag-container:hover { + cursor: pointer; +} +.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag { + background-color: rgba(0, 0, 0, 0.05); +} +.iti--allow-dropdown .iti__flag-container:has(+ input[disabled]):hover, +.iti--allow-dropdown .iti__flag-container:has(+ input[readonly]):hover { + cursor: default; +} +.iti--allow-dropdown .iti__flag-container:has(+ input[disabled]):hover .iti__selected-flag, +.iti--allow-dropdown .iti__flag-container:has(+ input[readonly]):hover .iti__selected-flag { + background-color: transparent; +} +.iti--show-selected-dial-code .iti__selected-flag { + background-color: rgba(0, 0, 0, 0.05); +} +.iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code { + margin-left: 6px; +} +[dir=rtl] .iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code { + margin-left: 0; + margin-right: 6px; +} +.iti--container { + position: fixed; + top: -1000px; + left: -1000px; + z-index: 1060; + padding: 1px; +} +.iti--container:hover { + cursor: pointer; +} + +.iti--fullscreen-popup.iti--container { + background-color: rgba(0, 0, 0, 0.5); + top: 0; + bottom: 0; + left: 0; + right: 0; + position: fixed; + padding: 30px; + display: flex; + flex-direction: column; + justify-content: center; +} +.iti--fullscreen-popup.iti--container.iti--country-search { + justify-content: flex-start; +} +.iti--fullscreen-popup .iti__dropdown-content { + display: flex; + flex-direction: column; + max-height: 100%; + position: relative; +} +.iti--fullscreen-popup .iti__country { + padding: 10px 10px; + line-height: 1.5em; +} + +.iti__flag { + width: 20px; +} +.iti__flag.iti__be { + width: 18px; +} +.iti__flag.iti__ch { + width: 15px; +} +.iti__flag.iti__mc { + width: 19px; +} +.iti__flag.iti__ne { + width: 18px; +} +.iti__flag.iti__np { + width: 13px; +} +.iti__flag.iti__va { + width: 15px; +} +@media (min-resolution: 2x) { + .iti__flag { + background-size: 5762px 15px; + } +} +.iti__flag.iti__ac { + height: 10px; + background-position: 0px 0px; +} +.iti__flag.iti__ad { + height: 14px; + background-position: -22px 0px; +} +.iti__flag.iti__ae { + height: 10px; + background-position: -44px 0px; +} +.iti__flag.iti__af { + height: 14px; + background-position: -66px 0px; +} +.iti__flag.iti__ag { + height: 14px; + background-position: -88px 0px; +} +.iti__flag.iti__ai { + height: 10px; + background-position: -110px 0px; +} +.iti__flag.iti__al { + height: 15px; + background-position: -132px 0px; +} +.iti__flag.iti__am { + height: 10px; + background-position: -154px 0px; +} +.iti__flag.iti__ao { + height: 14px; + background-position: -176px 0px; +} +.iti__flag.iti__aq { + height: 14px; + background-position: -198px 0px; +} +.iti__flag.iti__ar { + height: 13px; + background-position: -220px 0px; +} +.iti__flag.iti__as { + height: 10px; + background-position: -242px 0px; +} +.iti__flag.iti__at { + height: 14px; + background-position: -264px 0px; +} +.iti__flag.iti__au { + height: 10px; + background-position: -286px 0px; +} +.iti__flag.iti__aw { + height: 14px; + background-position: -308px 0px; +} +.iti__flag.iti__ax { + height: 13px; + background-position: -330px 0px; +} +.iti__flag.iti__az { + height: 10px; + background-position: -352px 0px; +} +.iti__flag.iti__ba { + height: 10px; + background-position: -374px 0px; +} +.iti__flag.iti__bb { + height: 14px; + background-position: -396px 0px; +} +.iti__flag.iti__bd { + height: 12px; + background-position: -418px 0px; +} +.iti__flag.iti__be { + height: 15px; + background-position: -440px 0px; +} +.iti__flag.iti__bf { + height: 14px; + background-position: -460px 0px; +} +.iti__flag.iti__bg { + height: 12px; + background-position: -482px 0px; +} +.iti__flag.iti__bh { + height: 12px; + background-position: -504px 0px; +} +.iti__flag.iti__bi { + height: 12px; + background-position: -526px 0px; +} +.iti__flag.iti__bj { + height: 14px; + background-position: -548px 0px; +} +.iti__flag.iti__bl { + height: 14px; + background-position: -570px 0px; +} +.iti__flag.iti__bm { + height: 10px; + background-position: -592px 0px; +} +.iti__flag.iti__bn { + height: 10px; + background-position: -614px 0px; +} +.iti__flag.iti__bo { + height: 14px; + background-position: -636px 0px; +} +.iti__flag.iti__bq { + height: 14px; + background-position: -658px 0px; +} +.iti__flag.iti__br { + height: 14px; + background-position: -680px 0px; +} +.iti__flag.iti__bs { + height: 10px; + background-position: -702px 0px; +} +.iti__flag.iti__bt { + height: 14px; + background-position: -724px 0px; +} +.iti__flag.iti__bv { + height: 15px; + background-position: -746px 0px; +} +.iti__flag.iti__bw { + height: 14px; + background-position: -768px 0px; +} +.iti__flag.iti__by { + height: 10px; + background-position: -790px 0px; +} +.iti__flag.iti__bz { + height: 12px; + background-position: -812px 0px; +} +.iti__flag.iti__ca { + height: 10px; + background-position: -834px 0px; +} +.iti__flag.iti__cc { + height: 10px; + background-position: -856px 0px; +} +.iti__flag.iti__cd { + height: 15px; + background-position: -878px 0px; +} +.iti__flag.iti__cf { + height: 14px; + background-position: -900px 0px; +} +.iti__flag.iti__cg { + height: 14px; + background-position: -922px 0px; +} +.iti__flag.iti__ch { + height: 15px; + background-position: -944px 0px; +} +.iti__flag.iti__ci { + height: 14px; + background-position: -961px 0px; +} +.iti__flag.iti__ck { + height: 10px; + background-position: -983px 0px; +} +.iti__flag.iti__cl { + height: 14px; + background-position: -1005px 0px; +} +.iti__flag.iti__cm { + height: 14px; + background-position: -1027px 0px; +} +.iti__flag.iti__cn { + height: 14px; + background-position: -1049px 0px; +} +.iti__flag.iti__co { + height: 14px; + background-position: -1071px 0px; +} +.iti__flag.iti__cp { + height: 14px; + background-position: -1093px 0px; +} +.iti__flag.iti__cq { + height: 12px; + background-position: -1115px 0px; +} +.iti__flag.iti__cr { + height: 12px; + background-position: -1137px 0px; +} +.iti__flag.iti__cu { + height: 10px; + background-position: -1159px 0px; +} +.iti__flag.iti__cv { + height: 12px; + background-position: -1181px 0px; +} +.iti__flag.iti__cw { + height: 14px; + background-position: -1203px 0px; +} +.iti__flag.iti__cx { + height: 10px; + background-position: -1225px 0px; +} +.iti__flag.iti__cy { + height: 14px; + background-position: -1247px 0px; +} +.iti__flag.iti__cz { + height: 14px; + background-position: -1269px 0px; +} +.iti__flag.iti__de { + height: 12px; + background-position: -1291px 0px; +} +.iti__flag.iti__dg { + height: 10px; + background-position: -1313px 0px; +} +.iti__flag.iti__dj { + height: 14px; + background-position: -1335px 0px; +} +.iti__flag.iti__dk { + height: 15px; + background-position: -1357px 0px; +} +.iti__flag.iti__dm { + height: 10px; + background-position: -1379px 0px; +} +.iti__flag.iti__do { + height: 14px; + background-position: -1401px 0px; +} +.iti__flag.iti__dz { + height: 14px; + background-position: -1423px 0px; +} +.iti__flag.iti__ea { + height: 14px; + background-position: -1445px 0px; +} +.iti__flag.iti__ec { + height: 14px; + background-position: -1467px 0px; +} +.iti__flag.iti__ee { + height: 13px; + background-position: -1489px 0px; +} +.iti__flag.iti__eg { + height: 14px; + background-position: -1511px 0px; +} +.iti__flag.iti__eh { + height: 10px; + background-position: -1533px 0px; +} +.iti__flag.iti__er { + height: 10px; + background-position: -1555px 0px; +} +.iti__flag.iti__es { + height: 14px; + background-position: -1577px 0px; +} +.iti__flag.iti__et { + height: 10px; + background-position: -1599px 0px; +} +.iti__flag.iti__eu { + height: 14px; + background-position: -1621px 0px; +} +.iti__flag.iti__ez { + height: 14px; + background-position: -1643px 0px; +} +.iti__flag.iti__fi { + height: 12px; + background-position: -1665px 0px; +} +.iti__flag.iti__fj { + height: 10px; + background-position: -1687px 0px; +} +.iti__flag.iti__fk { + height: 10px; + background-position: -1709px 0px; +} +.iti__flag.iti__fm { + height: 11px; + background-position: -1731px 0px; +} +.iti__flag.iti__fo { + height: 15px; + background-position: -1753px 0px; +} +.iti__flag.iti__fr { + height: 14px; + background-position: -1775px 0px; +} +.iti__flag.iti__fx { + height: 14px; + background-position: -1797px 0px; +} +.iti__flag.iti__ga { + height: 15px; + background-position: -1819px 0px; +} +.iti__flag.iti__gb { + height: 10px; + background-position: -1841px 0px; +} +.iti__flag.iti__gd { + height: 12px; + background-position: -1863px 0px; +} +.iti__flag.iti__ge { + height: 14px; + background-position: -1885px 0px; +} +.iti__flag.iti__gf { + height: 14px; + background-position: -1907px 0px; +} +.iti__flag.iti__gg { + height: 14px; + background-position: -1929px 0px; +} +.iti__flag.iti__gh { + height: 14px; + background-position: -1951px 0px; +} +.iti__flag.iti__gi { + height: 10px; + background-position: -1973px 0px; +} +.iti__flag.iti__gl { + height: 14px; + background-position: -1995px 0px; +} +.iti__flag.iti__gm { + height: 14px; + background-position: -2017px 0px; +} +.iti__flag.iti__gn { + height: 14px; + background-position: -2039px 0px; +} +.iti__flag.iti__gp { + height: 14px; + background-position: -2061px 0px; +} +.iti__flag.iti__gq { + height: 14px; + background-position: -2083px 0px; +} +.iti__flag.iti__gr { + height: 14px; + background-position: -2105px 0px; +} +.iti__flag.iti__gs { + height: 10px; + background-position: -2127px 0px; +} +.iti__flag.iti__gt { + height: 13px; + background-position: -2149px 0px; +} +.iti__flag.iti__gu { + height: 11px; + background-position: -2171px 0px; +} +.iti__flag.iti__gw { + height: 10px; + background-position: -2193px 0px; +} +.iti__flag.iti__gy { + height: 12px; + background-position: -2215px 0px; +} +.iti__flag.iti__hk { + height: 14px; + background-position: -2237px 0px; +} +.iti__flag.iti__hm { + height: 10px; + background-position: -2259px 0px; +} +.iti__flag.iti__hn { + height: 10px; + background-position: -2281px 0px; +} +.iti__flag.iti__hr { + height: 10px; + background-position: -2303px 0px; +} +.iti__flag.iti__ht { + height: 12px; + background-position: -2325px 0px; +} +.iti__flag.iti__hu { + height: 10px; + background-position: -2347px 0px; +} +.iti__flag.iti__ic { + height: 14px; + background-position: -2369px 0px; +} +.iti__flag.iti__id { + height: 14px; + background-position: -2391px 0px; +} +.iti__flag.iti__ie { + height: 10px; + background-position: -2413px 0px; +} +.iti__flag.iti__il { + height: 15px; + background-position: -2435px 0px; +} +.iti__flag.iti__im { + height: 10px; + background-position: -2457px 0px; +} +.iti__flag.iti__in { + height: 14px; + background-position: -2479px 0px; +} +.iti__flag.iti__io { + height: 10px; + background-position: -2501px 0px; +} +.iti__flag.iti__iq { + height: 14px; + background-position: -2523px 0px; +} +.iti__flag.iti__ir { + height: 12px; + background-position: -2545px 0px; +} +.iti__flag.iti__is { + height: 15px; + background-position: -2567px 0px; +} +.iti__flag.iti__it { + height: 14px; + background-position: -2589px 0px; +} +.iti__flag.iti__je { + height: 12px; + background-position: -2611px 0px; +} +.iti__flag.iti__jm { + height: 10px; + background-position: -2633px 0px; +} +.iti__flag.iti__jo { + height: 10px; + background-position: -2655px 0px; +} +.iti__flag.iti__jp { + height: 14px; + background-position: -2677px 0px; +} +.iti__flag.iti__ke { + height: 14px; + background-position: -2699px 0px; +} +.iti__flag.iti__kg { + height: 12px; + background-position: -2721px 0px; +} +.iti__flag.iti__kh { + height: 13px; + background-position: -2743px 0px; +} +.iti__flag.iti__ki { + height: 10px; + background-position: -2765px 0px; +} +.iti__flag.iti__km { + height: 12px; + background-position: -2787px 0px; +} +.iti__flag.iti__kn { + height: 14px; + background-position: -2809px 0px; +} +.iti__flag.iti__kp { + height: 10px; + background-position: -2831px 0px; +} +.iti__flag.iti__kr { + height: 14px; + background-position: -2853px 0px; +} +.iti__flag.iti__kw { + height: 10px; + background-position: -2875px 0px; +} +.iti__flag.iti__ky { + height: 10px; + background-position: -2897px 0px; +} +.iti__flag.iti__kz { + height: 10px; + background-position: -2919px 0px; +} +.iti__flag.iti__la { + height: 14px; + background-position: -2941px 0px; +} +.iti__flag.iti__lb { + height: 14px; + background-position: -2963px 0px; +} +.iti__flag.iti__lc { + height: 10px; + background-position: -2985px 0px; +} +.iti__flag.iti__li { + height: 12px; + background-position: -3007px 0px; +} +.iti__flag.iti__lk { + height: 10px; + background-position: -3029px 0px; +} +.iti__flag.iti__lr { + height: 11px; + background-position: -3051px 0px; +} +.iti__flag.iti__ls { + height: 14px; + background-position: -3073px 0px; +} +.iti__flag.iti__lt { + height: 12px; + background-position: -3095px 0px; +} +.iti__flag.iti__lu { + height: 12px; + background-position: -3117px 0px; +} +.iti__flag.iti__lv { + height: 10px; + background-position: -3139px 0px; +} +.iti__flag.iti__ly { + height: 10px; + background-position: -3161px 0px; +} +.iti__flag.iti__ma { + height: 14px; + background-position: -3183px 0px; +} +.iti__flag.iti__mc { + height: 15px; + background-position: -3205px 0px; +} +.iti__flag.iti__md { + height: 10px; + background-position: -3226px 0px; +} +.iti__flag.iti__me { + height: 10px; + background-position: -3248px 0px; +} +.iti__flag.iti__mf { + height: 14px; + background-position: -3270px 0px; +} +.iti__flag.iti__mg { + height: 14px; + background-position: -3292px 0px; +} +.iti__flag.iti__mh { + height: 11px; + background-position: -3314px 0px; +} +.iti__flag.iti__mk { + height: 10px; + background-position: -3336px 0px; +} +.iti__flag.iti__ml { + height: 14px; + background-position: -3358px 0px; +} +.iti__flag.iti__mm { + height: 14px; + background-position: -3380px 0px; +} +.iti__flag.iti__mn { + height: 10px; + background-position: -3402px 0px; +} +.iti__flag.iti__mo { + height: 14px; + background-position: -3424px 0px; +} +.iti__flag.iti__mp { + height: 10px; + background-position: -3446px 0px; +} +.iti__flag.iti__mq { + height: 14px; + background-position: -3468px 0px; +} +.iti__flag.iti__mr { + height: 14px; + background-position: -3490px 0px; +} +.iti__flag.iti__ms { + height: 10px; + background-position: -3512px 0px; +} +.iti__flag.iti__mt { + height: 14px; + background-position: -3534px 0px; +} +.iti__flag.iti__mu { + height: 14px; + background-position: -3556px 0px; +} +.iti__flag.iti__mv { + height: 14px; + background-position: -3578px 0px; +} +.iti__flag.iti__mw { + height: 14px; + background-position: -3600px 0px; +} +.iti__flag.iti__mx { + height: 12px; + background-position: -3622px 0px; +} +.iti__flag.iti__my { + height: 10px; + background-position: -3644px 0px; +} +.iti__flag.iti__mz { + height: 14px; + background-position: -3666px 0px; +} +.iti__flag.iti__na { + height: 14px; + background-position: -3688px 0px; +} +.iti__flag.iti__nc { + height: 10px; + background-position: -3710px 0px; +} +.iti__flag.iti__ne { + height: 15px; + background-position: -3732px 0px; +} +.iti__flag.iti__nf { + height: 10px; + background-position: -3752px 0px; +} +.iti__flag.iti__ng { + height: 10px; + background-position: -3774px 0px; +} +.iti__flag.iti__ni { + height: 12px; + background-position: -3796px 0px; +} +.iti__flag.iti__nl { + height: 14px; + background-position: -3818px 0px; +} +.iti__flag.iti__no { + height: 15px; + background-position: -3840px 0px; +} +.iti__flag.iti__np { + height: 15px; + background-position: -3862px 0px; +} +.iti__flag.iti__nr { + height: 10px; + background-position: -3877px 0px; +} +.iti__flag.iti__nu { + height: 10px; + background-position: -3899px 0px; +} +.iti__flag.iti__nz { + height: 10px; + background-position: -3921px 0px; +} +.iti__flag.iti__om { + height: 10px; + background-position: -3943px 0px; +} +.iti__flag.iti__pa { + height: 14px; + background-position: -3965px 0px; +} +.iti__flag.iti__pe { + height: 14px; + background-position: -3987px 0px; +} +.iti__flag.iti__pf { + height: 14px; + background-position: -4009px 0px; +} +.iti__flag.iti__pg { + height: 15px; + background-position: -4031px 0px; +} +.iti__flag.iti__ph { + height: 10px; + background-position: -4053px 0px; +} +.iti__flag.iti__pk { + height: 14px; + background-position: -4075px 0px; +} +.iti__flag.iti__pl { + height: 13px; + background-position: -4097px 0px; +} +.iti__flag.iti__pm { + height: 14px; + background-position: -4119px 0px; +} +.iti__flag.iti__pn { + height: 10px; + background-position: -4141px 0px; +} +.iti__flag.iti__pr { + height: 14px; + background-position: -4163px 0px; +} +.iti__flag.iti__ps { + height: 10px; + background-position: -4185px 0px; +} +.iti__flag.iti__pt { + height: 14px; + background-position: -4207px 0px; +} +.iti__flag.iti__pw { + height: 13px; + background-position: -4229px 0px; +} +.iti__flag.iti__py { + height: 11px; + background-position: -4251px 0px; +} +.iti__flag.iti__qa { + height: 8px; + background-position: -4273px 0px; +} +.iti__flag.iti__re { + height: 14px; + background-position: -4295px 0px; +} +.iti__flag.iti__ro { + height: 14px; + background-position: -4317px 0px; +} +.iti__flag.iti__rs { + height: 14px; + background-position: -4339px 0px; +} +.iti__flag.iti__ru { + height: 14px; + background-position: -4361px 0px; +} +.iti__flag.iti__rw { + height: 14px; + background-position: -4383px 0px; +} +.iti__flag.iti__sa { + height: 14px; + background-position: -4405px 0px; +} +.iti__flag.iti__sb { + height: 10px; + background-position: -4427px 0px; +} +.iti__flag.iti__sc { + height: 10px; + background-position: -4449px 0px; +} +.iti__flag.iti__sd { + height: 10px; + background-position: -4471px 0px; +} +.iti__flag.iti__se { + height: 13px; + background-position: -4493px 0px; +} +.iti__flag.iti__sg { + height: 14px; + background-position: -4515px 0px; +} +.iti__flag.iti__sh { + height: 10px; + background-position: -4537px 0px; +} +.iti__flag.iti__si { + height: 10px; + background-position: -4559px 0px; +} +.iti__flag.iti__sj { + height: 15px; + background-position: -4581px 0px; +} +.iti__flag.iti__sk { + height: 14px; + background-position: -4603px 0px; +} +.iti__flag.iti__sl { + height: 14px; + background-position: -4625px 0px; +} +.iti__flag.iti__sm { + height: 15px; + background-position: -4647px 0px; +} +.iti__flag.iti__sn { + height: 14px; + background-position: -4669px 0px; +} +.iti__flag.iti__so { + height: 14px; + background-position: -4691px 0px; +} +.iti__flag.iti__sr { + height: 14px; + background-position: -4713px 0px; +} +.iti__flag.iti__ss { + height: 10px; + background-position: -4735px 0px; +} +.iti__flag.iti__st { + height: 10px; + background-position: -4757px 0px; +} +.iti__flag.iti__su { + height: 10px; + background-position: -4779px 0px; +} +.iti__flag.iti__sv { + height: 12px; + background-position: -4801px 0px; +} +.iti__flag.iti__sx { + height: 14px; + background-position: -4823px 0px; +} +.iti__flag.iti__sy { + height: 14px; + background-position: -4845px 0px; +} +.iti__flag.iti__sz { + height: 14px; + background-position: -4867px 0px; +} +.iti__flag.iti__ta { + height: 10px; + background-position: -4889px 0px; +} +.iti__flag.iti__tc { + height: 10px; + background-position: -4911px 0px; +} +.iti__flag.iti__td { + height: 14px; + background-position: -4933px 0px; +} +.iti__flag.iti__tf { + height: 14px; + background-position: -4955px 0px; +} +.iti__flag.iti__tg { + height: 13px; + background-position: -4977px 0px; +} +.iti__flag.iti__th { + height: 14px; + background-position: -4999px 0px; +} +.iti__flag.iti__tj { + height: 10px; + background-position: -5021px 0px; +} +.iti__flag.iti__tk { + height: 10px; + background-position: -5043px 0px; +} +.iti__flag.iti__tl { + height: 10px; + background-position: -5065px 0px; +} +.iti__flag.iti__tm { + height: 14px; + background-position: -5087px 0px; +} +.iti__flag.iti__tn { + height: 14px; + background-position: -5109px 0px; +} +.iti__flag.iti__to { + height: 10px; + background-position: -5131px 0px; +} +.iti__flag.iti__tr { + height: 14px; + background-position: -5153px 0px; +} +.iti__flag.iti__tt { + height: 12px; + background-position: -5175px 0px; +} +.iti__flag.iti__tv { + height: 10px; + background-position: -5197px 0px; +} +.iti__flag.iti__tw { + height: 14px; + background-position: -5219px 0px; +} +.iti__flag.iti__tz { + height: 14px; + background-position: -5241px 0px; +} +.iti__flag.iti__ua { + height: 14px; + background-position: -5263px 0px; +} +.iti__flag.iti__ug { + height: 14px; + background-position: -5285px 0px; +} +.iti__flag.iti__uk { + height: 10px; + background-position: -5307px 0px; +} +.iti__flag.iti__um { + height: 11px; + background-position: -5329px 0px; +} +.iti__flag.iti__un { + height: 14px; + background-position: -5351px 0px; +} +.iti__flag.iti__us { + height: 11px; + background-position: -5373px 0px; +} +.iti__flag.iti__uy { + height: 14px; + background-position: -5395px 0px; +} +.iti__flag.iti__uz { + height: 10px; + background-position: -5417px 0px; +} +.iti__flag.iti__va { + height: 15px; + background-position: -5439px 0px; +} +.iti__flag.iti__vc { + height: 14px; + background-position: -5456px 0px; +} +.iti__flag.iti__ve { + height: 14px; + background-position: -5478px 0px; +} +.iti__flag.iti__vg { + height: 10px; + background-position: -5500px 0px; +} +.iti__flag.iti__vi { + height: 14px; + background-position: -5522px 0px; +} +.iti__flag.iti__vn { + height: 14px; + background-position: -5544px 0px; +} +.iti__flag.iti__vu { + height: 12px; + background-position: -5566px 0px; +} +.iti__flag.iti__wf { + height: 14px; + background-position: -5588px 0px; +} +.iti__flag.iti__ws { + height: 10px; + background-position: -5610px 0px; +} +.iti__flag.iti__xk { + height: 15px; + background-position: -5632px 0px; +} +.iti__flag.iti__ye { + height: 14px; + background-position: -5654px 0px; +} +.iti__flag.iti__yt { + height: 14px; + background-position: -5676px 0px; +} +.iti__flag.iti__za { + height: 14px; + background-position: -5698px 0px; +} +.iti__flag.iti__zm { + height: 14px; + background-position: -5720px 0px; +} +.iti__flag.iti__zw { + height: 10px; + background-position: -5742px 0px; +} + +.iti__flag { + height: 15px; + box-shadow: 0px 0px 1px 0px #888; + background-image: url("../img/flags.png?1"); + background-repeat: no-repeat; + background-position: 20px 0; +} +@media (min-resolution: 2x) { + .iti__flag { + background-image: url("../img/flags@2x.png?1"); + } +} + +.iti__globe { + background-image: url("../img/globe.png"); + background-size: contain; + background-position: right; + box-shadow: none; + height: 19px; +} +@media (min-resolution: 2x) { + .iti__globe { + background-image: url("../img/globe@2x.png"); + } +} \ No newline at end of file diff --git a/assets/intl-tel-input/css/intlTelInput.min.css b/assets/intl-tel-input/css/intlTelInput.min.css new file mode 100644 index 0000000..8888ab0 --- /dev/null +++ b/assets/intl-tel-input/css/intlTelInput.min.css @@ -0,0 +1 @@ +.iti{position:relative;display:inline-block}.iti *{box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input.iti__tel-input,.iti input.iti__tel-input[type=tel],.iti input.iti__tel-input[type=text]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}[dir=rtl] .iti__arrow{margin-right:6px;margin-left:0}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__dropdown-content{border-radius:3px;background-color:#fff}.iti--inline-dropdown .iti__dropdown-content{position:absolute;z-index:2;margin-top:3px;margin-left:-1px;border:1px solid #ccc;box-shadow:1px 1px 4px rgba(0,0,0,.2)}.iti__dropdown-content--dropup{bottom:100%;margin-bottom:3px}.iti__search-input{width:100%;border-width:0;border-radius:3px;padding:9px 12px}.iti__search-input+.iti__country-list{border-top:1px solid #ccc}.iti__country-list{list-style:none;padding:0;margin:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti--inline-dropdown .iti__country-list{max-height:185px}.iti--flexible-dropdown-width .iti__country-list{white-space:nowrap}@media (max-width:500px){.iti--flexible-dropdown-width .iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #ccc}.iti__country{display:flex;align-items:center;padding:8px 8px;outline:0}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:rgba(0,0,0,.05)}.iti__country-name,.iti__flag-box{margin-right:8px}[dir=rtl] .iti__country-name,[dir=rtl] .iti__flag-box{margin-right:0;margin-left:8px}.iti--allow-dropdown input.iti__tel-input,.iti--allow-dropdown input.iti__tel-input[type=tel],.iti--allow-dropdown input.iti__tel-input[type=text],.iti--show-selected-dial-code input.iti__tel-input,.iti--show-selected-dial-code input.iti__tel-input[type=tel],.iti--show-selected-dial-code input.iti__tel-input[type=text]{padding-right:6px;padding-left:52px;margin-left:0}[dir=rtl] .iti--allow-dropdown input.iti__tel-input,[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=tel],[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=text],[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input,[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=tel],[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=text]{padding-right:52px;padding-left:6px;margin-right:0}.iti--allow-dropdown .iti__flag-container,.iti--show-selected-dial-code .iti__flag-container{right:auto;left:0}[dir=rtl] .iti--allow-dropdown .iti__flag-container,[dir=rtl] .iti--show-selected-dial-code .iti__flag-container{right:0;left:auto}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--allow-dropdown .iti__flag-container:has(+input[disabled]):hover,.iti--allow-dropdown .iti__flag-container:has(+input[readonly]):hover{cursor:default}.iti--allow-dropdown .iti__flag-container:has(+input[disabled]):hover .iti__selected-flag,.iti--allow-dropdown .iti__flag-container:has(+input[readonly]):hover .iti__selected-flag{background-color:transparent}.iti--show-selected-dial-code .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:6px}[dir=rtl] .iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:0;margin-right:6px}.iti--container{position:fixed;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti--fullscreen-popup.iti--container{background-color:rgba(0,0,0,.5);top:0;bottom:0;left:0;right:0;position:fixed;padding:30px;display:flex;flex-direction:column;justify-content:center}.iti--fullscreen-popup.iti--container.iti--country-search{justify-content:flex-start}.iti--fullscreen-popup .iti__dropdown-content{display:flex;flex-direction:column;max-height:100%;position:relative}.iti--fullscreen-popup .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (min-resolution:2x){.iti__flag{background-size:5762px 15px}}.iti__flag.iti__ac{height:10px;background-position:0 0}.iti__flag.iti__ad{height:14px;background-position:-22px 0}.iti__flag.iti__ae{height:10px;background-position:-44px 0}.iti__flag.iti__af{height:14px;background-position:-66px 0}.iti__flag.iti__ag{height:14px;background-position:-88px 0}.iti__flag.iti__ai{height:10px;background-position:-110px 0}.iti__flag.iti__al{height:15px;background-position:-132px 0}.iti__flag.iti__am{height:10px;background-position:-154px 0}.iti__flag.iti__ao{height:14px;background-position:-176px 0}.iti__flag.iti__aq{height:14px;background-position:-198px 0}.iti__flag.iti__ar{height:13px;background-position:-220px 0}.iti__flag.iti__as{height:10px;background-position:-242px 0}.iti__flag.iti__at{height:14px;background-position:-264px 0}.iti__flag.iti__au{height:10px;background-position:-286px 0}.iti__flag.iti__aw{height:14px;background-position:-308px 0}.iti__flag.iti__ax{height:13px;background-position:-330px 0}.iti__flag.iti__az{height:10px;background-position:-352px 0}.iti__flag.iti__ba{height:10px;background-position:-374px 0}.iti__flag.iti__bb{height:14px;background-position:-396px 0}.iti__flag.iti__bd{height:12px;background-position:-418px 0}.iti__flag.iti__be{height:15px;background-position:-440px 0}.iti__flag.iti__bf{height:14px;background-position:-460px 0}.iti__flag.iti__bg{height:12px;background-position:-482px 0}.iti__flag.iti__bh{height:12px;background-position:-504px 0}.iti__flag.iti__bi{height:12px;background-position:-526px 0}.iti__flag.iti__bj{height:14px;background-position:-548px 0}.iti__flag.iti__bl{height:14px;background-position:-570px 0}.iti__flag.iti__bm{height:10px;background-position:-592px 0}.iti__flag.iti__bn{height:10px;background-position:-614px 0}.iti__flag.iti__bo{height:14px;background-position:-636px 0}.iti__flag.iti__bq{height:14px;background-position:-658px 0}.iti__flag.iti__br{height:14px;background-position:-680px 0}.iti__flag.iti__bs{height:10px;background-position:-702px 0}.iti__flag.iti__bt{height:14px;background-position:-724px 0}.iti__flag.iti__bv{height:15px;background-position:-746px 0}.iti__flag.iti__bw{height:14px;background-position:-768px 0}.iti__flag.iti__by{height:10px;background-position:-790px 0}.iti__flag.iti__bz{height:12px;background-position:-812px 0}.iti__flag.iti__ca{height:10px;background-position:-834px 0}.iti__flag.iti__cc{height:10px;background-position:-856px 0}.iti__flag.iti__cd{height:15px;background-position:-878px 0}.iti__flag.iti__cf{height:14px;background-position:-900px 0}.iti__flag.iti__cg{height:14px;background-position:-922px 0}.iti__flag.iti__ch{height:15px;background-position:-944px 0}.iti__flag.iti__ci{height:14px;background-position:-961px 0}.iti__flag.iti__ck{height:10px;background-position:-983px 0}.iti__flag.iti__cl{height:14px;background-position:-1005px 0}.iti__flag.iti__cm{height:14px;background-position:-1027px 0}.iti__flag.iti__cn{height:14px;background-position:-1049px 0}.iti__flag.iti__co{height:14px;background-position:-1071px 0}.iti__flag.iti__cp{height:14px;background-position:-1093px 0}.iti__flag.iti__cq{height:12px;background-position:-1115px 0}.iti__flag.iti__cr{height:12px;background-position:-1137px 0}.iti__flag.iti__cu{height:10px;background-position:-1159px 0}.iti__flag.iti__cv{height:12px;background-position:-1181px 0}.iti__flag.iti__cw{height:14px;background-position:-1203px 0}.iti__flag.iti__cx{height:10px;background-position:-1225px 0}.iti__flag.iti__cy{height:14px;background-position:-1247px 0}.iti__flag.iti__cz{height:14px;background-position:-1269px 0}.iti__flag.iti__de{height:12px;background-position:-1291px 0}.iti__flag.iti__dg{height:10px;background-position:-1313px 0}.iti__flag.iti__dj{height:14px;background-position:-1335px 0}.iti__flag.iti__dk{height:15px;background-position:-1357px 0}.iti__flag.iti__dm{height:10px;background-position:-1379px 0}.iti__flag.iti__do{height:14px;background-position:-1401px 0}.iti__flag.iti__dz{height:14px;background-position:-1423px 0}.iti__flag.iti__ea{height:14px;background-position:-1445px 0}.iti__flag.iti__ec{height:14px;background-position:-1467px 0}.iti__flag.iti__ee{height:13px;background-position:-1489px 0}.iti__flag.iti__eg{height:14px;background-position:-1511px 0}.iti__flag.iti__eh{height:10px;background-position:-1533px 0}.iti__flag.iti__er{height:10px;background-position:-1555px 0}.iti__flag.iti__es{height:14px;background-position:-1577px 0}.iti__flag.iti__et{height:10px;background-position:-1599px 0}.iti__flag.iti__eu{height:14px;background-position:-1621px 0}.iti__flag.iti__ez{height:14px;background-position:-1643px 0}.iti__flag.iti__fi{height:12px;background-position:-1665px 0}.iti__flag.iti__fj{height:10px;background-position:-1687px 0}.iti__flag.iti__fk{height:10px;background-position:-1709px 0}.iti__flag.iti__fm{height:11px;background-position:-1731px 0}.iti__flag.iti__fo{height:15px;background-position:-1753px 0}.iti__flag.iti__fr{height:14px;background-position:-1775px 0}.iti__flag.iti__fx{height:14px;background-position:-1797px 0}.iti__flag.iti__ga{height:15px;background-position:-1819px 0}.iti__flag.iti__gb{height:10px;background-position:-1841px 0}.iti__flag.iti__gd{height:12px;background-position:-1863px 0}.iti__flag.iti__ge{height:14px;background-position:-1885px 0}.iti__flag.iti__gf{height:14px;background-position:-1907px 0}.iti__flag.iti__gg{height:14px;background-position:-1929px 0}.iti__flag.iti__gh{height:14px;background-position:-1951px 0}.iti__flag.iti__gi{height:10px;background-position:-1973px 0}.iti__flag.iti__gl{height:14px;background-position:-1995px 0}.iti__flag.iti__gm{height:14px;background-position:-2017px 0}.iti__flag.iti__gn{height:14px;background-position:-2039px 0}.iti__flag.iti__gp{height:14px;background-position:-2061px 0}.iti__flag.iti__gq{height:14px;background-position:-2083px 0}.iti__flag.iti__gr{height:14px;background-position:-2105px 0}.iti__flag.iti__gs{height:10px;background-position:-2127px 0}.iti__flag.iti__gt{height:13px;background-position:-2149px 0}.iti__flag.iti__gu{height:11px;background-position:-2171px 0}.iti__flag.iti__gw{height:10px;background-position:-2193px 0}.iti__flag.iti__gy{height:12px;background-position:-2215px 0}.iti__flag.iti__hk{height:14px;background-position:-2237px 0}.iti__flag.iti__hm{height:10px;background-position:-2259px 0}.iti__flag.iti__hn{height:10px;background-position:-2281px 0}.iti__flag.iti__hr{height:10px;background-position:-2303px 0}.iti__flag.iti__ht{height:12px;background-position:-2325px 0}.iti__flag.iti__hu{height:10px;background-position:-2347px 0}.iti__flag.iti__ic{height:14px;background-position:-2369px 0}.iti__flag.iti__id{height:14px;background-position:-2391px 0}.iti__flag.iti__ie{height:10px;background-position:-2413px 0}.iti__flag.iti__il{height:15px;background-position:-2435px 0}.iti__flag.iti__im{height:10px;background-position:-2457px 0}.iti__flag.iti__in{height:14px;background-position:-2479px 0}.iti__flag.iti__io{height:10px;background-position:-2501px 0}.iti__flag.iti__iq{height:14px;background-position:-2523px 0}.iti__flag.iti__ir{height:12px;background-position:-2545px 0}.iti__flag.iti__is{height:15px;background-position:-2567px 0}.iti__flag.iti__it{height:14px;background-position:-2589px 0}.iti__flag.iti__je{height:12px;background-position:-2611px 0}.iti__flag.iti__jm{height:10px;background-position:-2633px 0}.iti__flag.iti__jo{height:10px;background-position:-2655px 0}.iti__flag.iti__jp{height:14px;background-position:-2677px 0}.iti__flag.iti__ke{height:14px;background-position:-2699px 0}.iti__flag.iti__kg{height:12px;background-position:-2721px 0}.iti__flag.iti__kh{height:13px;background-position:-2743px 0}.iti__flag.iti__ki{height:10px;background-position:-2765px 0}.iti__flag.iti__km{height:12px;background-position:-2787px 0}.iti__flag.iti__kn{height:14px;background-position:-2809px 0}.iti__flag.iti__kp{height:10px;background-position:-2831px 0}.iti__flag.iti__kr{height:14px;background-position:-2853px 0}.iti__flag.iti__kw{height:10px;background-position:-2875px 0}.iti__flag.iti__ky{height:10px;background-position:-2897px 0}.iti__flag.iti__kz{height:10px;background-position:-2919px 0}.iti__flag.iti__la{height:14px;background-position:-2941px 0}.iti__flag.iti__lb{height:14px;background-position:-2963px 0}.iti__flag.iti__lc{height:10px;background-position:-2985px 0}.iti__flag.iti__li{height:12px;background-position:-3007px 0}.iti__flag.iti__lk{height:10px;background-position:-3029px 0}.iti__flag.iti__lr{height:11px;background-position:-3051px 0}.iti__flag.iti__ls{height:14px;background-position:-3073px 0}.iti__flag.iti__lt{height:12px;background-position:-3095px 0}.iti__flag.iti__lu{height:12px;background-position:-3117px 0}.iti__flag.iti__lv{height:10px;background-position:-3139px 0}.iti__flag.iti__ly{height:10px;background-position:-3161px 0}.iti__flag.iti__ma{height:14px;background-position:-3183px 0}.iti__flag.iti__mc{height:15px;background-position:-3205px 0}.iti__flag.iti__md{height:10px;background-position:-3226px 0}.iti__flag.iti__me{height:10px;background-position:-3248px 0}.iti__flag.iti__mf{height:14px;background-position:-3270px 0}.iti__flag.iti__mg{height:14px;background-position:-3292px 0}.iti__flag.iti__mh{height:11px;background-position:-3314px 0}.iti__flag.iti__mk{height:10px;background-position:-3336px 0}.iti__flag.iti__ml{height:14px;background-position:-3358px 0}.iti__flag.iti__mm{height:14px;background-position:-3380px 0}.iti__flag.iti__mn{height:10px;background-position:-3402px 0}.iti__flag.iti__mo{height:14px;background-position:-3424px 0}.iti__flag.iti__mp{height:10px;background-position:-3446px 0}.iti__flag.iti__mq{height:14px;background-position:-3468px 0}.iti__flag.iti__mr{height:14px;background-position:-3490px 0}.iti__flag.iti__ms{height:10px;background-position:-3512px 0}.iti__flag.iti__mt{height:14px;background-position:-3534px 0}.iti__flag.iti__mu{height:14px;background-position:-3556px 0}.iti__flag.iti__mv{height:14px;background-position:-3578px 0}.iti__flag.iti__mw{height:14px;background-position:-3600px 0}.iti__flag.iti__mx{height:12px;background-position:-3622px 0}.iti__flag.iti__my{height:10px;background-position:-3644px 0}.iti__flag.iti__mz{height:14px;background-position:-3666px 0}.iti__flag.iti__na{height:14px;background-position:-3688px 0}.iti__flag.iti__nc{height:10px;background-position:-3710px 0}.iti__flag.iti__ne{height:15px;background-position:-3732px 0}.iti__flag.iti__nf{height:10px;background-position:-3752px 0}.iti__flag.iti__ng{height:10px;background-position:-3774px 0}.iti__flag.iti__ni{height:12px;background-position:-3796px 0}.iti__flag.iti__nl{height:14px;background-position:-3818px 0}.iti__flag.iti__no{height:15px;background-position:-3840px 0}.iti__flag.iti__np{height:15px;background-position:-3862px 0}.iti__flag.iti__nr{height:10px;background-position:-3877px 0}.iti__flag.iti__nu{height:10px;background-position:-3899px 0}.iti__flag.iti__nz{height:10px;background-position:-3921px 0}.iti__flag.iti__om{height:10px;background-position:-3943px 0}.iti__flag.iti__pa{height:14px;background-position:-3965px 0}.iti__flag.iti__pe{height:14px;background-position:-3987px 0}.iti__flag.iti__pf{height:14px;background-position:-4009px 0}.iti__flag.iti__pg{height:15px;background-position:-4031px 0}.iti__flag.iti__ph{height:10px;background-position:-4053px 0}.iti__flag.iti__pk{height:14px;background-position:-4075px 0}.iti__flag.iti__pl{height:13px;background-position:-4097px 0}.iti__flag.iti__pm{height:14px;background-position:-4119px 0}.iti__flag.iti__pn{height:10px;background-position:-4141px 0}.iti__flag.iti__pr{height:14px;background-position:-4163px 0}.iti__flag.iti__ps{height:10px;background-position:-4185px 0}.iti__flag.iti__pt{height:14px;background-position:-4207px 0}.iti__flag.iti__pw{height:13px;background-position:-4229px 0}.iti__flag.iti__py{height:11px;background-position:-4251px 0}.iti__flag.iti__qa{height:8px;background-position:-4273px 0}.iti__flag.iti__re{height:14px;background-position:-4295px 0}.iti__flag.iti__ro{height:14px;background-position:-4317px 0}.iti__flag.iti__rs{height:14px;background-position:-4339px 0}.iti__flag.iti__ru{height:14px;background-position:-4361px 0}.iti__flag.iti__rw{height:14px;background-position:-4383px 0}.iti__flag.iti__sa{height:14px;background-position:-4405px 0}.iti__flag.iti__sb{height:10px;background-position:-4427px 0}.iti__flag.iti__sc{height:10px;background-position:-4449px 0}.iti__flag.iti__sd{height:10px;background-position:-4471px 0}.iti__flag.iti__se{height:13px;background-position:-4493px 0}.iti__flag.iti__sg{height:14px;background-position:-4515px 0}.iti__flag.iti__sh{height:10px;background-position:-4537px 0}.iti__flag.iti__si{height:10px;background-position:-4559px 0}.iti__flag.iti__sj{height:15px;background-position:-4581px 0}.iti__flag.iti__sk{height:14px;background-position:-4603px 0}.iti__flag.iti__sl{height:14px;background-position:-4625px 0}.iti__flag.iti__sm{height:15px;background-position:-4647px 0}.iti__flag.iti__sn{height:14px;background-position:-4669px 0}.iti__flag.iti__so{height:14px;background-position:-4691px 0}.iti__flag.iti__sr{height:14px;background-position:-4713px 0}.iti__flag.iti__ss{height:10px;background-position:-4735px 0}.iti__flag.iti__st{height:10px;background-position:-4757px 0}.iti__flag.iti__su{height:10px;background-position:-4779px 0}.iti__flag.iti__sv{height:12px;background-position:-4801px 0}.iti__flag.iti__sx{height:14px;background-position:-4823px 0}.iti__flag.iti__sy{height:14px;background-position:-4845px 0}.iti__flag.iti__sz{height:14px;background-position:-4867px 0}.iti__flag.iti__ta{height:10px;background-position:-4889px 0}.iti__flag.iti__tc{height:10px;background-position:-4911px 0}.iti__flag.iti__td{height:14px;background-position:-4933px 0}.iti__flag.iti__tf{height:14px;background-position:-4955px 0}.iti__flag.iti__tg{height:13px;background-position:-4977px 0}.iti__flag.iti__th{height:14px;background-position:-4999px 0}.iti__flag.iti__tj{height:10px;background-position:-5021px 0}.iti__flag.iti__tk{height:10px;background-position:-5043px 0}.iti__flag.iti__tl{height:10px;background-position:-5065px 0}.iti__flag.iti__tm{height:14px;background-position:-5087px 0}.iti__flag.iti__tn{height:14px;background-position:-5109px 0}.iti__flag.iti__to{height:10px;background-position:-5131px 0}.iti__flag.iti__tr{height:14px;background-position:-5153px 0}.iti__flag.iti__tt{height:12px;background-position:-5175px 0}.iti__flag.iti__tv{height:10px;background-position:-5197px 0}.iti__flag.iti__tw{height:14px;background-position:-5219px 0}.iti__flag.iti__tz{height:14px;background-position:-5241px 0}.iti__flag.iti__ua{height:14px;background-position:-5263px 0}.iti__flag.iti__ug{height:14px;background-position:-5285px 0}.iti__flag.iti__uk{height:10px;background-position:-5307px 0}.iti__flag.iti__um{height:11px;background-position:-5329px 0}.iti__flag.iti__un{height:14px;background-position:-5351px 0}.iti__flag.iti__us{height:11px;background-position:-5373px 0}.iti__flag.iti__uy{height:14px;background-position:-5395px 0}.iti__flag.iti__uz{height:10px;background-position:-5417px 0}.iti__flag.iti__va{height:15px;background-position:-5439px 0}.iti__flag.iti__vc{height:14px;background-position:-5456px 0}.iti__flag.iti__ve{height:14px;background-position:-5478px 0}.iti__flag.iti__vg{height:10px;background-position:-5500px 0}.iti__flag.iti__vi{height:14px;background-position:-5522px 0}.iti__flag.iti__vn{height:14px;background-position:-5544px 0}.iti__flag.iti__vu{height:12px;background-position:-5566px 0}.iti__flag.iti__wf{height:14px;background-position:-5588px 0}.iti__flag.iti__ws{height:10px;background-position:-5610px 0}.iti__flag.iti__xk{height:15px;background-position:-5632px 0}.iti__flag.iti__ye{height:14px;background-position:-5654px 0}.iti__flag.iti__yt{height:14px;background-position:-5676px 0}.iti__flag.iti__za{height:14px;background-position:-5698px 0}.iti__flag.iti__zm{height:14px;background-position:-5720px 0}.iti__flag.iti__zw{height:10px;background-position:-5742px 0}.iti__flag{height:15px;box-shadow:0 0 1px 0 #888;background-image:url(../img/flags.png?1);background-repeat:no-repeat;background-position:20px 0}@media (min-resolution:2x){.iti__flag{background-image:url(../img/flags@2x.png?1)}}.iti__globe{background-image:url(../img/globe.png);background-size:contain;background-position:right;box-shadow:none;height:19px}@media (min-resolution:2x){.iti__globe{background-image:url(../img/globe@2x.png)}} \ No newline at end of file diff --git a/assets/intl-tel-input/img/flags.png b/assets/intl-tel-input/img/flags.png new file mode 100644 index 0000000..36f236e Binary files /dev/null and b/assets/intl-tel-input/img/flags.png differ diff --git a/assets/intl-tel-input/img/flags@2x.png b/assets/intl-tel-input/img/flags@2x.png new file mode 100644 index 0000000..cba08f2 Binary files /dev/null and b/assets/intl-tel-input/img/flags@2x.png differ diff --git a/assets/intl-tel-input/img/globe.png b/assets/intl-tel-input/img/globe.png new file mode 100644 index 0000000..8f380f1 Binary files /dev/null and b/assets/intl-tel-input/img/globe.png differ diff --git a/assets/intl-tel-input/img/globe@2x.png b/assets/intl-tel-input/img/globe@2x.png new file mode 100644 index 0000000..45d0db0 Binary files /dev/null and b/assets/intl-tel-input/img/globe@2x.png differ diff --git a/assets/intl-tel-input/js/data.js b/assets/intl-tel-input/js/data.js new file mode 100644 index 0000000..d05a0e3 --- /dev/null +++ b/assets/intl-tel-input/js/data.js @@ -0,0 +1,37 @@ +/* + * International Telephone Input v19.5.7 + * https://github.com/jackocnr/intl-tel-input.git + * Licensed under the MIT license + */ + +// wrap in UMD +(function() { + // Array of country objects for the flag dropdown. + // Here is the criteria for the plugin to support a given country/territory + // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes + // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png + // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml + // Each country array has the following information: + // [ + // Country name, + // iso2 code, + // International dial code, + // Order (if >1 country with same dial code), + // Area codes + // ] + var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; + // loop over all of the countries above, restructuring the data to be objects with named keys + for (var i = 0; i < allCountries.length; i++) { + var c = allCountries[i]; + allCountries[i] = { + name: c[0], + iso2: c[1], + dialCode: c[2], + priority: c[3] || 0, + areaCodes: c[4] || null, + nodeById: {} + }; + } + if (typeof module === "object" && module.exports) module.exports = allCountries; else window.allCountries = allCountries; +})(); \ No newline at end of file diff --git a/assets/intl-tel-input/js/data.min.js b/assets/intl-tel-input/js/data.min.js new file mode 100644 index 0000000..6aa72a3 --- /dev/null +++ b/assets/intl-tel-input/js/data.min.js @@ -0,0 +1,7 @@ +/* + * International Telephone Input v19.5.7 + * https://github.com/jackocnr/intl-tel-input.git + * Licensed under the MIT license + */ + +!function(){for(var a=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua & Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria","at","43"],["Azerbaijan","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus","by","375"],["Belgium","be","32"],["Belize","bz","501"],["Benin","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia & Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros","km","269"],["Congo - Brazzaville","cg","242"],["Congo - Kinshasa","cd","243"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus","cy","357"],["Czech Republic","cz","420"],["Denmark","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands","fk","500"],["Faroe Islands","fo","298"],["Fiji","fj","679"],["Finland","fi","358",0],["France","fr","33"],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49"],["Ghana","gh","233"],["Gibraltar","gi","350"],["Greece","gr","30"],["Greenland","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong","hk","852"],["Hungary","hu","36"],["Iceland","is","354"],["India","in","91"],["Indonesia","id","62"],["Iran","ir","98"],["Iraq","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel","il","972"],["Italy","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan","jo","962"],["Kazakhstan","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996"],["Laos","la","856"],["Latvia","lv","371"],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico","mx","52"],["Micronesia","fm","691"],["Moldova","md","373"],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco","ma","212",0],["Mozambique","mz","258"],["Myanmar (Burma)","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31"],["New Caledonia","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea","kp","850"],["North Macedonia","mk","389"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway","no","47",0],["Oman","om","968"],["Pakistan","pk","92"],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63"],["Poland","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar","qa","974"],["Réunion","re","262",0],["Romania","ro","40"],["Russia","ru","7",0],["Rwanda","rw","250"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé & Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82"],["South Sudan","ss","211"],["Spain","es","34"],["Sri Lanka","lk","94"],["St Barthélemy","bl","590",1],["St Helena","sh","290"],["St Kitts & Nevis","kn","1",18,["869"]],["St Lucia","lc","1",19,["758"]],["St Martin","mf","590",2],["St Pierre & Miquelon","pm","508"],["St Vincent & Grenadines","vc","1",20,["784"]],["Sudan","sd","249"],["Suriname","sr","597"],["Svalbard & Jan Mayen","sj","47",1,["79"]],["Sweden","se","46"],["Switzerland","ch","41"],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad & Tobago","tt","1",22,["868"]],["Tunisia","tn","216"],["Turkey","tr","90"],["Turkmenistan","tm","993"],["Turks & Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380"],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["US Virgin Islands","vi","1",24,["340"]],["Uzbekistan","uz","998"],["Vanuatu","vu","678"],["Vatican City","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam","vn","84"],["Wallis & Futuna","wf","681"],["Western Sahara","eh","212",1,["5288","5289"]],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],b=0;b1 country with same dial code), + // Area codes + // ] + var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; + // loop over all of the countries above, restructuring the data to be objects with named keys + for (var i = 0; i < allCountries.length; i++) { + var c = allCountries[i]; + allCountries[i] = { + name: c[0], + iso2: c[1], + dialCode: c[2], + priority: c[3] || 0, + areaCodes: c[4] || null, + nodeById: {} + }; + } + "use strict"; + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? Object(arguments[i]) : {}; + var ownKeys = Object.keys(source); + if (typeof Object.getOwnPropertySymbols === "function") { + ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + ownKeys.forEach(function(key) { + _defineProperty(target, key, source[key]); + }); + } + return target; + } + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + return arr2; + } + function _iterableToArrayLimit(arr, i) { + var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; + if (null != _i) { + var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; + try { + if (_x = (_i = _i.call(arr)).next, 0 === i) { + if (Object(_i) !== _i) return; + _n = !1; + } else for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { + } + } catch (err) { + _d = !0, _e = err; + } finally { + try { + if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; + } finally { + if (_d) throw _e; + } + } + return _arr; + } + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + var intlTelInputGlobals = { + getInstance: function getInstance(input) { + var id = input.getAttribute("data-intl-tel-input-id"); + return window.intlTelInputGlobals.instances[id]; + }, + instances: {}, + // using a global like this allows us to mock it in the tests + documentReady: function documentReady() { + return document.readyState === "complete"; + } + }; + if (typeof window === "object") { + window.intlTelInputGlobals = intlTelInputGlobals; + } + // these vars persist through all instances of the plugin + var id = 0; + var defaults = { + // whether or not to allow the dropdown + allowDropdown: true, + // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry + autoInsertDialCode: false, + // add a placeholder in the input with an example number for the selected country + autoPlaceholder: "polite", + // add a country search input at the top of the dropdown + countrySearch: true, + // modify the parentClass + containerClass: "", + // modify the auto placeholder + customPlaceholder: null, + // by default, initialise with the first country in the list selected (if no country set via the initial value or initialCountry option) + defaultToFirstCountry: true, + // append menu to specified element + dropdownContainer: null, + // don't display these countries + excludeCountries: [], + // fix the dropdown width to the input width (rather than being as wide as the longest country name) + fixDropdownWidth: true, + // format the number as the user types + formatAsYouType: true, + // format the input value during initialisation and on setNumber + formatOnDisplay: true, + // geoIp lookup function + geoIpLookup: null, + // inject a hidden input with this name, and on submit, populate it with the result of getNumber + hiddenInput: null, + // internationalise the plugin text e.g. search input placeholder, country names + i18n: {}, + // initial country + initialCountry: "", + // national vs international formatting for numbers e.g. placeholders and displaying existing numbers + nationalMode: true, + // display only these countries + onlyCountries: [], + // number type to use for placeholders + placeholderNumberType: "MOBILE", + // the countries at the top of the list + preferredCountries: [], + // option to hide the flags - must be used with showSelectedDialCode, or allowDropdown=false + showFlags: true, + // display the international dial code next to the selected flag + showSelectedDialCode: false, + // use full screen popup instead of dropdown for country list + useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? // we cannot just test screen size as some smartphones/website meta tags will report desktop + // resolutions + // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' + /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, + // specify the path to the libphonenumber script to enable validation/formatting + utilsScript: "" + }; + // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes + var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; + // run a method on each instance of the plugin + var forEachInstance = function forEachInstance(method) { + var instances = window.intlTelInputGlobals.instances; + Object.values(instances).forEach(function(instance) { + return instance[method](); + }); + }; + // this is our plugin class that we will create an instance of + // eslint-disable-next-line no-unused-vars + var Iti = /*#__PURE__*/ function() { + function Iti(input) { + var customOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + _classCallCheck(this, Iti); + this.id = id++; + this.telInput = input; + this.activeItem = null; + this.highlightedItem = null; + // process specified options / defaults + this.options = Object.assign({}, defaults, customOptions); + this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); + } + _createClass(Iti, [ { + key: "_init", + value: function _init() { + var _this = this; + // if showing fullscreen popup, do not fix the width + if (this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = false; + } + // when search enabled, we must fix the width else it would change with different results + if (this.options.countrySearch && !this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = true; + } + // if in nationalMode, do not insert dial codes + if (this.options.nationalMode) { + this.options.autoInsertDialCode = false; + } + // if showSelectedDialCode enabled, do not insert dial codes + if (this.options.showSelectedDialCode) { + this.options.autoInsertDialCode = false; + } + // force showFlags=true if there's a dropdown and we're not displaying the dial code, + // as otherwise you just have a down arrow on it's own which doesn't make sense + var forceShowFlags = this.options.allowDropdown && !this.options.showSelectedDialCode; + if (!this.options.showFlags && forceShowFlags) { + this.options.showFlags = true; + } + // on mobile, we want a full screen dropdown, so we must append it to the body + if (this.options.useFullscreenPopup && !this.options.dropdownContainer) { + this.options.dropdownContainer = document.body; + } + // check if input has one parent with RTL + this.isRTL = !!this.telInput.closest("[dir=rtl]"); + // these promises get resolved when their individual requests complete + // this way the dev can do something like iti.promise.then(...) to know when all requests are + // complete + if (typeof Promise !== "undefined") { + var autoCountryPromise = new Promise(function(resolve, reject) { + _this.resolveAutoCountryPromise = resolve; + _this.rejectAutoCountryPromise = reject; + }); + var utilsScriptPromise = new Promise(function(resolve, reject) { + _this.resolveUtilsScriptPromise = resolve; + _this.rejectUtilsScriptPromise = reject; + }); + this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); + } else { + // prevent errors when Promise doesn't exist + this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {}; + this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {}; + } + // in various situations there could be no country selected initially, but we need to be able + // to assume this variable exists + this.selectedCountryData = {}; + // process all the data: onlyCountries, excludeCountries, preferredCountries etc + this._processCountryData(); + // generate the markup + this._generateMarkup(); + // set the initial state of the input value and the selected flag + this._setInitialState(); + // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click + this._initListeners(); + // utils script, and auto country + this._initRequests(); + } + }, { + key: "_processCountryData", + value: function _processCountryData() { + // process onlyCountries or excludeCountries array if present + this._processAllCountries(); + // generate this.dialCodes and this.dialCodeToIso2Map + this._processDialCodes(); + // process the preferredCountries + this._processPreferredCountries(); + // translate country names according to i18n option + this._translateCountryNames(); + // sort countries by name + if (this.options.onlyCountries.length || this.options.i18n) { + this.countries.sort(this._countryNameSort); + } + } + }, { + key: "_addToDialCodeMap", + value: function _addToDialCodeMap(iso2, dialCode, priority) { + if (dialCode.length > this.dialCodeMaxLen) { + this.dialCodeMaxLen = dialCode.length; + } + if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) { + this.dialCodeToIso2Map[dialCode] = []; + } + // bail if we already have this country for this dialCode + for (var i = 0; i < this.dialCodeToIso2Map[dialCode].length; i++) { + if (this.dialCodeToIso2Map[dialCode][i] === iso2) { + return; + } + } + // check for undefined as 0 is falsy + var index = priority !== undefined ? priority : this.dialCodeToIso2Map[dialCode].length; + this.dialCodeToIso2Map[dialCode][index] = iso2; + } + }, { + key: "_processAllCountries", + value: function _processAllCountries() { + if (this.options.onlyCountries.length) { + var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) { + return country.toLowerCase(); + }); + this.countries = allCountries.filter(function(country) { + return lowerCaseOnlyCountries.indexOf(country.iso2) > -1; + }); + } else if (this.options.excludeCountries.length) { + var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) { + return country.toLowerCase(); + }); + this.countries = allCountries.filter(function(country) { + return lowerCaseExcludeCountries.indexOf(country.iso2) === -1; + }); + } else { + this.countries = allCountries; + } + } + }, { + key: "_translateCountryNames", + value: function _translateCountryNames() { + for (var i = 0; i < this.countries.length; i++) { + var iso2 = this.countries[i].iso2.toLowerCase(); + if (this.options.i18n.hasOwnProperty(iso2)) { + this.countries[i].name = this.options.i18n[iso2]; + } + } + } + }, { + key: "_countryNameSort", + value: function _countryNameSort(a, b) { + if (a.name < b.name) { + return -1; + } + if (a.name > b.name) { + return 1; + } + return 0; + } + }, { + key: "_processDialCodes", + value: function _processDialCodes() { + // here we store just dial codes, where the key is the dial code, and the value is true + // e.g. { 1: true, 7: true, 20: true, ... } + this.dialCodes = {}; + this.dialCodeMaxLen = 0; + // here we map dialCodes (inc both dialCode and dialCode+areaCode) to iso2 codes + /* e.g. + * { + * 1: [ 'us', 'ca', ... ], # all NANP countries + * 12: [ 'us', 'ca', ... ], # subset of NANP countries + * 120: [ 'us', 'ca' ], # just US and Canada + * 1204: [ 'ca' ], # only Canada + * ... + * } + */ + this.dialCodeToIso2Map = {}; + // first: add dial codes + for (var i = 0; i < this.countries.length; i++) { + var c = this.countries[i]; + if (!this.dialCodes[c.dialCode]) { + this.dialCodes[c.dialCode] = true; + } + this._addToDialCodeMap(c.iso2, c.dialCode, c.priority); + } + // next: add area codes + // this is a second loop over countries, to make sure we have all of the "root" countries + // already in the map, so that we can access them, as each time we add an area code substring + // to the map, we also need to include the "root" country's code, as that also matches + for (var _i = 0; _i < this.countries.length; _i++) { + var _c = this.countries[_i]; + // area codes + if (_c.areaCodes) { + var rootIso2Code = this.dialCodeToIso2Map[_c.dialCode][0]; + // for each area code + for (var j = 0; j < _c.areaCodes.length; j++) { + var areaCode = _c.areaCodes[j]; + // for each digit in the area code to add all partial matches as well + for (var k = 1; k < areaCode.length; k++) { + var partialDialCode = _c.dialCode + areaCode.substr(0, k); + // start with the root country, as that also matches this dial code + this._addToDialCodeMap(rootIso2Code, partialDialCode); + this._addToDialCodeMap(_c.iso2, partialDialCode); + } + // add the full area code + this._addToDialCodeMap(_c.iso2, _c.dialCode + areaCode); + } + } + } + } + }, { + key: "_processPreferredCountries", + value: function _processPreferredCountries() { + this.preferredCountries = []; + for (var i = 0; i < this.options.preferredCountries.length; i++) { + var iso2 = this.options.preferredCountries[i].toLowerCase(); + var countryData = this._getCountryData(iso2, true); + if (countryData) { + this.preferredCountries.push(countryData); + } + } + } + }, { + key: "_createEl", + value: function _createEl(name, attrs, container) { + var el = document.createElement(name); + if (attrs) { + Object.entries(attrs).forEach(function(_ref) { + var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; + return el.setAttribute(key, value); + }); + } + if (container) { + container.appendChild(el); + } + return el; + } + }, { + key: "_generateMarkup", + value: function _generateMarkup() { + this.telInput.classList.add("iti__tel-input"); + // if autocomplete does not exist on the element and its form, then + // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can + // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the + // autocompleted number, which on submit could mean wrong number is saved + if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) { + this.telInput.setAttribute("autocomplete", "off"); + } + var _this$options = this.options, allowDropdown = _this$options.allowDropdown, showSelectedDialCode = _this$options.showSelectedDialCode, showFlags = _this$options.showFlags, containerClass = _this$options.containerClass, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch; + // containers (mostly for positioning) + var parentClass = "iti"; + if (allowDropdown) { + parentClass += " iti--allow-dropdown"; + } + if (showSelectedDialCode) { + parentClass += " iti--show-selected-dial-code"; + } + if (showFlags) { + parentClass += " iti--show-flags"; + } + if (containerClass) { + parentClass += " ".concat(containerClass); + } + if (!useFullscreenPopup) { + parentClass += " iti--inline-dropdown"; + } + var wrapper = this._createEl("div", { + "class": parentClass + }); + this.telInput.parentNode.insertBefore(wrapper, this.telInput); + // only hide the flagsContainer if allowDropdown, showFlags and showSelectedDialCode are all false + var showFlagsContainer = allowDropdown || showFlags || showSelectedDialCode; + if (showFlagsContainer) { + this.flagsContainer = this._createEl("div", { + "class": "iti__flag-container" + }, wrapper); + } + wrapper.appendChild(this.telInput); + // selected flag (displayed to left of input) + // using Aria tags for "Select-Only Combobox Example" + // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ + if (showFlagsContainer) { + this.selectedFlag = this._createEl("div", _objectSpread({ + "class": "iti__selected-flag" + }, allowDropdown && { + role: "combobox", + "aria-haspopup": "listbox", + "aria-controls": "iti-".concat(this.id, "__country-listbox"), + "aria-expanded": "false", + "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" + }), this.flagsContainer); + } + if (showFlags) { + this.selectedFlagInner = this._createEl("div", { + "class": "iti__flag" + }, this.selectedFlag); + } + if (this.selectedFlag && this.telInput.disabled) { + this.selectedFlag.setAttribute("aria-disabled", "true"); + } + if (showSelectedDialCode) { + this.selectedDialCode = this._createEl("div", { + "class": "iti__selected-dial-code" + }, this.selectedFlag); + } + if (allowDropdown) { + if (!this.telInput.disabled) { + // make element focusable and tab navigable + this.selectedFlag.setAttribute("tabindex", "0"); + } + this.dropdownArrow = this._createEl("div", { + "class": "iti__arrow" + }, this.selectedFlag); + var extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width"; + this.dropdownContent = this._createEl("div", { + "class": "iti__dropdown-content iti__hide ".concat(extraClasses) + }); + if (countrySearch) { + this.searchInput = this._createEl("input", { + type: "text", + "class": "iti__search-input", + placeholder: this.options.i18n.searchPlaceholder || "Search" + }, this.dropdownContent); + } + // country list: preferred countries, then divider, then all countries + this.countryList = this._createEl("ul", { + "class": "iti__country-list", + id: "iti-".concat(this.id, "__country-listbox"), + role: "listbox", + "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" + }, this.dropdownContent); + if (this.preferredCountries.length && !countrySearch) { + this._appendListItems(this.preferredCountries, "iti__preferred", true); + this._createEl("li", { + "class": "iti__divider", + "aria-hidden": "true" + }, this.countryList); + } + this._appendListItems(this.countries, "iti__standard"); + // create dropdownContainer markup + if (dropdownContainer) { + var dropdownClasses = "iti iti--container"; + if (useFullscreenPopup) { + dropdownClasses += " iti--fullscreen-popup"; + } else { + dropdownClasses += " iti--inline-dropdown"; + } + if (countrySearch) { + dropdownClasses += " iti--country-search"; + } + this.dropdown = this._createEl("div", { + "class": dropdownClasses + }); + this.dropdown.appendChild(this.dropdownContent); + } else { + this.flagsContainer.appendChild(this.dropdownContent); + } + } + if (hiddenInput) { + var telInputName = this.telInput.getAttribute("name"); + var result = hiddenInput(telInputName); + var isObject = result !== null && typeof result === "object"; + var hiddenInputPhoneName; + var hiddenInputCountryName; + if (isObject) { + hiddenInputPhoneName = result.phone || telInputName; + hiddenInputCountryName = result.country || "".concat(hiddenInputPhoneName, "_country"); + } else { + hiddenInputPhoneName = result || telInputName; + hiddenInputCountryName = "".concat(hiddenInputPhoneName, "_country"); + } + // Check if a name has been determined for the phone input field after all conditions + if (!hiddenInputPhoneName) { + return; + } + // Create hidden input for the full international number + this.hiddenInput = this._createEl("input", { + type: "hidden", + name: hiddenInputPhoneName + }); + // Create hidden input for the selected country iso2 code + this.hiddenInputCountry = this._createEl("input", { + type: "hidden", + name: hiddenInputCountryName + }); + wrapper.appendChild(this.hiddenInput); + wrapper.appendChild(this.hiddenInputCountry); + } + } + }, { + key: "_appendListItems", + value: function _appendListItems(countries, className, preferred) { + for (var i = 0; i < countries.length; i++) { + var c = countries[i]; + var idSuffix = preferred ? "-preferred" : ""; + var listItem = this._createEl("li", { + id: "iti-".concat(this.id, "__item-").concat(c.iso2).concat(idSuffix), + "class": "iti__country ".concat(className), + tabindex: "-1", + role: "option", + "data-dial-code": c.dialCode, + "data-country-code": c.iso2, + "aria-selected": "false" + }, this.countryList); + // store this for later use e.g. country search filtering + c.nodeById[this.id] = listItem; + var content = ""; + // add the flag + if (this.options.showFlags) { + content += "
"); + } + // and the country name and dial code + content += "".concat(c.name, ""); + content += "+".concat(c.dialCode, ""); + listItem.insertAdjacentHTML("beforeend", content); + } + } + }, { + key: "_setInitialState", + value: function _setInitialState() { + var overrideAutoCountry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // fix firefox bug: when first load page (with input with value set to number with intl dial + // code) and initialising plugin removes the dial code from the input, then refresh page, + // and we try to init plugin again but this time on number without dial code so get grey flag + var attributeValue = this.telInput.getAttribute("value"); + var inputValue = this.telInput.value; + var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+"); + var val = useAttribute ? attributeValue : inputValue; + var dialCode = this._getDialCode(val); + var isRegionlessNanp = this._isRegionlessNanp(val); + var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode, defaultToFirstCountry = _this$options2.defaultToFirstCountry; + // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the + // flag, else fall back to the default country + if (dialCode && !isRegionlessNanp) { + this._updateFlagFromNumber(val); + } else if (initialCountry !== "auto" || overrideAutoCountry) { + var lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : ""; + var isValidInitialCountry = lowerInitialCountry && this._getCountryData(lowerInitialCountry, true); + // see if we should select a flag + if (isValidInitialCountry) { + this._setFlag(lowerInitialCountry); + } else { + if (dialCode && isRegionlessNanp) { + // has intl dial code, is regionless nanp, and no initialCountry, so default to US + this._setFlag("us"); + } else if (defaultToFirstCountry && !val) { + // no dial code and no initialCountry, so default to first in list + this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; + this._setFlag(this.defaultCountry); + } else { + // display the empty state (globe icon) + this._setFlag(); + } + } + // if empty and autoInsertDialCode then insert the dial code + if (!val && autoInsertDialCode) { + this.telInput.value = "+".concat(this.selectedCountryData.dialCode); + } + } + // NOTE: if initialCountry is set to auto, that will be handled separately + // format - note this wont be run after _updateDialCode as that's only called if no val + if (val) { + this._updateValFromNumber(val); + } + } + }, { + key: "_initListeners", + value: function _initListeners() { + this._initKeyListeners(); + if (this.options.autoInsertDialCode) { + this._initBlurListeners(); + } + if (this.options.allowDropdown) { + this._initDropdownListeners(); + } + if (this.hiddenInput) { + this._initHiddenInputListener(); + } + } + }, { + key: "_initHiddenInputListener", + value: function _initHiddenInputListener() { + var _this2 = this; + this._handleHiddenInputSubmit = function() { + _this2.hiddenInput.value = _this2.getNumber(); + _this2.hiddenInputCountry.value = _this2.getSelectedCountryData().iso2; + }; + if (this.telInput.form) { + this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); + } + } + }, { + key: "_initDropdownListeners", + value: function _initDropdownListeners() { + var _this3 = this; + // hack for input nested inside label (which is valid markup): clicking the selected-flag to + // open the dropdown would then automatically trigger a 2nd click on the input which would + // close it again + this._handleLabelClick = function(e) { + // if the dropdown is closed, then focus the input, else ignore the click + if (_this3.dropdownContent.classList.contains("iti__hide")) { + _this3.telInput.focus(); + } else { + e.preventDefault(); + } + }; + var label = this.telInput.closest("label"); + if (label) { + label.addEventListener("click", this._handleLabelClick); + } + // toggle country dropdown on click + this._handleClickSelectedFlag = function() { + // only intercept this event if we're opening the dropdown + // else let it bubble up to the top ("click-off-to-close" listener) + // we cannot just stopPropagation as it may be needed to close another instance + if (_this3.dropdownContent.classList.contains("iti__hide") && !_this3.telInput.disabled && !_this3.telInput.readOnly) { + _this3._showDropdown(); + } + }; + this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag); + // open dropdown if selected flag is focused and they press up/down/space/enter + this._handleFlagsContainerKeydown = function(e) { + var isDropdownHidden = _this3.dropdownContent.classList.contains("iti__hide"); + if (isDropdownHidden && [ "ArrowUp", "ArrowDown", " ", "Enter" ].includes(e.key)) { + // prevent form from being submitted if "ENTER" was pressed + e.preventDefault(); + // prevent event from being handled again by document + e.stopPropagation(); + _this3._showDropdown(); + } + // allow navigation from dropdown to input on TAB + if (e.key === "Tab") { + _this3._closeDropdown(); + } + }; + this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown); + } + }, { + key: "_initRequests", + value: function _initRequests() { + var _this4 = this; + // if the user has specified the path to the utils script, fetch it on window.load, else resolve + if (this.options.utilsScript && !window.intlTelInputUtils) { + // if the plugin is being initialised after the window.load event has already been fired + if (window.intlTelInputGlobals.documentReady()) { + window.intlTelInputGlobals.loadUtils(this.options.utilsScript); + } else { + // wait until the load event so we don't block any other requests e.g. the flags image + window.addEventListener("load", function() { + window.intlTelInputGlobals.loadUtils(_this4.options.utilsScript); + }); + } + } else { + this.resolveUtilsScriptPromise(); + } + // dont bother with IP lookup if we already have a selected country + if (this.options.initialCountry === "auto" && !this.selectedCountryData.iso2) { + this._loadAutoCountry(); + } else { + this.resolveAutoCountryPromise(); + } + } + }, { + key: "_loadAutoCountry", + value: function _loadAutoCountry() { + var _this5 = this; + // 3 options: + // 1) already loaded (we're done) + // 2) not already started loading (start) + // 3) already started loading (do nothing - just wait for loading callback to fire) + if (window.intlTelInputGlobals.autoCountry) { + this.handleAutoCountry(); + } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) { + // don't do this twice! + window.intlTelInputGlobals.startedLoadingAutoCountry = true; + if (typeof this.options.geoIpLookup === "function") { + this.options.geoIpLookup(function() { + var iso2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + var iso2Lower = iso2.toLowerCase(); + var isValidIso2 = iso2Lower && _this5._getCountryData(iso2Lower, true); + if (isValidIso2) { + window.intlTelInputGlobals.autoCountry = iso2Lower; + // tell all instances the auto country is ready + // TODO: this should just be the current instances + // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight + // away (e.g. if they have already done the geo ip lookup somewhere else). Using + // setTimeout means that the current thread of execution will finish before executing + // this, which allows the plugin to finish initialising. + setTimeout(function() { + return forEachInstance("handleAutoCountry"); + }); + } else { + _this5._setInitialState(true); + forEachInstance("rejectAutoCountryPromise"); + } + }, function() { + return forEachInstance("rejectAutoCountryPromise"); + }); + } + } + } + }, { + key: "_initKeyListeners", + value: function _initKeyListeners() { + var _this6 = this; + var userOverrideFormatting = false; + // update flag on input event + this._handleKeyEvent = function(e) { + if (_this6._updateFlagFromNumber(_this6.telInput.value)) { + _this6._triggerCountryChange(); + } + // if user types their own formatting char (not a plus or a numeric), then set the override + var isFormattingChar = e && e.data && /[^+0-9]/.test(e.data); + var isPaste = e && e.inputType === "insertFromPaste" && _this6.telInput.value; + if (isFormattingChar || isPaste) { + userOverrideFormatting = true; + } else if (!/[^+0-9]/.test(_this6.telInput.value)) { + userOverrideFormatting = false; + } + // handle FAYT, unless userOverrideFormatting or it's a paste event + if (_this6.options.formatAsYouType && !userOverrideFormatting && e.inputType !== "insertFromPaste") { + // maintain caret position after reformatting + var currentCaretPos = _this6.telInput.selectionStart; + var valueBeforeCaret = _this6.telInput.value.substring(0, currentCaretPos); + var relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length; + var isDeleteForwards = e && e.inputType === "deleteContentForward"; + var formattedValue = _this6._formatNumberAsYouType(); + var newCaretPos = _this6._translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards); + _this6.telInput.value = formattedValue; + _this6.telInput.setSelectionRange(newCaretPos, newCaretPos); + } + }; + this.telInput.addEventListener("input", this._handleKeyEvent); + // update flag on cut/paste events (now supported in all major browsers) + this._handleClipboardEvent = function() { + // hack because "paste" event is fired before input is updated + setTimeout(_this6._handleKeyEvent); + }; + this.telInput.addEventListener("cut", this._handleClipboardEvent); + this.telInput.addEventListener("paste", this._handleClipboardEvent); + } + }, { + key: "_translateCursorPosition", + value: function _translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) { + // if the first char is a formatting char, and they backspace delete it: + // cursor should stay at the start (pos 0), rather than stick to the first digit (pos 1) + if (prevCaretPos === 0 && !isDeleteForwards) { + return 0; + } + var count = 0; + for (var i = 0; i < formattedValue.length; i++) { + if (/[+0-9]/.test(formattedValue[i])) { + count++; + } + // normal case: stop when you hit the right number of relevant chars + // (cursor will be just after the final relevant char) + if (count === relevantChars && !isDeleteForwards) { + return i + 1; + } + // spacial case: delete forwards (fn + delete on a mac): + // wait until hit one extra relevant char, and put the cursor just before it (after any formatting chars) + if (isDeleteForwards && count === relevantChars + 1) { + return i; + } + } + return formattedValue.length; + } + }, { + key: "_cap", + value: function _cap(number) { + var max = this.telInput.getAttribute("maxlength"); + return max && number.length > max ? number.substr(0, max) : number; + } + }, { + key: "_initBlurListeners", + value: function _initBlurListeners() { + var _this7 = this; + // on blur or form submit: if just a dial code then remove it + this._handleSubmitOrBlurEvent = function() { + _this7._removeEmptyDialCode(); + }; + if (this.telInput.form) { + this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent); + } + this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent); + } + }, { + key: "_removeEmptyDialCode", + value: function _removeEmptyDialCode() { + if (this.telInput.value.charAt(0) === "+") { + var numeric = this._getNumeric(this.telInput.value); + // if just a plus, or if just a dial code + if (!numeric || this.selectedCountryData.dialCode === numeric) { + this.telInput.value = ""; + } + } + } + }, { + key: "_getNumeric", + value: function _getNumeric(s) { + return s.replace(/\D/g, ""); + } + }, { + key: "_trigger", + value: function _trigger(name) { + var e = new Event(name, { + bubbles: true, + cancelable: true + }); + this.telInput.dispatchEvent(e); + } + }, { + key: "_showDropdown", + value: function _showDropdown() { + if (this.options.fixDropdownWidth) { + this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px"); + } + this.dropdownContent.classList.remove("iti__hide"); + this.selectedFlag.setAttribute("aria-expanded", "true"); + this._setDropdownPosition(); + if (this.options.countrySearch) { + // start by highlighting the first item in the list + var firstElementChild = this.countryList.firstElementChild; + if (firstElementChild) { + this._highlightListItem(firstElementChild, false); + } + this.searchInput.focus(); + } else if (this.activeItem) { + // update highlighting and scroll to active list item + this._highlightListItem(this.activeItem, false); + this._scrollTo(this.activeItem, true); + } + // bind all the dropdown-related listeners: mouseover, click, click-off, keydown + this._bindDropdownListeners(); + // update the arrow + this.dropdownArrow.classList.add("iti__arrow--up"); + this._trigger("open:countrydropdown"); + } + }, { + key: "_toggleClass", + value: function _toggleClass(el, className, shouldHaveClass) { + if (shouldHaveClass && !el.classList.contains(className)) { + el.classList.add(className); + } else if (!shouldHaveClass && el.classList.contains(className)) { + el.classList.remove(className); + } + } + }, { + key: "_setDropdownPosition", + value: function _setDropdownPosition() { + var _this8 = this; + if (this.options.dropdownContainer) { + this.options.dropdownContainer.appendChild(this.dropdown); + } + if (!this.options.useFullscreenPopup) { + var pos = this.telInput.getBoundingClientRect(); + // windowTop from https://stackoverflow.com/a/14384091/217866 + var windowTop = document.documentElement.scrollTop; + var inputTop = pos.top + windowTop; + var dropdownHeight = this.dropdownContent.offsetHeight; + // dropdownFitsBelow = (dropdownBottom < windowBottom) + var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight; + var dropdownFitsAbove = inputTop - dropdownHeight > windowTop; + // dont allow positioning above when country search enabled as the search box jumps around as you filter countries + var positionDropdownAboveInput = !this.options.countrySearch && !dropdownFitsBelow && dropdownFitsAbove; + // by default, the dropdown will be below the input. If we want to position it above the + // input, we add the dropup class. + this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", positionDropdownAboveInput); + // if dropdownContainer is enabled, calculate postion + if (this.options.dropdownContainer) { + // if we want to position the dropdown below the input, we need to add the input height to the top value + var extraTop = positionDropdownAboveInput ? 0 : this.telInput.offsetHeight; + // calculate placement + this.dropdown.style.top = "".concat(inputTop + extraTop, "px"); + this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px"); + // close menu on window scroll + this._handleWindowScroll = function() { + return _this8._closeDropdown(); + }; + window.addEventListener("scroll", this._handleWindowScroll); + } + } + } + }, { + key: "_bindDropdownListeners", + value: function _bindDropdownListeners() { + var _this9 = this; + // when mouse over a list item, just highlight that one + // we add the class "highlight", so if they hit "enter" we know which one to select + this._handleMouseoverCountryList = function(e) { + // handle event delegation, as we're listening for this event on the countryList + var listItem = e.target.closest(".iti__country"); + if (listItem) { + _this9._highlightListItem(listItem, false); + } + }; + this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList); + // listen for country selection + this._handleClickCountryList = function(e) { + var listItem = e.target.closest(".iti__country"); + if (listItem) { + _this9._selectListItem(listItem); + } + }; + this.countryList.addEventListener("click", this._handleClickCountryList); + // click off to close + // (except when this initial opening click is bubbling up) + // we cannot just stopPropagation as it may be needed to close another instance + var isOpening = true; + this._handleClickOffToClose = function() { + if (!isOpening) { + _this9._closeDropdown(); + } + isOpening = false; + }; + document.documentElement.addEventListener("click", this._handleClickOffToClose); + // listen for up/down scrolling, enter to select, or escape to close + // use keydown as keypress doesn't fire for non-char keys and we want to catch if they + // just hit down and hold it to scroll down (no keyup event). + // listen on the document because that's where key events are triggered if no input has focus + var query = ""; + var queryTimer = null; + this._handleKeydownOnDropdown = function(e) { + // prevent down key from scrolling the whole page, + // and enter key from submitting a form etc + if ([ "ArrowUp", "ArrowDown", "Enter", "Escape" ].includes(e.key)) { + e.preventDefault(); + e.stopPropagation(); + // up and down to navigate + if (e.key === "ArrowUp" || e.key === "ArrowDown") { + _this9._handleUpDownKey(e.key); + } else if (e.key === "Enter") { + _this9._handleEnterKey(); + } else if (e.key === "Escape") { + _this9._closeDropdown(); + } + } + // alpha chars to perform search + // regex allows one latin alpha char or space, based on https://stackoverflow.com/a/26900132/217866) + if (!_this9.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { + e.stopPropagation(); + // jump to countries that start with the query string + if (queryTimer) { + clearTimeout(queryTimer); + } + query += e.key.toLowerCase(); + _this9._searchForCountry(query); + // if the timer hits 1 second, reset the query + queryTimer = setTimeout(function() { + query = ""; + }, 1e3); + } + }; + document.addEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + var doFilter = function doFilter() { + var inputQuery = _this9.searchInput.value.trim(); + if (inputQuery) { + _this9._filterCountries(inputQuery); + } else { + _this9._filterCountries("", true); + } + }; + var keyupTimer = null; + this._handleSearchChange = function() { + // filtering country nodes is expensive (lots of DOM manipulation), so rate limit it + if (keyupTimer) { + clearTimeout(keyupTimer); + } + keyupTimer = setTimeout(function() { + doFilter(); + keyupTimer = null; + }, 100); + }; + this.searchInput.addEventListener("input", this._handleSearchChange); + // stop propagation on search input click, so doesn't trigger click-off-to-close listener + this.searchInput.addEventListener("click", function(e) { + return e.stopPropagation(); + }); + } + } + }, { + key: "_normaliseString", + value: function _normaliseString() { + var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(); + } + }, { + key: "_filterCountries", + value: function _filterCountries(query) { + var isReset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var isFirst = true; + this.countryList.innerHTML = ""; + var normalisedQuery = this._normaliseString(query); + for (var i = 0; i < this.countries.length; i++) { + var c = this.countries[i]; + var normalisedCountryName = this._normaliseString(c.name); + var fullDialCode = "+".concat(c.dialCode); + if (isReset || normalisedCountryName.includes(normalisedQuery) || fullDialCode.includes(normalisedQuery) || c.iso2.includes(normalisedQuery)) { + this.countryList.appendChild(c.nodeById[this.id]); + // highlight the first item + if (isFirst) { + this._highlightListItem(c.nodeById[this.id], false); + isFirst = false; + } + } + } + } + }, { + key: "_handleUpDownKey", + value: function _handleUpDownKey(key) { + var next = key === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; + if (next) { + // skip the divider + if (next.classList.contains("iti__divider")) { + next = key === "ArrowUp" ? next.previousElementSibling : next.nextElementSibling; + } + } else if (this.countryList.childElementCount > 1) { + // otherwise, we must be at the end, so loop round again + next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild; + } + if (next) { + // if country search enabled, dont lose focus from the search input on up/down + var doFocus = !this.options.countrySearch; + this._highlightListItem(next, doFocus); + if (this.options.countrySearch) { + this._scrollTo(next, false); + } + } + } + }, { + key: "_handleEnterKey", + value: function _handleEnterKey() { + if (this.highlightedItem) { + this._selectListItem(this.highlightedItem); + } + } + }, { + key: "_searchForCountry", + value: function _searchForCountry(query) { + for (var i = 0; i < this.countries.length; i++) { + if (this._startsWith(this.countries[i].name, query)) { + var listItem = this.countries[i].nodeById[this.id]; + // update highlighting and scroll + this._highlightListItem(listItem, false); + this._scrollTo(listItem, true); + break; + } + } + } + }, { + key: "_startsWith", + value: function _startsWith(a, b) { + return a.substr(0, b.length).toLowerCase() === b; + } + }, { + key: "_updateValFromNumber", + value: function _updateValFromNumber(fullNumber) { + var number = fullNumber; + if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { + var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.showSelectedDialCode; + var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL; + var format = useNational ? NATIONAL : INTERNATIONAL; + number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); + } + number = this._beforeSetNumber(number); + this.telInput.value = number; + } + }, { + key: "_updateFlagFromNumber", + value: function _updateFlagFromNumber(fullNumber) { + var plusIndex = fullNumber.indexOf("+"); + // if it contains a plus, discard any chars before it e.g. accidental space char. + // this keeps the selected country auto-updating correctly, which we want as + // libphonenumber's validation/getNumber methods will ignore these chars anyway + var number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber; + // if we already have US/Canada selected, make sure the number starts + // with a +1 so _getDialCode will be able to extract the area code + // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag + // from the number), that means we're initialising the plugin with a number that already has a + // dial code, so fine to ignore this bit + var selectedDialCode = this.selectedCountryData.dialCode; + var isNanp = selectedDialCode === "1"; + if (number && isNanp && number.charAt(0) !== "+") { + if (number.charAt(0) !== "1") { + number = "1".concat(number); + } + number = "+".concat(number); + } + // if showSelectedDialCode enabled, then consider the selected dial code to be part of the number + if (this.options.showSelectedDialCode && selectedDialCode && number.charAt(0) !== "+") { + number = "+".concat(selectedDialCode).concat(number); + } + // try and extract valid dial code from input + var dialCode = this._getDialCode(number, true); + var numeric = this._getNumeric(number); + var iso2 = null; + if (dialCode) { + var iso2Codes = this.dialCodeToIso2Map[this._getNumeric(dialCode)]; + // check if the right country is already selected. this should be false if the number is + // longer than the matched dial code because in this case we need to make sure that if + // there are multiple country matches, that the first one is selected (note: we could + // just check that here, but it requires the same loop that we already have later) + var alreadySelected = iso2Codes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; + var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric); + // only update the flag if: + // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) + // AND + // B) the right country is not already selected + if (!isRegionlessNanpNumber && !alreadySelected) { + // if using onlyCountries option, iso2Codes[0] may be empty, so we must find the first + // non-empty index + for (var j = 0; j < iso2Codes.length; j++) { + if (iso2Codes[j]) { + iso2 = iso2Codes[j]; + break; + } + } + } + } else if (number.charAt(0) === "+" && numeric.length) { + // invalid dial code, so empty + // Note: use getNumeric here because the number has not been formatted yet, so could contain + // bad chars + iso2 = ""; + } else if ((!number || number === "+") && !this.selectedCountryData.iso2) { + // if no selected flag, and user either clears the input, or just types a plus, then show default + iso2 = this.defaultCountry; + } + if (iso2 !== null) { + return this._setFlag(iso2); + } + return false; + } + }, { + key: "_isRegionlessNanp", + value: function _isRegionlessNanp(number) { + var numeric = this._getNumeric(number); + if (numeric.charAt(0) === "1") { + var areaCode = numeric.substr(1, 3); + return regionlessNanpNumbers.indexOf(areaCode) !== -1; + } + return false; + } + }, { + key: "_highlightListItem", + value: function _highlightListItem(listItem, shouldFocus) { + var prevItem = this.highlightedItem; + if (prevItem) { + prevItem.classList.remove("iti__highlight"); + } + this.highlightedItem = listItem; + this.highlightedItem.classList.add("iti__highlight"); + this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id")); + if (shouldFocus) { + this.highlightedItem.focus(); + } + } + }, { + key: "_getCountryData", + value: function _getCountryData(iso2, allowFail) { + for (var i = 0; i < this.countries.length; i++) { + if (this.countries[i].iso2 === iso2) { + return this.countries[i]; + } + } + if (allowFail) { + return null; + } + throw new Error("No country data for '".concat(iso2, "'")); + } + }, { + key: "_setFlag", + value: function _setFlag(iso2) { + var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, showSelectedDialCode = _this$options3.showSelectedDialCode, showFlags = _this$options3.showFlags, countrySearch = _this$options3.countrySearch; + var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; + // do this first as it will throw an error and stop if iso2 is invalid + this.selectedCountryData = iso2 ? this._getCountryData(iso2, false) : {}; + // update the defaultCountry - we only need the iso2 from now on, so just store that + if (this.selectedCountryData.iso2) { + this.defaultCountry = this.selectedCountryData.iso2; + } + if (showFlags) { + var flagClass = iso2 ? "iti__".concat(iso2) : "iti__globe"; + this.selectedFlagInner.setAttribute("class", "iti__flag ".concat(flagClass)); + } + this._setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode); + if (showSelectedDialCode) { + var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : ""; + this.selectedDialCode.innerHTML = dialCode; + // offsetWidth is zero if input is in a hidden container during initialisation + var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth(); + // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css + if (this.isRTL) { + this.telInput.style.paddingRight = "".concat(selectedFlagWidth + 6, "px"); + } else { + this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px"); + } + } + // and the input's placeholder + this._updatePlaceholder(); + // update the active list item (only if country search disabled, as country search doesn't store the active item) + if (allowDropdown && !countrySearch) { + var prevItem = this.activeItem; + if (prevItem) { + prevItem.classList.remove("iti__active"); + prevItem.setAttribute("aria-selected", "false"); + } + if (iso2) { + // check if there is a preferred item first, else fall back to standard + var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2)); + nextItem.setAttribute("aria-selected", "true"); + nextItem.classList.add("iti__active"); + this.activeItem = nextItem; + } + } + // return if the flag has changed or not + return prevCountry.iso2 !== iso2; + } + }, { + key: "_setSelectedCountryFlagTitleAttribute", + value: function _setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode) { + if (!this.selectedFlag) { + return; + } + var title; + if (iso2 && !showSelectedDialCode) { + title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode); + } else if (iso2) { + // For screen reader output, we don't want to include the dial code in the reader output twice + // so just use the selected country name here: + title = this.selectedCountryData.name; + } else { + title = "Unknown"; + } + this.selectedFlag.setAttribute("title", title); + } + }, { + key: "_getHiddenSelectedFlagWidth", + value: function _getHiddenSelectedFlagWidth() { + // to get the right styling to apply, all we need is a shallow clone of the container, + // and then to inject a deep clone of the selectedFlag element + var containerClone = this.telInput.parentNode.cloneNode(); + containerClone.style.visibility = "hidden"; + document.body.appendChild(containerClone); + var flagsContainerClone = this.flagsContainer.cloneNode(); + containerClone.appendChild(flagsContainerClone); + var selectedFlagClone = this.selectedFlag.cloneNode(true); + flagsContainerClone.appendChild(selectedFlagClone); + var width = selectedFlagClone.offsetWidth; + containerClone.parentNode.removeChild(containerClone); + return width; + } + }, { + key: "_updatePlaceholder", + value: function _updatePlaceholder() { + var _this$options4 = this.options, autoPlaceholder = _this$options4.autoPlaceholder, placeholderNumberType = _this$options4.placeholderNumberType, nationalMode = _this$options4.nationalMode, customPlaceholder = _this$options4.customPlaceholder; + var shouldSetPlaceholder = autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && autoPlaceholder === "polite"; + if (window.intlTelInputUtils && shouldSetPlaceholder) { + var numberType = intlTelInputUtils.numberType[placeholderNumberType]; + var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, nationalMode, numberType) : ""; + placeholder = this._beforeSetNumber(placeholder); + if (typeof customPlaceholder === "function") { + placeholder = customPlaceholder(placeholder, this.selectedCountryData); + } + this.telInput.setAttribute("placeholder", placeholder); + } + } + }, { + key: "_selectListItem", + value: function _selectListItem(listItem) { + // update selected flag and active list item + var flagChanged = this._setFlag(listItem.getAttribute("data-country-code")); + this._closeDropdown(); + this._updateDialCode(listItem.getAttribute("data-dial-code")); + // focus the input + this.telInput.focus(); + if (flagChanged) { + this._triggerCountryChange(); + } + } + }, { + key: "_closeDropdown", + value: function _closeDropdown() { + this.dropdownContent.classList.add("iti__hide"); + this.selectedFlag.setAttribute("aria-expanded", "false"); + this.selectedFlag.removeAttribute("aria-activedescendant"); + // update the arrow + this.dropdownArrow.classList.remove("iti__arrow--up"); + // unbind key events + document.removeEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + this.searchInput.removeEventListener("input", this._handleSearchChange); + } + document.documentElement.removeEventListener("click", this._handleClickOffToClose); + this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList); + this.countryList.removeEventListener("click", this._handleClickCountryList); + // remove menu from container + if (this.options.dropdownContainer) { + if (!this.options.useFullscreenPopup) { + window.removeEventListener("scroll", this._handleWindowScroll); + } + if (this.dropdown.parentNode) { + this.dropdown.parentNode.removeChild(this.dropdown); + } + } + this._trigger("close:countrydropdown"); + } + }, { + key: "_scrollTo", + value: function _scrollTo(element, middle) { + var container = this.countryList; + // windowTop from https://stackoverflow.com/a/14384091/217866 + var windowTop = document.documentElement.scrollTop; + var containerHeight = container.offsetHeight; + var containerTop = container.getBoundingClientRect().top + windowTop; + var containerBottom = containerTop + containerHeight; + var elementHeight = element.offsetHeight; + var elementTop = element.getBoundingClientRect().top + windowTop; + var elementBottom = elementTop + elementHeight; + var newScrollTop = elementTop - containerTop + container.scrollTop; + var middleOffset = containerHeight / 2 - elementHeight / 2; + if (elementTop < containerTop) { + // scroll up + if (middle) { + newScrollTop -= middleOffset; + } + container.scrollTop = newScrollTop; + } else if (elementBottom > containerBottom) { + // scroll down + if (middle) { + newScrollTop += middleOffset; + } + var heightDifference = containerHeight - elementHeight; + container.scrollTop = newScrollTop - heightDifference; + } + } + }, { + key: "_updateDialCode", + value: function _updateDialCode(newDialCodeBare) { + var inputVal = this.telInput.value; + // save having to pass this every time + var newDialCode = "+".concat(newDialCodeBare); + var newNumber; + if (inputVal.charAt(0) === "+") { + // there's a plus so we're dealing with a replacement + var prevDialCode = this._getDialCode(inputVal); + if (prevDialCode) { + // current number contains a valid dial code, so replace it + newNumber = inputVal.replace(prevDialCode, newDialCode); + } else { + // current number contains an invalid dial code, so ditch it + // (no way to determine where the invalid dial code ends and the rest of the number begins) + newNumber = newDialCode; + } + this.telInput.value = newNumber; + } else if (this.options.autoInsertDialCode) { + if (inputVal) { + // there is an existing value with no dial code: prefix the new dial code + newNumber = newDialCode + inputVal; + } else { + newNumber = newDialCode; + } + this.telInput.value = newNumber; + } + } + }, { + key: "_getDialCode", + value: function _getDialCode(number, includeAreaCode) { + var dialCode = ""; + // only interested in international numbers (starting with a plus) + if (number.charAt(0) === "+") { + var numericChars = ""; + // iterate over chars + for (var i = 0; i < number.length; i++) { + var c = number.charAt(i); + // if char is number (https://stackoverflow.com/a/8935649/217866) + if (!isNaN(parseInt(c, 10))) { + numericChars += c; + // if current numericChars make a valid dial code + if (includeAreaCode) { + if (this.dialCodeToIso2Map[numericChars]) { + // store the actual raw string (useful for matching later) + dialCode = number.substr(0, i + 1); + } + } else { + if (this.dialCodes[numericChars]) { + dialCode = number.substr(0, i + 1); + // if we're just looking for a dial code, we can break as soon as we find one + break; + } + } + // stop searching as soon as we can - in this case when we hit max len + if (numericChars.length === this.dialCodeMaxLen) { + break; + } + } + } + } + return dialCode; + } + }, { + key: "_getFullNumber", + value: function _getFullNumber() { + var val = this.telInput.value.trim(); + var dialCode = this.selectedCountryData.dialCode; + var prefix; + var numericVal = this._getNumeric(val); + if (this.options.showSelectedDialCode && !this.options.nationalMode && val.charAt(0) !== "+" && dialCode && numericVal) { + // when using showSelectedDialCode, it is visible so is effectively part of the typed number + prefix = "+".concat(dialCode); + } else { + prefix = ""; + } + return prefix + val; + } + }, { + key: "_beforeSetNumber", + value: function _beforeSetNumber(fullNumber) { + var number = fullNumber; + if (this.options.showSelectedDialCode) { + var dialCode = this._getDialCode(number); + // if there is a valid dial code + if (dialCode) { + // in case _getDialCode returned an area code as well + dialCode = "+".concat(this.selectedCountryData.dialCode); + // a lot of numbers will have a space separating the dial code and the main number, and + // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get + // rid of it + // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc + var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; + number = number.substr(start); + } + } + return this._cap(number); + } + }, { + key: "_triggerCountryChange", + value: function _triggerCountryChange() { + this._trigger("countrychange"); + } + }, { + key: "_formatNumberAsYouType", + value: function _formatNumberAsYouType() { + var val = this._getFullNumber(); + var result = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val; + // if showSelectedDialCode and they haven't (re)typed the dial code in the input as well, then remove the dial code + var dialCode = this.selectedCountryData.dialCode; + if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && result.includes("+".concat(dialCode))) { + var afterDialCode = result.split("+".concat(dialCode))[1] || ""; + return afterDialCode.trim(); + } + return result; + } + }, { + key: "handleAutoCountry", + value: function handleAutoCountry() { + if (this.options.initialCountry === "auto") { + // we must set this even if there is an initial val in the input: in case the initial val is + // invalid and they delete it - they should see their auto country + this.defaultCountry = window.intlTelInputGlobals.autoCountry; + // if there's no initial value in the input, then update the flag + if (!this.telInput.value) { + this.setCountry(this.defaultCountry); + } + this.resolveAutoCountryPromise(); + } + } + }, { + key: "handleUtils", + value: function handleUtils() { + // if the request was successful + if (window.intlTelInputUtils) { + // if there's an initial value in the input, then format it + if (this.telInput.value) { + this._updateValFromNumber(this.telInput.value); + } + if (this.selectedCountryData.iso2) { + this._updatePlaceholder(); + } + } + this.resolveUtilsScriptPromise(); + } + }, { + key: "destroy", + value: function destroy() { + var form = this.telInput.form; + if (this.options.allowDropdown) { + // make sure the dropdown is closed (and unbind listeners) + this._closeDropdown(); + this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag); + this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown); + // label click hack + var label = this.telInput.closest("label"); + if (label) { + label.removeEventListener("click", this._handleLabelClick); + } + } + // unbind hiddenInput listeners + if (this.hiddenInput && form) { + form.removeEventListener("submit", this._handleHiddenInputSubmit); + } + // unbind autoInsertDialCode listeners + if (this.options.autoInsertDialCode) { + if (form) { + form.removeEventListener("submit", this._handleSubmitOrBlurEvent); + } + this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent); + } + // unbind key events, and cut/paste events + this.telInput.removeEventListener("input", this._handleKeyEvent); + this.telInput.removeEventListener("cut", this._handleClipboardEvent); + this.telInput.removeEventListener("paste", this._handleClipboardEvent); + // remove attribute of id instance: data-intl-tel-input-id + this.telInput.removeAttribute("data-intl-tel-input-id"); + // remove markup (but leave the original input) + var wrapper = this.telInput.parentNode; + wrapper.parentNode.insertBefore(this.telInput, wrapper); + wrapper.parentNode.removeChild(wrapper); + delete window.intlTelInputGlobals.instances[this.id]; + } + }, { + key: "getExtension", + value: function getExtension() { + if (window.intlTelInputUtils) { + return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); + } + return ""; + } + }, { + key: "getNumber", + value: function getNumber(format) { + if (window.intlTelInputUtils) { + var iso2 = this.selectedCountryData.iso2; + return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format); + } + return ""; + } + }, { + key: "getNumberType", + value: function getNumberType() { + if (window.intlTelInputUtils) { + return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); + } + return -99; + } + }, { + key: "getSelectedCountryData", + value: function getSelectedCountryData() { + return this.selectedCountryData; + } + }, { + key: "getValidationError", + value: function getValidationError() { + if (window.intlTelInputUtils) { + var iso2 = this.selectedCountryData.iso2; + return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2); + } + return -99; + } + }, { + key: "isValidNumber", + value: function isValidNumber(mobileOnly) { + var val = this._getFullNumber(); + return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2, mobileOnly) : null; + } + }, { + key: "isValidNumberPrecise", + value: function isValidNumberPrecise() { + var val = this._getFullNumber(); + return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null; + } + }, { + key: "setCountry", + value: function setCountry(iso2) { + var iso2Lower = iso2.toLowerCase(); + // check if already selected + if (this.selectedCountryData.iso2 !== iso2Lower) { + this._setFlag(iso2Lower); + this._updateDialCode(this.selectedCountryData.dialCode); + this._triggerCountryChange(); + } + } + }, { + key: "setNumber", + value: function setNumber(number) { + // we must update the flag first, which updates this.selectedCountryData, which is used for + // formatting the number before displaying it + var flagChanged = this._updateFlagFromNumber(number); + this._updateValFromNumber(number); + if (flagChanged) { + this._triggerCountryChange(); + } + } + }, { + key: "setPlaceholderNumberType", + value: function setPlaceholderNumberType(type) { + this.options.placeholderNumberType = type; + this._updatePlaceholder(); + } + } ]); + return Iti; + }(); + /******************** + * STATIC METHODS + ********************/ + // get the country data object + intlTelInputGlobals.getCountryData = function() { + return allCountries; + }; + // inject a