PageSourceSearch

https://www.kimep.kz/wp-content/themes/kimep/bxslider/js/jquery.bxslider.js

js kimep.kz collected 2026-09-24 09:18:51 UTC 65,287 bytes, 1,606 lines download raw bytes

vendor: 29,905 bytes, lines 1-697
1;(function($) {
2
3  var defaults = {
4
5    // GENERAL
6    mode: 'horizontal',
7    slideSelector: '',
8    infiniteLoop: true,
9    hideControlOnEnd: false,
10    speed: 500,
11    easing: null,
12    slideMargin: 0,
13    startSlide: 0,
14    randomStart: false,
15    captions: false,
16    ticker: false,
17    tickerHover: false,
18    adaptiveHeight: false,
19    adaptiveHeightSpeed: 500,
20    video: false,
21    useCSS: true,
22    preloadImages: 'visible',
23    responsive: true,
24    slideZIndex: 50,
25    wrapperClass: 'bx-wrapper',
26
27    // TOUCH
28    touchEnabled: true,
29    swipeThreshold: 50,
30    oneToOneTouch: true,
31    preventDefaultSwipeX: true,
32    preventDefaultSwipeY: false,
33
34    // ACCESSIBILITY
35    ariaLive: true,
36    ariaHidden: true,
37
38    // KEYBOARD
39    keyboardEnabled: false,
40
41    // PAGER
42    pager: true,
43    pagerType: 'full',
44    pagerShortSeparator: ' / ',
45    pagerSelector: null,
46    buildPager: null,
47    pagerCustom: null,
48
49    // CONTROLS
50    controls: true,
51    nextText: '<i class="fa fa-chevron-right" aria-hidden="true"></i>',
52    prevText: '<i class="fa fa-chevron-left" aria-hidden="true"></i>',
53    nextSelector: null,
54    prevSelector: null,
55    autoControls: false,
56    startText: 'Start',
57    stopText: 'Stop',
58    autoControlsCombine: false,
59    autoControlsSelector: null,
60
61    // AUTO
62    auto: false,
63    pause: 4000,
64    autoStart: true,
65    autoDirection: 'next',
66    stopAutoOnClick: false,
67    autoHover: false,
68    autoDelay: 0,
69    autoSlideForOnePage: false,
70
71    // CAROUSEL
72    minSlides: 1,
73    maxSlides: 1,
74    moveSlides: 0,
75    slideWidth: 0,
76    shrinkItems: false,
77
78    // CALLBACKS
79    onSliderLoad: function() { return true; },
80    onSlideBefore: function() { return true; },
81    onSlideAfter: function() { return true; },
82    onSlideNext: function() { return true; },
83    onSlidePrev: function() { return true; },
84    onSliderResize: function() { return true; }
85  };
86
87  $.fn.bxSlider = function(options) {
88
89    if (this.length === 0) {
90      return this;
91    }
92
93    // support multiple elements
94    if (this.length > 1) {
95      this.each(function() {
96        $(this).bxSlider(options);
97      });
98      return this;
99    }
100
101    // create a namespace to be used throughout the plugin
102    var slider = {},
103    // set a reference to our slider element
104    el = this,
105    // get the original window dimens (thanks a lot IE)
106    windowWidth = $(window).width(),
107    windowHeight = $(window).height();
108
109    // Return if slider is already initialized
110    if ($(el).data('bxSlider')) { return; }
111
112    /**
113     * ===================================================================================
114     * = PRIVATE FUNCTIONS
115     * ===================================================================================
116     */
117
118    /**
119     * Initializes namespace settings to be used throughout plugin
120     */
121    var init = function() {
122      // Return if slider is already initialized
123      if ($(el).data('bxSlider')) { return; }
124      // merge user-supplied options with the defaults
125      slider.settings = $.extend({}, defaults, options);
126      // parse slideWidth setting
127      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
128      // store the original children
129      slider.children = el.children(slider.settings.slideSelector);
130      // check if actual number of slides is less than minSlides / maxSlides
131      if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
132      if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
133      // if random start, set the startSlide setting to random number
134      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
135      // store active slide information
136      slider.active = { index: slider.settings.startSlide };
137      // store if the slider is in carousel mode (displaying / moving multiple slides)
138      slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
139      // if carousel, force preloadImages = 'all'
140      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
141      // calculate the min / max width thresholds based on min / max number of slides
142      // used to setup and update carousel slides dimensions
143      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
144      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
145      // store the current state of the slider (if currently animating, working is true)
146      slider.working = false;
147      // initialize the controls object
148      slider.controls = {};
149      // initialize an auto interval
150      slider.interval = null;
151      // determine which property to use for transitions
152      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
153      // determine if hardware acceleration can be used
154      slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
155        // create our test div element
156        var div = document.createElement('div'),
157        // css transition properties
158        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
159        // test for each property
160        for (var i = 0; i < props.length; i++) {
161          if (div.style[props[i]] !== undefined) {
162            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
163            slider.animProp = '-' + slider.cssPrefix + '-transform';
164            return true;
165          }
166        }
167        return false;
168      }());
169      // if vertical mode always make maxSlides and minSlides equal
170      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
171      // save original style data
172      el.data('origStyle', el.attr('style'));
173      el.children(slider.settings.slideSelector).each(function() {
174        $(this).data('origStyle', $(this).attr('style'));
175      });
176
177      // perform all DOM / CSS modifications
178      setup();
179    };
180
181    /**
182     * Performs all DOM and CSS modifications
183     */
184    var setup = function() {
185      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
186
187      // wrap el in a wrapper
188      el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
189      // store a namespace reference to .bx-viewport
190      slider.viewport = el.parent();
191
192      // add aria-live if the setting is enabled and ticker mode is disabled
193      if (slider.settings.ariaLive && !slider.settings.ticker) {
194        slider.viewport.attr('aria-live', 'polite');
195      }
196      // add a loading div to display while images are loading
197      slider.loader = $('<div class="bx-loading" />');
198      slider.viewport.prepend(slider.loader);
199      // set el to a massive width, to hold any needed slides
200      // also strip any margin and padding from el
201      el.css({
202        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
203        position: 'relative'
204      });
205      // if using CSS, add the easing property
206      if (slider.usingCSS && slider.settings.easing) {
207        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
208      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
209      } else if (!slider.settings.easing) {
210        slider.settings.easing = 'swing';
211      }
212      // make modifications to the viewport (.bx-viewport)
213      slider.viewport.css({
214        width: '100%',
215        overflow: 'hidden',
216        position: 'relative'
217      });
218      slider.viewport.parent().css({
219        maxWidth: getViewportMaxWidth()
220      });
221      // make modification to the wrapper (.bx-wrapper)
222      if (!slider.settings.pager && !slider.settings.controls) {
223        slider.viewport.parent().css({
224          margin: '0 auto 0px'
225        });
226      }
227      // apply css to all slider children
228      slider.children.css({
229        float: slider.settings.mode === 'horizontal' ? 'left' : 'none',
230        listStyle: 'none',
231        position: 'relative'
232      });
233      // apply the calculated width after the float is applied to prevent scrollbar interference
234      slider.children.css('width', getSlideWidth());
235      // if slideMargin is supplied, add the css
236      if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
237      if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
238      // if "fade" mode, add positioning and z-index CSS
239      if (slider.settings.mode === 'fade') {
240        slider.children.css({
241          position: 'absolute',
242          zIndex: 0,
243          display: 'none'
244        });
245        // prepare the z-index on the showing element
246        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
247      }
248      // create an element to contain all slider controls (pager, start / stop, etc)
249      slider.controls.el = $('<div class="bx-controls" />');
250      // if captions are requested, add them
251      if (slider.settings.captions) { appendCaptions(); }
252      // check if startSlide is last slide
253      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
254      // if video is true, set up the fitVids plugin
255      if (slider.settings.video) { el.fitVids(); }
256      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
257      // only check for control addition if not in "ticker" mode
258      if (!slider.settings.ticker) {
259        // if controls are requested, add them
260        if (slider.settings.controls) { appendControls(); }
261        // if auto is true, and auto controls are requested, add them
262        if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
263        // if pager is requested, add it
264        if (slider.settings.pager) { appendPager(); }
265        // if any control option is requested, add the controls wrapper
266        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
267      // if ticker mode, do not allow a pager
268      } else {
269        slider.settings.pager = false;
270      }
271      loadElements(preloadSelector, start);
272    };
273
274    var loadElements = function(selector, callback) {
275      var total = selector.find('img:not([src=""]), iframe').length,
276      count = 0;
277      if (total === 0) {
278        callback();
279        return;
280      }
281      selector.find('img:not([src=""]), iframe').each(function() {
282        $(this).one('load error', function() {
283          if (++count === total) { callback(); }
284        }).each(function() {
285          if (this.complete) { $(this).trigger('load'); }
286        });
287      });
288    };
289
290    /**
291     * Start the slider
292     */
293    var start = function() {
294      // if infinite loop, prepare additional slides
295      if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
296        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
297        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
298        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
299        if (slider.settings.ariaHidden) {
300          sliceAppend.attr('aria-hidden', true);
301          slicePrepend.attr('aria-hidden', true);
302        }
303        el.append(sliceAppend).prepend(slicePrepend);
304      }
305      // remove the loading DOM element
306      slider.loader.remove();
307      // set the left / top position of "el"
308      setSlidePosition();
309      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
310      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
311      // set the viewport height
312      slider.viewport.height(getViewportHeight());
313      // make sure everything is positioned just right (same as a window resize)
314      el.redrawSlider();
315      // onSliderLoad callback
316      slider.settings.onSliderLoad.call(el, slider.active.index);
317      // slider has been fully initialized
318      slider.initialized = true;
319      // bind the resize call to the window
320      if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); }
321      // if auto is true and has more than 1 page, start the show
322      if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
323      // if ticker is true, start the ticker
324      if (slider.settings.ticker) { initTicker(); }
325      // if pager is requested, make the appropriate pager link active
326      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
327      // check for any updates to the controls (like hideControlOnEnd updates)
328      if (slider.settings.controls) { updateDirectionControls(); }
329      // if touchEnabled is true, setup the touch events
330      if (navigator.maxTouchPoints > 0) { initTouch(); }
331      // if keyboardEnabled is true, setup the keyboard events
332      if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
333        $(document).keydown(keyPress);
334      }
335    };
336
337    /**
338     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
339     */
340    var getViewportHeight = function() {
341      var height = 0;
342      // first determine which children (slides) should be used in our height calculation
343      var children = $();
344      // if mode is not "vertical" and adaptiveHeight is false, include all children
345      if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
346        children = slider.children;
347      } else {
348        // if not carousel, return the single active child
349        if (!slider.carousel) {
350          children = slider.children.eq(slider.active.index);
351        // if carousel, return a slice of children
352        } else {
353          // get the individual slide index
354          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
355          // add the current slide to the children
356          children = slider.children.eq(currentIndex);
357          // cycle through the remaining "showing" slides
358          for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
359            // if looped back to the start
360            if (currentIndex + i >= slider.children.length) {
361              children = children.add(slider.children.eq(i - 1));
362            } else {
363              children = children.add(slider.children.eq(currentIndex + i));
364            }
365          }
366        }
367      }
368      // if "vertical" mode, calculate the sum of the heights of the children
369      if (slider.settings.mode === 'vertical') {
370        children.each(function(index) {
371          height += $(this).outerHeight();
372        });
373        // add user-supplied margins
374        if (slider.settings.slideMargin > 0) {
375          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
376        }
377      // if not "vertical" mode, calculate the max height of the children
378      } else {
379        height = Math.max.apply(Math, children.map(function() {
380          return $(this).outerHeight(false);
381        }).get());
382      }
383
384      if (slider.viewport.css('box-sizing') === 'border-box') {
385        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
386              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
387      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
388        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
389      }
390
391      return height;
392    };
393
394    /**
395     * Returns the calculated width to be used for the outer wrapper / viewport
396     */
397    var getViewportMaxWidth = function() {
398      var width = '100%';
399      if (slider.settings.slideWidth > 0) {
400        if (slider.settings.mode === 'horizontal') {
401          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
402        } else {
403          width = slider.settings.slideWidth;
404        }
405      }
406      return width;
407    };
408
409    /**
410     * Returns the calculated width to be applied to each slide
411     */
412    var getSlideWidth = function() {
413      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
414      wrapWidth      = slider.viewport.width();    // get the current viewport width
415      // if slide width was not supplied, or is larger than the viewport use the viewport width
416      if (slider.settings.slideWidth === 0 ||
417        (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
418        slider.settings.mode === 'vertical') {
419        newElWidth = wrapWidth;
420      // if carousel, use the thresholds to determine the width
421      } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
422        if (wrapWidth > slider.maxThreshold) {
423          return newElWidth;
424        } else if (wrapWidth < slider.minThreshold) {
425          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
426        } else if (slider.settings.shrinkItems) {
427          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
428        }
429      }
430      return newElWidth;
431    };
432
433    /**
434     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
435     */
436    var getNumberSlidesShowing = function() {
437      var slidesShowing = 1,
438      childWidth = null;
439      if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
440        // if viewport is smaller than minThreshold, return minSlides
441        if (slider.viewport.width() < slider.minThreshold) {
442          slidesShowing = slider.settings.minSlides;
443        // if viewport is larger than maxThreshold, return maxSlides
444        } else if (slider.viewport.width() > slider.maxThreshold) {
445          slidesShowing = slider.settings.maxSlides;
446        // if viewport is between min / max thresholds, divide viewport width by first child width
447        } else {
448          childWidth = slider.children.first().width() + slider.settings.slideMargin;
449          slidesShowing = Math.floor((slider.viewport.width() +
450            slider.settings.slideMargin) / childWidth);
451        }
452      // if "vertical" mode, slides showing will always be minSlides
453      } else if (slider.settings.mode === 'vertical') {
454        slidesShowing = slider.settings.minSlides;
455      }
456      return slidesShowing;
457    };
458
459    /**
460     * Returns the number of pages (one full viewport of slides is one "page")
461     */
462    var getPagerQty = function() {
463      var pagerQty = 0,
464      breakPoint = 0,
465      counter = 0;
466      // if moveSlides is specified by the user
467      if (slider.settings.moveSlides > 0) {
468        if (slider.settings.infiniteLoop) {
469          pagerQty = Math.ceil(slider.children.length / getMoveBy());
470        } else {
471          // when breakpoint goes above children length, counter is the number of pages
472          while (breakPoint < slider.children.length) {
473            ++pagerQty;
474            breakPoint = counter + getNumberSlidesShowing();
475            counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
476          }
477        }
478      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
479      } else {
480        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
481      }
482      return pagerQty;
483    };
484
485    /**
486     * Returns the number of individual slides by which to shift the slider
487     */
488    var getMoveBy = function() {
489      // if moveSlides was set by the user and moveSlides is less than number of slides showing
490      if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
491        return slider.settings.moveSlides;
492      }
493      // if moveSlides is 0 (auto)
494      return getNumberSlidesShowing();
495    };
496
497    /**
498     * Sets the slider's (el) left or top position
499     */
500    var setSlidePosition = function() {
501      var position, lastChild, lastShowingIndex;
502      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
503      if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
504        if (slider.settings.mode === 'horizontal') {
505          // get the last child's position
506          lastChild = slider.children.last();
507          position = lastChild.position();
508          // set the left position
509          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
510        } else if (slider.settings.mode === 'vertical') {
511          // get the last showing index's position
512          lastShowingIndex = slider.children.length - slider.settings.minSlides;
513          position = slider.children.eq(lastShowingIndex).position();
514          // set the top position
515          setPositionProperty(-position.top, 'reset', 0);
516        }
517      // if not last slide
518      } else {
519        // get the position of the first showing slide
520        position = slider.children.eq(slider.active.index * getMoveBy()).position();
521        // check for last slide
522        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
523        // set the respective position
524        if (position !== undefined) {
525          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
526          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
527        }
528      }
529    };
530
531    /**
532     * Sets the el's animating property position (which in turn will sometimes animate el).
533     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
534     *
535     * @param value (int)
536     *  - the animating property's value
537     *
538     * @param type (string) 'slide', 'reset', 'ticker'
539     *  - the type of instance for which the function is being
540     *
541     * @param duration (int)
542     *  - the amount of time (in ms) the transition should occupy
543     *
544     * @param params (array) optional
545     *  - an optional parameter containing any variables that need to be passed in
546     */
547    var setPositionProperty = function(value, type, duration, params) {
548      var animateObj, propValue;
549      // use CSS transform
550      if (slider.usingCSS) {
551        // determine the translate3d value
552        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
553        // add the CSS transition-duration
554        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
555        if (type === 'slide') {
556          // set the property value
557          el.css(slider.animProp, propValue);
558          if (duration !== 0) {
559            // bind a callback method - executes when CSS transition completes
560            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
561              //make sure it's the correct one
562              if (!$(e.target).is(el)) { return; }
563              // unbind the callback
564              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
565              updateAfterSlideTransition();
566            });
567          } else { //duration = 0
568            updateAfterSlideTransition();
569          }
570        } else if (type === 'reset') {
571          el.css(slider.animProp, propValue);
572        } else if (type === 'ticker') {
573          // make the transition use 'linear'
574          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
575          el.css(slider.animProp, propValue);
576          if (duration !== 0) {
577            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
578              //make sure it's the correct one
579              if (!$(e.target).is(el)) { return; }
580              // unbind the callback
581              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
582              // reset the position
583              setPositionProperty(params.resetValue, 'reset', 0);
584              // start the loop again
585              tickerLoop();
586            });
587          } else { //duration = 0
588            setPositionProperty(params.resetValue, 'reset', 0);
589            tickerLoop();
590          }
591        }
592      // use JS animate
593      } else {
594        animateObj = {};
595        animateObj[slider.animProp] = value;
596        if (type === 'slide') {
597          el.animate(animateObj, duration, slider.settings.easing, function() {
598            updateAfterSlideTransition();
599          });
600        } else if (type === 'reset') {
601          el.css(slider.animProp, value);
602        } else if (type === 'ticker') {
603          el.animate(animateObj, duration, 'linear', function() {
604            setPositionProperty(params.resetValue, 'reset', 0);
605            // run the recursive loop after animation
606            tickerLoop();
607          });
608        }
609      }
610    };
611
612    /**
613     * Populates the pager with proper amount of pages
614     */
615    var populatePager = function() {
616      var pagerHtml = '',
617      linkContent = '',
618      pagerQty = getPagerQty();
619      // loop through each pager item
620      for (var i = 0; i < pagerQty; i++) {
621        linkContent = '';
622        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
623        if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
624          linkContent = slider.settings.buildPager(i);
625          slider.pagerEl.addClass('bx-custom-pager');
626        } else {
627          linkContent = i + 1;
628          slider.pagerEl.addClass('bx-default-pager');
629        }
630        // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
631        // add the markup to the string
632        pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
633      }
634      // populate the pager element with pager links
635      slider.pagerEl.html(pagerHtml);
636    };
637
638    /**
639     * Appends the pager to the controls element
640     */
641    var appendPager = function() {
642      if (!slider.settings.pagerCustom) {
643        // create the pager DOM element
644        slider.pagerEl = $('<div class="bx-pager" />');
645        // if a pager selector was supplied, populate it with the pager
646        if (slider.settings.pagerSelector) {
647          $(slider.settings.pagerSelector).html(slider.pagerEl);
648        // if no pager selector was supplied, add it after the wrapper
649        } else {
650          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
651        }
652        // populate the pager
653        populatePager();
654      } else {
655        slider.pagerEl = $(slider.settings.pagerCustom);
656      }
657      // assign the pager click binding
658      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
659    };
660
661    /**
662     * Appends prev / next controls to the controls element
663     */
664    var appendControls = function() {
665      slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
666      slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
667      // bind click actions to the controls
668      slider.controls.next.bind('click touchend', clickNextBind);
669      slider.controls.prev.bind('click touchend', clickPrevBind);
670      // if nextSelector was supplied, populate it
671      if (slider.settings.nextSelector) {
672        $(slider.settings.nextSelector).append(slider.controls.next);
673      }
674      // if prevSelector was supplied, populate it
675      if (slider.settings.prevSelector) {
676        $(slider.settings.prevSelector).append(slider.controls.prev);
677      }
678      // if no custom selectors were supplied
679      if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
680        // add the controls to the DOM
681        slider.controls.directionEl = $('<div class="bx-controls-direction" />');
682        // add the control elements to the directionEl
683        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
684        // slider.viewport.append(slider.controls.directionEl);
685        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
686      }
687    };
688
689    /**
690     * Appends start / stop auto controls to the controls element
691     */
692    var appendControlsAuto = function() {
693      slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
694      slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
695      // add the controls to the DOM
696      slider.controls.autoEl = $('<div class="bx-controls-auto" />');
697      // bind
vendor: 7,154 bytes, lines 697-895
697 click actions to the controls
698      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
699      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
700      // if autoControlsCombine, insert only the "start" control
701      if (slider.settings.autoControlsCombine) {
702        slider.controls.autoEl.append(slider.controls.start);
703      // if autoControlsCombine is false, insert both controls
704      } else {
705        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
706      }
707      // if auto controls selector was supplied, populate it with the controls
708      if (slider.settings.autoControlsSelector) {
709        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
710      // if auto controls selector was not supplied, add it after the wrapper
711      } else {
712        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
713      }
714      // update the auto controls
715      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
716    };
717
718    /**
719     * Appends image captions to the DOM
720     */
721    var appendCaptions = function() {
722      // cycle through each child
723      slider.children.each(function(index) {
724        // get the image title attribute
725        var title = $(this).find('img:first').attr('title');
726        // append the caption
727        if (title !== undefined && ('' + title).length) {
728          $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
729        }
730      });
731    };
732
733    /**
734     * Click next binding
735     *
736     * @param e (event)
737     *  - DOM event object
738     */
739    var clickNextBind = function(e) {
740      e.preventDefault();
741      if (slider.controls.el.hasClass('disabled')) { return; }
742      // if auto show is running, stop it
743      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
744      el.goToNextSlide();
745    };
746
747    /**
748     * Click prev binding
749     *
750     * @param e (event)
751     *  - DOM event object
752     */
753    var clickPrevBind = function(e) {
754      e.preventDefault();
755      if (slider.controls.el.hasClass('disabled')) { return; }
756      // if auto show is running, stop it
757      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
758      el.goToPrevSlide();
759    };
760
761    /**
762     * Click start binding
763     *
764     * @param e (event)
765     *  - DOM event object
766     */
767    var clickStartBind = function(e) {
768      el.startAuto();
769      e.preventDefault();
770    };
771
772    /**
773     * Click stop binding
774     *
775     * @param e (event)
776     *  - DOM event object
777     */
778    var clickStopBind = function(e) {
779      el.stopAuto();
780      e.preventDefault();
781    };
782
783    /**
784     * Click pager binding
785     *
786     * @param e (event)
787     *  - DOM event object
788     */
789    var clickPagerBind = function(e) {
790      var pagerLink, pagerIndex;
791      e.preventDefault();
792      if (slider.controls.el.hasClass('disabled')) {
793        return;
794      }
795      // if auto show is running, stop it
796      if (slider.settings.auto  && slider.settings.stopAutoOnClick) { el.stopAuto(); }
797      pagerLink = $(e.currentTarget);
798      if (pagerLink.attr('data-slide-index') !== undefined) {
799        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
800        // if clicked pager link is not active, continue with the goToSlide call
801        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
802      }
803    };
804
805    /**
806     * Updates the pager links with an active class
807     *
808     * @param slideIndex (int)
809     *  - index of slide to make active
810     */
811    var updatePagerActive = function(slideIndex) {
812      // if "short" pager type
813      var len = slider.children.length; // nb of children
814      if (slider.settings.pagerType === 'short') {
815        if (slider.settings.maxSlides > 1) {
816          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
817        }
818        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
819        return;
820      }
821      // remove all pager active classes
822      slider.pagerEl.find('a').removeClass('active');
823      // apply the active class for all pagers
824      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
825    };
826
827    /**
828     * Performs needed actions after a slide transition
829     */
830    var updateAfterSlideTransition = function() {
831      // if infinite loop is true
832      if (slider.settings.infiniteLoop) {
833        var position = '';
834        // first slide
835        if (slider.active.index === 0) {
836          // set the new position
837          position = slider.children.eq(0).position();
838        // carousel, last slide
839        } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
840          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
841        // last slide
842        } else if (slider.active.index === slider.children.length - 1) {
843          position = slider.children.eq(slider.children.length - 1).position();
844        }
845        if (position) {
846          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
847          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
848        }
849      }
850      // declare that the transition is complete
851      slider.working = false;
852      // onSlideAfter callback
853      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
854    };
855
856    /**
857     * Updates the auto controls state (either active, or combined switch)
858     *
859     * @param state (string) "start", "stop"
860     *  - the new state of the auto show
861     */
862    var updateAutoControls = function(state) {
863      // if autoControlsCombine is true, replace the current control with the new state
864      if (slider.settings.autoControlsCombine) {
865        slider.controls.autoEl.html(slider.controls[state]);
866      // if autoControlsCombine is false, apply the "active" class to the appropriate control
867      } else {
868        slider.controls.autoEl.find('a').removeClass('active');
869        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
870      }
871    };
872
873    /**
874     * Updates the direction controls (checks if either should be hidden)
875     */
876    var updateDirectionControls = function() {
877      if (getPagerQty() === 1) {
878        slider.controls.prev.addClass('disabled');
879        slider.controls.next.addClass('disabled');
880      } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
881        // if first slide
882        if (slider.active.index === 0) {
883          slider.controls.prev.addClass('disabled');
884          slider.controls.next.removeClass('disabled');
885        // if last slide
886        } else if (slider.active.index === getPagerQty() - 1) {
887          slider.controls.next.addClass('disabled');
888          slider.controls.prev.removeClass('disabled');
889        // if any slide in the middle
890        } else {
891          slider.controls.prev.removeClass('disabled');
892          slider.controls.next.removeClass('disabled');
893        }
894      }
895    };
896
897    /**
898     * Initializes the auto process
899     */
900    var initAuto = function() {
901      // if autoDelay was supplied, launch the auto show using a setTimeout() call
902      if (slider.settings.autoDelay > 0) {
903        var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
904      // if autoDelay was not supplied, start the auto show normally
905      } else {
906        el.startAuto();
907
908        //add focus and blur events to ensure its running if timeout gets paused
909        $(window).focus(function() {
910          el.startAuto();
911        }).blur(function() {
912          el.stopAuto();
913        }
vendor: 6,234 bytes, lines 913-1073
913);
914      }
915      // if autoHover is requested
916      if (slider.settings.autoHover) {
917        // on el hover
918        el.hover(function() {
919          // if the auto show is currently playing (has an active interval)
920          if (slider.interval) {
921            // stop the auto show and pass true argument which will prevent control update
922            el.stopAuto(true);
923            // create a new autoPaused value which will be used by the relative "mouseout" event
924            slider.autoPaused = true;
925          }
926        }, function() {
927          // if the autoPaused value was created be the prior "mouseover" event
928          if (slider.autoPaused) {
929            // start the auto show and pass true argument which will prevent control update
930            el.startAuto(true);
931            // reset the autoPaused value
932            slider.autoPaused = null;
933          }
934        });
935      }
936    };
937
938    /**
939     * Initializes the ticker process
940     */
941    var initTicker = function() {
942      var startPosition = 0,
943      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
944      // if autoDirection is "next", append a clone of the entire slider
945      if (slider.settings.autoDirection === 'next') {
946        el.append(slider.children.clone().addClass('bx-clone'));
947      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
948      } else {
949        el.prepend(slider.children.clone().addClass('bx-clone'));
950        position = slider.children.first().position();
951        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
952      }
953      setPositionProperty(startPosition, 'reset', 0);
954      // do not allow controls in ticker mode
955      slider.settings.pager = false;
956      slider.settings.controls = false;
957      slider.settings.autoControls = false;
958      // if autoHover is requested
959      if (slider.settings.tickerHover) {
960        if (slider.usingCSS) {
961          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
962          slider.viewport.hover(function() {
963            transform = el.css('-' + slider.cssPrefix + '-transform');
964            value = parseFloat(transform.split(',')[idx]);
965            setPositionProperty(value, 'reset', 0);
966          }, function() {
967            totalDimens = 0;
968            slider.children.each(function(index) {
969              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
970            });
971            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
972            ratio = slider.settings.speed / totalDimens;
973            // determine which property to use
974            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
975            // calculate the new speed
976            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
977            tickerLoop(newSpeed);
978          });
979        } else {
980          // on el hover
981          slider.viewport.hover(function() {
982            el.stop();
983          }, function() {
984            // calculate the total width of children (used to calculate the speed ratio)
985            totalDimens = 0;
986            slider.children.each(function(index) {
987              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
988            });
989            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
990            ratio = slider.settings.speed / totalDimens;
991            // determine which property to use
992            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
993            // calculate the new speed
994            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
995            tickerLoop(newSpeed);
996          });
997        }
998      }
999      // start the ticker loop
1000      tickerLoop();
1001    };
1002
1003    /**
1004     * Runs a continuous loop, news ticker-style
1005     */
1006    var tickerLoop = function(resumeSpeed) {
1007      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
1008      position = {left: 0, top: 0},
1009      reset = {left: 0, top: 0},
1010      animateProperty, resetValue, params;
1011
1012      // if "next" animate left position to last child, then reset left to 0
1013      if (slider.settings.autoDirection === 'next') {
1014        position = el.find('.bx-clone').first().position();
1015      // if "prev" animate left position to 0, then reset left to first non-clone child
1016      } else {
1017        reset = slider.children.first().position();
1018      }
1019      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
1020      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
1021      params = {resetValue: resetValue};
1022      setPositionProperty(animateProperty, 'ticker', speed, params);
1023    };
1024
1025    /**
1026     * Check if el is on screen
1027     */
1028    var isOnScreen = function(el) {
1029      var win = $(window),
1030      viewport = {
1031        top: win.scrollTop(),
1032        left: win.scrollLeft()
1033      },
1034      bounds = el.offset();
1035
1036      viewport.right = viewport.left + win.width();
1037      viewport.bottom = viewport.top + win.height();
1038      bounds.right = bounds.left + el.outerWidth();
1039      bounds.bottom = bounds.top + el.outerHeight();
1040
1041      return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
1042    };
1043
1044    /**
1045     * Initializes keyboard events
1046     */
1047    var keyPress = function(e) {
1048      var activeElementTag = document.activeElement.tagName.toLowerCase(),
1049      tagFilters = 'input|textarea',
1050      p = new RegExp(activeElementTag,['i']),
1051      result = p.exec(tagFilters);
1052
1053      if (result == null && isOnScreen(el)) {
1054        if (e.keyCode === 39) {
1055          clickNextBind(e);
1056          return false;
1057        } else if (e.keyCode === 37) {
1058          clickPrevBind(e);
1059          return false;
1060        }
1061      }
1062    };
1063
1064    /**
1065     * Initializes touch events
1066     */
1067    var initTouch = function() {
1068      // initialize object to contain all touch values
1069      slider.touch = {
1070        start: {x: 0, y: 0},
1071        end: {x: 0, y: 0}
1072      };
1073      slider.viewport.
vendor: 6,530 bytes, lines 1073-1234
1073bind('touchstart MSPointerDown pointerdown', onTouchStart);
1074
1075      //for browsers that have implemented pointer events and fire a click after
1076      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
1077      slider.viewport.on('click', '.bxslider a', function(e) {
1078        if (slider.viewport.hasClass('click-disabled')) {
1079          e.preventDefault();
1080          slider.viewport.removeClass('click-disabled');
1081        }
1082      });
1083    };
1084
1085    /**
1086     * Event handler for "touchstart"
1087     *
1088     * @param e (event)
1089     *  - DOM event object
1090     */
1091    var onTouchStart = function(e) {
1092      //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
1093      slider.controls.el.addClass('disabled');
1094
1095      if (slider.working) {
1096        e.preventDefault();
1097        slider.controls.el.removeClass('disabled');
1098      } else {
1099        // record the original position when touch starts
1100        slider.touch.originalPos = el.position();
1101        var orig = e.originalEvent,
1102        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
1103        // record the starting touch x, y coordinates
1104        slider.touch.start.x = touchPoints[0].pageX;
1105        slider.touch.start.y = touchPoints[0].pageY;
1106
1107        if (e.target.setPointerCapture) {
1108          slider.pointerId = orig.pointerId;
1109          e.target.setPointerCapture(slider.pointerId);
1110        }
1111        // bind a "touchmove" event to the viewport
1112        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
1113        // bind a "touchend" event to the viewport
1114        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
1115        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
1116      }
1117    };
1118
1119    /**
1120     * Cancel Pointer for Windows Phone
1121     *
1122     * @param e (event)
1123     *  - DOM event object
1124     */
1125    var onPointerCancel = function(e) {
1126      /* onPointerCancel handler is needed to deal with situations when a touchend
1127      doesn't fire after a touchstart (this happens on windows phones only) */
1128      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
1129
1130      //remove handlers
1131      slider.controls.el.removeClass('disabled');
1132      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
1133      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1134      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1135      if (slider.viewport.get(0).releasePointerCapture) {
1136        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
1137      }
1138    };
1139
1140    /**
1141     * Event handler for "touchmove"
1142     *
1143     * @param e (event)
1144     *  - DOM event object
1145     */
1146    var onTouchMove = function(e) {
1147      var orig = e.originalEvent,
1148      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1149      // if scrolling on y axis, do not prevent default
1150      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
1151      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
1152      value = 0,
1153      change = 0;
1154
1155      // x axis swipe
1156      if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
1157        e.preventDefault();
1158      // y axis swipe
1159      } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
1160        e.preventDefault();
1161      }
1162      if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
1163        // if horizontal, drag along x axis
1164        if (slider.settings.mode === 'horizontal') {
1165          change = touchPoints[0].pageX - slider.touch.start.x;
1166          value = slider.touch.originalPos.left + change;
1167        // if vertical, drag along y axis
1168        } else {
1169          change = touchPoints[0].pageY - slider.touch.start.y;
1170          value = slider.touch.originalPos.top + change;
1171        }
1172        setPositionProperty(value, 'reset', 0);
1173      }
1174    };
1175
1176    /**
1177     * Event handler for "touchend"
1178     *
1179     * @param e (event)
1180     *  - DOM event object
1181     */
1182    var onTouchEnd = function(e) {
1183      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
1184      //enable slider controls as soon as user stops interacing with slides
1185      slider.controls.el.removeClass('disabled');
1186      var orig    = e.originalEvent,
1187      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
1188      value       = 0,
1189      distance    = 0;
1190      // record end x, y positions
1191      slider.touch.end.x = touchPoints[0].pageX;
1192      slider.touch.end.y = touchPoints[0].pageY;
1193      // if fade mode, check if absolute x distance clears the threshold
1194      if (slider.settings.mode === 'fade') {
1195        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1196        if (distance >= slider.settings.swipeThreshold) {
1197          if (slider.touch.start.x > slider.touch.end.x) {
1198            el.goToNextSlide();
1199          } else {
1200            el.goToPrevSlide();
1201          }
1202          el.stopAuto();
1203        }
1204      // not fade mode
1205      } else {
1206        // calculate distance and el's animate property
1207        if (slider.settings.mode === 'horizontal') {
1208          distance = slider.touch.end.x - slider.touch.start.x;
1209          value = slider.touch.originalPos.left;
1210        } else {
1211          distance = slider.touch.end.y - slider.touch.start.y;
1212          value = slider.touch.originalPos.top;
1213        }
1214        // if not infinite loop and first / last slide, do not attempt a slide transition
1215        if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
1216          setPositionProperty(value, 'reset', 200);
1217        } else {
1218          // check if distance clears threshold
1219          if (Math.abs(distance) >= slider.settings.swipeThreshold) {
1220            if (distance < 0) {
1221              el.goToNextSlide();
1222            } else {
1223              el.goToPrevSlide();
1224            }
1225            el.stopAuto();
1226          } else {
1227            // el.animate(property, 200);
1228            setPositionProperty(value, 'reset', 200);
1229          }
1230        }
1231      }
1232      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
1233      if (slider.viewport.get(0).releasePointerCapture) {
1234        slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 8,775 bytes, lines 1234-1429
1234);
1235      }
1236    };
1237
1238    /**
1239     * Window resize event callback
1240     */
1241    var resizeWindow = function(e) {
1242      // don't do anything if slider isn't initialized.
1243      if (!slider.initialized) { return; }
1244      // Delay if slider working.
1245      if (slider.working) {
1246        window.setTimeout(resizeWindow, 10);
1247      } else {
1248        // get the new window dimens (again, thank you IE)
1249        var windowWidthNew = $(window).width(),
1250        windowHeightNew = $(window).height();
1251        // make sure that it is a true window resize
1252        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1253        // are resized. Can you just die already?*
1254        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
1255          // set the new window dimens
1256          windowWidth = windowWidthNew;
1257          windowHeight = windowHeightNew;
1258          // update all dynamic elements
1259          el.redrawSlider();
1260          // Call user resize handler
1261          slider.settings.onSliderResize.call(el, slider.active.index);
1262        }
1263      }
1264    };
1265
1266    /**
1267     * Adds an aria-hidden=true attribute to each element
1268     *
1269     * @param startVisibleIndex (int)
1270     *  - the first visible element's index
1271     */
1272    var applyAriaHiddenAttributes = function(startVisibleIndex) {
1273      var numberOfSlidesShowing = getNumberSlidesShowing();
1274      // only apply attributes if the setting is enabled and not in ticker mode
1275      if (slider.settings.ariaHidden && !slider.settings.ticker) {
1276        // add aria-hidden=true to all elements
1277        slider.children.attr('aria-hidden', 'true');
1278        // get the visible elements and change to aria-hidden=false
1279        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
1280      }
1281    };
1282
1283    /**
1284     * Returns index according to present page range
1285     *
1286     * @param slideOndex (int)
1287     *  - the desired slide index
1288     */
1289    var setSlideIndex = function(slideIndex) {
1290      if (slideIndex < 0) {
1291        if (slider.settings.infiniteLoop) {
1292          return getPagerQty() - 1;
1293        }else {
1294          //we don't go to undefined slides
1295          return slider.active.index;
1296        }
1297      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1298      } else if (slideIndex >= getPagerQty()) {
1299        if (slider.settings.infiniteLoop) {
1300          return 0;
1301        } else {
1302          //we don't move to undefined pages
1303          return slider.active.index;
1304        }
1305      // set active index to requested slide
1306      } else {
1307        return slideIndex;
1308      }
1309    };
1310
1311    /**
1312     * ===================================================================================
1313     * = PUBLIC FUNCTIONS
1314     * ===================================================================================
1315     */
1316
1317    /**
1318     * Performs slide transition to the specified slide
1319     *
1320     * @param slideIndex (int)
1321     *  - the destination slide's index (zero-based)
1322     *
1323     * @param direction (string)
1324     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1325     */
1326    el.goToSlide = function(slideIndex, direction) {
1327      // onSlideBefore, onSlideNext, onSlidePrev callbacks
1328      // Allow transition canceling based on returned value
1329      var performTransition = true,
1330      moveBy = 0,
1331      position = {left: 0, top: 0},
1332      lastChild = null,
1333      lastShowingIndex, eq, value, requestEl;
1334      // store the old index
1335      slider.oldIndex = slider.active.index;
1336      //set new index
1337      slider.active.index = setSlideIndex(slideIndex);
1338
1339      // if plugin is currently in motion, ignore request
1340      if (slider.working || slider.active.index === slider.oldIndex) { return; }
1341      // declare that plugin is in motion
1342      slider.working = true;
1343
1344      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1345
1346      // If transitions canceled, reset and return
1347      if (typeof (performTransition) !== 'undefined' && !performTransition) {
1348        slider.active.index = slider.oldIndex; // restore old index
1349        slider.working = false; // is not in motion
1350        return;
1351      }
1352
1353      if (direction === 'next') {
1354        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1355        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1356          performTransition = false;
1357        }
1358      } else if (direction === 'prev') {
1359        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
1360        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
1361          performTransition = false;
1362        }
1363      }
1364
1365      // check if last slide
1366      slider.active.last = slider.active.index >= getPagerQty() - 1;
1367      // update the pager with active class
1368      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
1369      // // check for direction control update
1370      if (slider.settings.controls) { updateDirectionControls(); }
1371      // if slider is set to mode: "fade"
1372      if (slider.settings.mode === 'fade') {
1373        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1374        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1375          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1376        }
1377        // fade out the visible child and reset its z-index value
1378        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1379        // fade in the newly requested slide
1380        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
1381          $(this).css('zIndex', slider.settings.slideZIndex);
1382          updateAfterSlideTransition();
1383        });
1384      // slider mode is not "fade"
1385      } else {
1386        // if adaptiveHeight is true and next height is different from current height, animate to the new height
1387        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
1388          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1389        }
1390        // if carousel and not infinite loop
1391        if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
1392          if (slider.settings.mode === 'horizontal') {
1393            // get the last child position
1394            lastChild = slider.children.eq(slider.children.length - 1);
1395            position = lastChild.position();
1396            // calculate the position of the last slide
1397            moveBy = slider.viewport.width() - lastChild.outerWidth();
1398          } else {
1399            // get last showing index position
1400            lastShowingIndex = slider.children.length - slider.settings.minSlides;
1401            position = slider.children.eq(lastShowingIndex).position();
1402          }
1403          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
1404        } else if (slider.carousel && slider.active.last && direction === 'prev') {
1405          // get the last child position
1406          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1407          lastChild = el.children('.bx-clone').eq(eq);
1408          position = lastChild.position();
1409        // if infinite loop and "Next" is clicked on the last slide
1410        } else if (direction === 'next' && slider.active.index === 0) {
1411          // get the last clone position
1412          position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1413          slider.active.last = false;
1414        // normal non-zero requests
1415        } else if (slideIndex >= 0) {
1416          //parseInt is applied to allow floats for slides/page
1417          requestEl = slideIndex * parseInt(getMoveBy());
1418          position = slider.children.eq(requestEl).position();
1419        }
1420
1421        /* If the position doesn't exist
1422         * (e.g. if you destroy the slider on a next click),
1423         * it doesn't throw an error.
1424         */
1425        if (typeof (position) !== 'undefined') {
1426          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
1427          // plugin values to be animated
1428          setPositionProperty(value, 'slide', slider.settings.speed);
1429        }
vendor: 6,087 bytes, lines 1429-1606
1429 else {
1430          slider.working = false;
1431        }
1432      }
1433      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1434    };
1435
1436    /**
1437     * Transitions to the next slide in the show
1438     */
1439    el.goToNextSlide = function() {
1440      // if infiniteLoop is false and last page is showing, disregard call
1441      if (!slider.settings.infiniteLoop && slider.active.last) { return; }
1442      var pagerIndex = parseInt(slider.active.index) + 1;
1443      el.goToSlide(pagerIndex, 'next');
1444    };
1445
1446    /**
1447     * Transitions to the prev slide in the show
1448     */
1449    el.goToPrevSlide = function() {
1450      // if infiniteLoop is false and last page is showing, disregard call
1451      if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
1452      var pagerIndex = parseInt(slider.active.index) - 1;
1453      el.goToSlide(pagerIndex, 'prev');
1454    };
1455
1456    /**
1457     * Starts the auto show
1458     *
1459     * @param preventControlUpdate (boolean)
1460     *  - if true, auto controls state will not be updated
1461     */
1462    el.startAuto = function(preventControlUpdate) {
1463      // if an interval already exists, disregard call
1464      if (slider.interval) { return; }
1465      // create an interval
1466      slider.interval = setInterval(function() {
1467        if (slider.settings.autoDirection === 'next') {
1468          el.goToNextSlide();
1469        } else {
1470          el.goToPrevSlide();
1471        }
1472      }, slider.settings.pause);
1473      // if auto controls are displayed and preventControlUpdate is not true
1474      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
1475    };
1476
1477    /**
1478     * Stops the auto show
1479     *
1480     * @param preventControlUpdate (boolean)
1481     *  - if true, auto controls state will not be updated
1482     */
1483    el.stopAuto = function(preventControlUpdate) {
1484      // if no interval exists, disregard call
1485      if (!slider.interval) { return; }
1486      // clear the interval
1487      clearInterval(slider.interval);
1488      slider.interval = null;
1489      // if auto controls are displayed and preventControlUpdate is not true
1490      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
1491    };
1492
1493    /**
1494     * Returns current slide index (zero-based)
1495     */
1496    el.getCurrentSlide = function() {
1497      return slider.active.index;
1498    };
1499
1500    /**
1501     * Returns current slide element
1502     */
1503    el.getCurrentSlideElement = function() {
1504      return slider.children.eq(slider.active.index);
1505    };
1506
1507    /**
1508     * Returns a slide element
1509     * @param index (int)
1510     *  - The index (zero-based) of the element you want returned.
1511     */
1512    el.getSlideElement = function(index) {
1513      return slider.children.eq(index);
1514    };
1515
1516    /**
1517     * Returns number of slides in show
1518     */
1519    el.getSlideCount = function() {
1520      return slider.children.length;
1521    };
1522
1523    /**
1524     * Return slider.working variable
1525     */
1526    el.isWorking = function() {
1527      return slider.working;
1528    };
1529
1530    /**
1531     * Update all dynamic slider elements
1532     */
1533    el.redrawSlider = function() {
1534      // resize all children in ratio to new screen size
1535      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
1536      // adjust the height
1537      slider.viewport.css('height', getViewportHeight());
1538      // update the slide position
1539      if (!slider.settings.ticker) { setSlidePosition(); }
1540      // if active.last was true before the screen resize, we want
1541      // to keep it last no matter what screen size we end on
1542      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
1543      // if the active index (page) no longer exists due to the resize, simply set the index as last
1544      if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
1545      // if a pager is being displayed and a custom pager is not being used, update it
1546      if (slider.settings.pager && !slider.settings.pagerCustom) {
1547        populatePager();
1548        updatePagerActive(slider.active.index);
1549      }
1550      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
1551    };
1552
1553    /**
1554     * Destroy the current instance of the slider (revert everything back to original state)
1555     */
1556    el.destroySlider = function() {
1557      // don't do anything if slider has already been destroyed
1558      if (!slider.initialized) { return; }
1559      slider.initialized = false;
1560      $('.bx-clone', this).remove();
1561      slider.children.each(function() {
1562        if ($(this).data('origStyle') !== undefined) {
1563          $(this).attr('style', $(this).data('origStyle'));
1564        } else {
1565          $(this).removeAttr('style');
1566        }
1567      });
1568      if ($(this).data('origStyle') !== undefined) {
1569        this.attr('style', $(this).data('origStyle'));
1570      } else {
1571        $(this).removeAttr('style');
1572      }
1573      $(this).unwrap().unwrap();
1574      if (slider.controls.el) { slider.controls.el.remove(); }
1575      if (slider.controls.next) { slider.controls.next.remove(); }
1576      if (slider.controls.prev) { slider.controls.prev.remove(); }
1577      if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
1578      $('.bx-caption', this).remove();
1579      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
1580      clearInterval(slider.interval);
1581      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
1582      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
1583      //remove self reference in data
1584      $(this).removeData('bxSlider');
1585    };
1586
1587    /**
1588     * Reload the slider (revert all DOM changes, and re-initialize)
1589     */
1590    el.reloadSlider = function(settings) {
1591      if (settings !== undefined) { options = settings; }
1592      el.destroySlider();
1593      init();
1594      //store reference to self in order to access public functions later
1595      $(el).data('bxSlider', this);
1596    };
1597
1598    init();
1599
1600    $(el).data('bxSlider', this);
1601
1602    // returns the current jQuery object
1603    return this;
1604  };
1605
1606})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.