PageSourceSearch

https://www.iiabl.com/wp-content/themes/big-i/dist/block-editor/bl…/testimonials/view-script.js?ver=1790774057

js iiabl.com collected 2026-10-04 05:04:27 UTC 5,829 bytes, 165 lines download raw bytes

1/******/ (function() { // webpackBootstrap
2/******/ 	// runtime can't be in strict mode because a global variable is assign and maybe created.
3/******/ 	// The require scope
4/******/ 	var __webpack_require__ = {};
5/******/ 	
6/************************************************************************/
7/******/ 	/* webpack/runtime/define property getters */
8/******/ 	!function() {
9/******/ 		// define getter functions for harmony exports
10/******/ 		__webpack_require__.d = function(exports, definition) {
11/******/ 			for(var key in definition) {
12/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14/******/ 				}
15/******/ 			}
16/******/ 		};
17/******/ 	}();
18/******/ 	
19/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
20/******/ 	!function() {
21/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
22/******/ 	}();
23/******/ 	
24/******/ 	/* webpack/runtime/make namespace object */
25/******/ 	!function() {
26/******/ 		// define __esModule on exports
27/******/ 		__webpack_require__.r = function(exports) {
28/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30/******/ 			}
31/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
32/******/ 		};
33/******/ 	}();
34/******/ 	
35/************************************************************************/
36var __webpack_exports__ = {};
37// This entry need to be wrapped in an IIFE because it need to be in strict mode.
38!function() {
39"use strict";
40/*!*********************************************************!*\
41  !*** ./block-editor/blocks/testimonials/view-script.js ***!
42  \*********************************************************/
43__webpack_require__.r(__webpack_exports__);
44/* harmony export */ __webpack_require__.d(__webpack_exports__, {
45/* harmony export */   Testimonials: function() { return /* binding */ Testimonials; }
46/* harmony export */ });
47class Testimonials {
48  constructor(node) {
49    let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
50    if (!node) {
51      return;
52    }
53    this.node = node;
54    this.opts = {
55      content: '.testimonials__content',
56      next: '.testimonials__next',
57      prev: '.testimonials__prev',
58      pagination: '.testimonials__pagination',
59      autoplay: false,
60      interval: 5000,
61      ...opts
62    };
63    this.content = node.querySelector(this.opts.content);
64    this.prev = node.querySelector(this.opts.prev);
65    this.next = node.querySelector(this.opts.next);
66    this.pagination = node.querySelector(this.opts.pagination);
67    if (this.opts.autoplay) {
68      this.interval = setInterval(() => {
69        if (this.getCurrentScrollIndex() >= items.children.length - 1) {
70          return this.setScrollIndex(0);
71        }
72        return this.scrollNext();
73      }, parseInt(this.opts.interval, 10));
74    }
75    if (this.prev) {
76      this.prev.addEventListener('click', () => {
77        this.scrollPrev();
78        if (this.interval) {
79          clearInterval(this.interval);
80        }
81      });
82    }
83    if (this.next) {
84      this.next.addEventListener('click', () => {
85        this.scrollNext();
86        if (this.interval) {
87          clearInterval(this.interval);
88        }
89      });
90    }
91    if (this.pagination) {
92      this.pagination.addEventListener('click', e => {
93        console.log(e.target);
94        let clickedDot = e.target;
95        const dotIndex = [...clickedDot.parentElement.children].indexOf(clickedDot);
96        this.setScrollIndex(dotIndex);
97      });
98    }
99    this.content.addEventListener('scroll', this.setState.bind(this));
100    this.setScrollIndex(0);
101    this.setState();
102  }
103  scrollPrev() {
104    this.setScrollIndex(Math.round(Math.max(this.getCurrentScrollIndex() - 1, 0)));
105  }
106  scrollNext() {
107    this.setScrollIndex(Math.round(Math.min(this.getCurrentScrollIndex() + 1, this.content.children.length - 1)));
108  }
109  setScrollIndex(index) {
110    this.content.scrollTo({
111      left: index * this.content.offsetWidth,
112      top: 0,
113      behavior: 'smooth'
114    });
115  }
116  getCurrentScrollIndex() {
117    return Math.round(this.content.scrollLeft / this.content.offsetWidth);
118  }
119  setState() {
120    const index = this.getCurrentScrollIndex();
121    if (index >= this.content.children.length - 1) {
122      if (this.next) {
123        this.next.disabled = true;
124      }
125      if (this.prev) {
126        this.prev.removeAttribute('disabled');
127      }
128    } else if (index <= 0) {
129      if (this.next) {
130        this.next.removeAttribute('disabled');
131      }
132      if (this.prev) {
133        this.prev.disabled = true;
134      }
135    } else {
136      if (this.next) {
137        this.next.removeAttribute('disabled');
138      }
139      if (this.prev) {
140        this.prev.removeAttribute('disabled');
141      }
142    }
143    if (this.pagination) {
144      let prevActiveDot = this.pagination.querySelector('[disabled]');
145      if (prevActiveDot) {
146        prevActiveDot.removeAttribute('disabled');
147      }
148      this.pagination.children[index].disabled = true;
149    }
150  }
151}
152document.addEventListener('DOMContentLoaded', () => {
153  document.querySelectorAll('.testimonials').forEach(node => {
154    new Testimonials(node, {
155      ...node.dataset
156    });
157  });
158});
159}();
160var __webpack_export_target__ = (wdg.blocks.testimonialsViewScript = typeof wdg.blocks.testimonialsViewScript === "undefined" ? {} : wdg.blocks.testimonialsViewScript);
161for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
162if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
163/******/ })()
164;
165//# sourceMappingURL=view-script.js.map

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.