PageSourceSearch

https://nissenad-digitalhub.com/wp-content/themes/nissen_staging-master/js/jquery.bxslider.js

js nissenad-digitalhub.com collected 2026-10-05 23:57:25 UTC 65,975 bytes, 1,617 lines download raw bytes

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