PageSourceSearch

https://www.monadnockperio.com/wp-content/themes/ekwa/layouts/bootstrap/js/carousel.js?ver=1.0.0

js monadnockperio.com collected 2026-10-06 12:24:35 UTC 22,499 bytes, 743 lines download raw bytes

1/*!
2  * Bootstrap carousel.js v4.4.1 (https://getbootstrap.com/)
3  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5  */
6(function (global, factory) {
7  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
8  typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
9  (global = global || self, global.Carousel = factory(global.jQuery, global.Util));
10}(this, (function ($, Util) { 'use strict';
11
12  $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
13  Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
14
15  function _defineProperties(target, props) {
16    for (var i = 0; i < props.length; i++) {
17      var descriptor = props[i];
18      descriptor.enumerable = descriptor.enumerable || false;
19      descriptor.configurable = true;
20      if ("value" in descriptor) descriptor.writable = true;
21      Object.defineProperty(target, descriptor.key, descriptor);
22    }
23  }
24
25  function _createClass(Constructor, protoProps, staticProps) {
26    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27    if (staticProps) _defineProperties(Constructor, staticProps);
28    return Constructor;
29  }
30
31  function _defineProperty(obj, key, value) {
32    if (key in obj) {
33      Object.defineProperty(obj, key, {
34        value: value,
35        enumerable: true,
36        configurable: true,
37        writable: true
38      });
39    } else {
40      obj[key] = value;
41    }
42
43    return obj;
44  }
45
46  function ownKeys(object, enumerableOnly) {
47    var keys = Object.keys(object);
48
49    if (Object.getOwnPropertySymbols) {
50      var symbols = Object.getOwnPropertySymbols(object);
51      if (enumerableOnly) symbols = symbols.filter(function (sym) {
52        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
53      });
54      keys.push.apply(keys, symbols);
55    }
56
57    return keys;
58  }
59
60  function _objectSpread2(target) {
61    for (var i = 1; i < arguments.length; i++) {
62      var source = arguments[i] != null ? arguments[i] : {};
63
64      if (i % 2) {
65        ownKeys(Object(source), true).forEach(function (key) {
66          _defineProperty(target, key, source[key]);
67        });
68      } else if (Object.getOwnPropertyDescriptors) {
69        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
70      } else {
71        ownKeys(Object(source)).forEach(function (key) {
72          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
73        });
74      }
75    }
76
77    return target;
78  }
79
80  /**
81   * ------------------------------------------------------------------------
82   * Constants
83   * ------------------------------------------------------------------------
84   */
85
86  var NAME = 'carousel';
87  var VERSION = '4.4.1';
88  var DATA_KEY = 'bs.carousel';
89  var EVENT_KEY = "." + DATA_KEY;
90  var DATA_API_KEY = '.data-api';
91  var JQUERY_NO_CONFLICT = $.fn[NAME];
92  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
93
94  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
95
96  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
97
98  var SWIPE_THRESHOLD = 40;
99  var Default = {
100    interval: 5000,
101    keyboard: true,
102    slide: false,
103    pause: 'hover',
104    wrap: true,
105    touch: true
106  };
107  var DefaultType = {
108    interval: '(number|boolean)',
109    keyboard: 'boolean',
110    slide: '(boolean|string)',
111    pause: '(string|boolean)',
112    wrap: 'boolean',
113    touch: 'boolean'
114  };
115  var Direction = {
116    NEXT: 'next',
117    PREV: 'prev',
118    LEFT: 'left',
119    RIGHT: 'right'
120  };
121  var Event = {
122    SLIDE: "slide" + EVENT_KEY,
123    SLID: "slid" + EVENT_KEY,
124    KEYDOWN: "keydown" + EVENT_KEY,
125    MOUSEENTER: "mouseenter" + EVENT_KEY,
126    MOUSELEAVE: "mouseleave" + EVENT_KEY,
127    TOUCHSTART: "touchstart" + EVENT_KEY,
128    TOUCHMOVE: "touchmove" + EVENT_KEY,
129    TOUCHEND: "touchend" + EVENT_KEY,
130    POINTERDOWN: "pointerdown" + EVENT_KEY,
131    POINTERUP: "pointerup" + EVENT_KEY,
132    DRAG_START: "dragstart" + EVENT_KEY,
133    LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
134    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
135  };
136  var ClassName = {
137    CAROUSEL: 'carousel',
138    ACTIVE: 'active',
139    SLIDE: 'slide',
140    RIGHT: 'carousel-item-right',
141    LEFT: 'carousel-item-left',
142    NEXT: 'carousel-item-next',
143    PREV: 'carousel-item-prev',
144    ITEM: 'carousel-item',
145    POINTER_EVENT: 'pointer-event'
146  };
147  var Selector = {
148    ACTIVE: '.active',
149    ACTIVE_ITEM: '.active.carousel-item',
150    ITEM: '.carousel-item',
151    ITEM_IMG: '.carousel-item img',
152    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
153    INDICATORS: '.carousel-indicators',
154    DATA_SLIDE: '[data-slide], [data-slide-to]',
155    DATA_RIDE: '[data-ride="carousel"]'
156  };
157  var PointerType = {
158    TOUCH: 'touch',
159    PEN: 'pen'
160  };
161  /**
162   * ------------------------------------------------------------------------
163   * Class Definition
164   * ------------------------------------------------------------------------
165   */
166
167  var Carousel =
168  /*#__PURE__*/
169  function () {
170    function Carousel(element, config) {
171      this._items = null;
172      this._interval = null;
173      this._activeElement = null;
174      this._isPaused = false;
175      this._isSliding = false;
176      this.touchTimeout = null;
177      this.touchStartX = 0;
178      this.touchDeltaX = 0;
179      this._config = this._getConfig(config);
180      this._element = element;
181      this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
182      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
183      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
184
185      this._addEventListeners();
186    } // Getters
187
188
189    var _proto = Carousel.prototype;
190
191    // Public
192    _proto.next = function next() {
193      if (!this._isSliding) {
194        this._slide(Direction.NEXT);
195      }
196    };
197
198    _proto.nextWhenVisible = function nextWhenVisible() {
199      // Don't call next when the page isn't visible
200      // or the carousel or its parent isn't visible
201      if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
202        this.next();
203      }
204    };
205
206    _proto.prev = function prev() {
207      if (!this._isSliding) {
208        this._slide(Direction.PREV);
209      }
210    };
211
212    _proto.pause = function pause(event) {
213      if (!event) {
214        this._isPaused = true;
215      }
216
217      if (this._element.querySelector(Selector.NEXT_PREV)) {
218        Util.triggerTransitionEnd(this._element);
219        this.cycle(true);
220      }
221
222      clearInterval(this._interval);
223      this._interval = null;
224    };
225
226    _proto.cycle = function cycle(event) {
227      if (!event) {
228        this._isPaused = false;
229      }
230
231      if (this._interval) {
232        clearInterval(this._interval);
233        this._interval = null;
234      }
235
236      if (this._config.interval && !this._isPaused) {
237        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
238      }
239    };
240
241    _proto.to = function to(index) {
242      var _this = this;
243
244      this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
245
246      var activeIndex = this._getItemIndex(this._activeElement);
247
248      if (index > this._items.length - 1 || index < 0) {
249        return;
250      }
251
252      if (this._isSliding) {
253        $(this._element).one(Event.SLID, function () {
254          return _this.to(index);
255        });
256        return;
257      }
258
259      if (activeIndex === index) {
260        this.pause();
261        this.cycle();
262        return;
263      }
264
265      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
266
267      this._slide(direction, this._items[index]);
268    };
269
270    _proto.dispose = function dispose() {
271      $(this._element).off(EVENT_KEY);
272      $.removeData(this._element, DATA_KEY);
273      this._items = null;
274      this._config = null;
275      this._element = null;
276      this._interval = null;
277      this._isPaused = null;
278      this._isSliding = null;
279      this._activeElement = null;
280      this._indicatorsElement = null;
281    } // Private
282    ;
283
284    _proto._getConfig = function _getConfig(config) {
285      config = _objectSpread2({}, Default, {}, config);
286      Util.typeCheckConfig(NAME, config, DefaultType);
287      return config;
288    };
289
290    _proto._handleSwipe = function _handleSwipe() {
291      var absDeltax = Math.abs(this.touchDeltaX);
292
293      if (absDeltax <= SWIPE_THRESHOLD) {
294        return;
295      }
296
297      var direction = absDeltax / this.touchDeltaX;
298      this.touchDeltaX = 0; // swipe left
299
300      if (direction > 0) {
301        this.prev();
302      } // swipe right
303
304
305      if (direction < 0) {
306        this.next();
307      }
308    };
309
310    _proto._addEventListeners = function _addEventListeners() {
311      var _this2 = this;
312
313      if (this._config.keyboard) {
314        $(this._element).on(Event.KEYDOWN, function (event) {
315          return _this2._keydown(event);
316        });
317      }
318
319      if (this._config.pause === 'hover') {
320        $(this._element).on(Event.MOUSEENTER, function (event) {
321          return _this2.pause(event);
322        }).on(Event.MOUSELEAVE, function (event) {
323          return _this2.cycle(event);
324        });
325      }
326
327      if (this._config.touch) {
328        this._addTouchEventListeners();
329      }
330    };
331
332    _proto._addTouchEventListeners = function _addTouchEventListeners() {
333      var _this3 = this;
334
335      if (!this._touchSupported) {
336        return;
337      }
338
339      var start = function start(event) {
340        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
341          _this3.touchStartX = event.originalEvent.clientX;
342        } else if (!_this3._pointerEvent) {
343          _this3.touchStartX = event.originalEvent.touches[0].clientX;
344        }
345      };
346
347      var move = function move(event) {
348        // ensure swiping with one touch and not pinching
349        if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
350          _this3.touchDeltaX = 0;
351        } else {
352          _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
353        }
354      };
355
356      var end = function end(event) {
357        if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
358          _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
359        }
360
361        _this3._handleSwipe();
362
363        if (_this3._config.pause === 'hover') {
364          // If it's a touch-enabled device, mouseenter/leave are fired as
365          // part of the mouse compatibility events on first tap - the carousel
366          // would stop cycling until user tapped out of it;
367          // here, we listen for touchend, explicitly pause the carousel
368          // (as if it's the second time we tap on it, mouseenter compat event
369          // is NOT fired) and after a timeout (to allow for mouse compatibility
370          // events to fire) we explicitly restart cycling
371          _this3.pause();
372
373          if (_this3.touchTimeout) {
374            clearTimeout(_this3.touchTimeout);
375          }
376
377          _this3.touchTimeout = setTimeout(function (event) {
378            return _this3.cycle(event);
379          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
380        }
381      };
382
383      $(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
384        return e.preventDefault();
385      });
386
387      if (this._pointerEvent) {
388        $(this._element).on(Event.POINTERDOWN, function (event) {
389          return start(event);
390        });
391        $(this._element).on(Event.POINTERUP, function (event) {
392          return end(event);
393        });
394
395        this._element.classList.add(ClassName.POINTER_EVENT);
396      } else {
397        $(this._element).on(Event.TOUCHSTART, function (event) {
398          return start(event);
399        });
400        $(this._element).on(Event.TOUCHMOVE, function (event) {
401          return move(event);
402        });
403        $(this._element).on(Event.TOUCHEND, function (event) {
404          return end(event);
405        });
406      }
407    };
408
409    _proto._keydown = function _keydown(event) {
410      if (/input|textarea/i.test(event.target.tagName)) {
411        return;
412      }
413
414      switch (event.which) {
415        case ARROW_LEFT_KEYCODE:
416          event.preventDefault();
417          this.prev();
418          break;
419
420        case ARROW_RIGHT_KEYCODE:
421          event.preventDefault();
422          this.next();
423          break;
424      }
425    };
426
427    _proto._getItemIndex = function _getItemIndex(element) {
428      this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
429      return this._items.indexOf(element);
430    };
431
432    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
433      var isNextDirection = direction === Direction.NEXT;
434      var isPrevDirection = direction === Direction.PREV;
435
436      var activeIndex = this._getItemIndex(activeElement);
437
438      var lastItemIndex = this._items.length - 1;
439      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
440
441      if (isGoingToWrap && !this._config.wrap) {
442        return activeElement;
443      }
444
445      var delta = direction === Direction.PREV ? -1 : 1;
446      var itemIndex = (activeIndex + delta) % this._items.length;
447      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
448    };
449
450    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
451      var targetIndex = this._getItemIndex(relatedTarget);
452
453      var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
454
455      var slideEvent = $.Event(Event.SLIDE, {
456        relatedTarget: relatedTarget,
457        direction: eventDirectionName,
458        from: fromIndex,
459        to: targetIndex
460      });
461      $(this._element).trigger(slideEvent);
462      return slideEvent;
463    };
464
465    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
466      if (this._indicatorsElement) {
467        var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
468        $(indicators).removeClass(ClassName.ACTIVE);
469
470        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
471
472        if (nextIndicator) {
473          $(nextIndicator).addClass(ClassName.ACTIVE);
474        }
475      }
476    };
477
478    _proto._slide = function _slide(direction, element) {
479      var _this4 = this;
480
481      var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
482
483      var activeElementIndex = this._getItemIndex(activeElement);
484
485      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
486
487      var nextElementIndex = this._getItemIndex(nextElement);
488
489      var isCycling = Boolean(this._interval);
490      var directionalClassName;
491      var orderClassName;
492      var eventDirectionName;
493
494      if (direction === Direction.NEXT) {
495        directionalClassName = ClassName.LEFT;
496        orderClassName = ClassName.NEXT;
497        eventDirectionName = Direction.LEFT;
498      } else {
499        directionalClassName = ClassName.RIGHT;
500        orderClassName = ClassName.PREV;
501        eventDirectionName = Direction.RIGHT;
502      }
503
504      if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
505        this._isSliding = false;
506        return;
507      }
508
509      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
510
511      if (slideEvent.isDefaultPrevented()) {
512        return;
513      }
514
515      if (!activeElement || !nextElement) {
516        // Some weirdness is happening, so we bail
517        return;
518      }
519
520      this._isSliding = true;
521
522      if (isCycling) {
523        this.pause();
524      }
525
526      this._setActiveIndicatorElement(nextElement);
527
528      var slidEvent = $.Event(Event.SLID, {
529        relatedTarget: nextElement,
530        direction: eventDirectionName,
531        from: activeElementIndex,
532        to: nextElementIndex
533      });
534
535      if ($(this._element).hasClass(ClassName.SLIDE)) {
536        $(nextElement).addClass(orderClassName);
537        Util.reflow(nextElement);
538        $(activeElement).addClass(directionalClassName);
539        $(nextElement).addClass(directionalClassName);
540        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
541
542        if (nextElementInterval) {
543          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
544          this._config.interval = nextElementInterval;
545        } else {
546          this._config.interval = this._config.defaultInterval || this._config.interval;
547        }
548
549        var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
550        $(activeElement).one(Util.TRANSITION_END, function () {
551          $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
552          $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
553          _this4._isSliding = false;
554          setTimeout(function () {
555            return $(_this4._element).trigger(slidEvent);
556          }, 0);
557        }).emulateTransitionEnd(transitionDuration);
558      } else {
559        $(activeElement).removeClass(ClassName.ACTIVE);
560        $(nextElement).addClass(ClassName.ACTIVE);
561        this._isSliding = false;
562        $(this._element).trigger(slidEvent);
563      }
564
565      if (isCycling) {
566        this.cycle();
567      }
568    } // Static
569    ;
570
571    Carousel._jQueryInterface = function _jQueryInterface(config) {
572      return this.each(function () {
573        var data = $(this).data(DATA_KEY);
574
575        var _config = _objectSpread2({}, Default, {}, $(this).data());
576
577        if (typeof config === 'object') {
578          _config = _objectSpread2({}, _config, {}, config);
579        }
580
581        var action = typeof config === 'string' ? config : _config.slide;
582
583        if (!data) {
584          data = new Carousel(this, _config);
585          $(this).data(DATA_KEY, data);
586        }
587
588        if (typeof config === 'number') {
589          data.to(config);
590        } else if (typeof action === 'string') {
591          if (typeof data[action] === 'undefined') {
592            throw new TypeError("No method named \"" + action + "\"");
593          }
594
595          data[action]();
596        } else if (_config.interval && _config.ride) {
597          data.pause();
598          data.cycle();
599        }
600      });
601    };
602
603    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
604      var selector = Util.getSelectorFromElement(this);
605
606      if (!selector) {
607        return;
608      }
609
610      var target = $(selector)[0];
611
612      if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
613        return;
614      }
615
616      var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
617
618      var slideIndex = this.getAttribute('data-slide-to');
619
620      if (slideIndex) {
621        config.interval = false;
622      }
623
624      Carousel._jQueryInterface.call($(target), config);
625
626      if (slideIndex) {
627        $(target).data(DATA_KEY).to(slideIndex);
628      }
629
630      event.preventDefault();
631    };
632
633    _createClass(Carousel, null, [{
634      key: "VERSION",
635      get: function get() {
636        return VERSION;
637      }
638    }, {
639      key: "Default",
640      get: function get() {
641        return Default;
642      }
643    }]);
644
645    return Carousel;
646  }();
647  /**
648   * ------------------------------------------------------------------------
649   * Data Api implementation
650   * ------------------------------------------------------------------------
651   */
652
653
654  $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
655  $(window).on(Event.LOAD_DATA_API, function () {
656    var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
657
658    for (var i = 0, len = carousels.length; i < len; i++) {
659      var $carousel = $(carousels[i]);
660
661      Carousel._jQueryInterface.call($carousel, $carousel.data());
662    }
663  });
664  /**
665   * ------------------------------------------------------------------------
666   * jQuery
667   * ------------------------------------------------------------------------
668   */
669
670  $.fn[NAME] = Carousel._jQueryInterface;
671  $.fn[NAME].Constructor = Carousel;
672
673  $.fn[NAME].noConflict = function () {
674    $.fn[NAME] = JQUERY_NO_CONFLICT;
675    return Carousel._jQueryInterface;
676  };
677
678  return Carousel;
679
680})));
681//# sourceMappingURL=carousel.js.map
682
683
684
685
686(function($) {
687  //Function to animate slider captions
688  function doAnimations(elems) {
689    //Cache the animationend event in a variable
690    var animEndEv = "webkitAnimationEnd animationend";
691
692    elems.each(function() {
693      var $this = $(this),
694        $animationType = $this.data("animation");
695      $this.addClass($animationType).one(animEndEv, function() {
696        $this.removeClass($animationType);
697      });
698    });
699  }
700
701  //Variables on page load
702  var $myCarousel = $("#carouselOneIndicators"),
703    $firstAnimatingElems = $myCarousel
704      .find(".carousel-item:first")
705      .find("[data-animation ^= 'animate__animated']");
706
707  //Initialize carousel
708  $myCarousel.carousel();
709
710  //Animate captions in first slide on page load
711  doAnimations($firstAnimatingElems);
712
713  //Other slides to be animated on carousel slide event
714  $myCarousel.on("slide.bs.carousel", function(e) {
715    var $animatingElems = $(e.relatedTarget).find(
716      "[data-animation ^= 'animate__animated']"
717    );
718    doAnimations($animatingElems);
719  });
720})(jQuery);
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743

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.