PageSourceSearch

https://magictowns.al/wp-content/plugins/thegem-elements-elementor…/assets/js/testimonials-carousel.js

js magictowns.al collected 2026-10-02 21:45:12 UTC 3,215 bytes, 106 lines download raw bytes

1(function($) {
2
3	$.fn.buildTestimonialsCarousel = function() {
4
5		var $testimonialsElement = $(this);
6
7		$('.gem-testimonials:not(.gem-testimonials-built)', $testimonialsElement).each(function() {
8
9			var $testimonialsElement = $(this);
10
11			var $testimonials = $('.gem-testimonial-item', $testimonialsElement);
12
13			var $testimonialsWrap = $('<div class="gem-testimonials-carousel-wrap"/>')
14				.appendTo($testimonialsElement);
15			var $testimonialsCarousel = $('<div class="gem-testimonials-carousel"/>')
16				.appendTo($testimonialsWrap);
17			if ($testimonialsElement.hasClass('fullwidth-block')) {
18				$testimonialsCarousel.wrap('<div class="container" />');
19			}
20			var $testimonialsNavigation = $('<div class="gem-testimonials-navigation"/>')
21				.appendTo($testimonialsWrap);
22			var $testimonialsPrev = $('<a href="#" role="button" class="gem-prev gem-testimonials-prev" aria-label="Previous testimonial"></a>')
23				.appendTo($testimonialsNavigation);
24			var $testimonialsNext = $('<a href="#" role="button" class="gem-next gem-testimonials-next" aria-label="Next testimonial"></a>')
25				.appendTo($testimonialsNavigation);
26
27			if($testimonialsElement.hasClass('random-order')) {
28				$testimonials.sort(function() {
29					return 0.5 - Math.random();
30				});
31			}
32			$testimonials.appendTo($testimonialsCarousel);
33		});
34
35		$(this).addClass('gem-testimonials-built');
36
37	}
38
39	$.fn.updateTestimonialsCarousel = function() {
40		function initTestimonialsCarousel() {
41			if (window.tgpLazyItems !== undefined) {
42				var isShowed = window.tgpLazyItems.checkGroupShowed(this, function(node) {
43					initTestimonialsCarousel.call(node);
44				});
45				if (!isShowed) {
46					return;
47				}
48			}
49
50			var $testimonialsElement = $(this);
51
52			var $testimonialsCarousel = $('.gem-testimonials-carousel', $testimonialsElement);
53			var $testimonials = $('.gem-testimonial-item', $testimonialsCarousel);
54			var $testimonialsPrev = $('.gem-testimonials-prev', $testimonialsElement);
55			var $testimonialsNext = $('.gem-testimonials-next', $testimonialsElement);
56
57			$testimonialsElement.thegemPreloader(function() {
58
59				var $testimonialsView = $testimonialsCarousel.carouFredSel({
60					auto: ($testimonialsElement.data('autoscroll') > 0 ? $testimonialsElement.data('autoscroll') : false),
61					circular: true,
62					infinite: true,
63					width: '100%',
64					height: 'auto',
65					items: 1,
66					align: 'center',
67					responsive: true,
68					swipe: true,
69					prev: $testimonialsPrev,
70					next: $testimonialsNext,
71					scroll: {
72						pauseOnHover: true,
73						fx: 'scroll',
74						easing: 'easeInOutCubic',
75						duration: 1000,
76						onBefore: function(data) {
77							data.items.old.css({
78								opacity: 1
79							}).animate({
80								opacity: 0
81							}, 500, 'linear');
82
83							data.items.visible.css({
84								opacity: 0
85							}).animate({
86								opacity: 1
87							}, 1000, 'linear');
88						}
89					}
90				});
91
92			});
93		}
94
95		$('.gem-testimonials', this).add($(this).filter('.gem-testimonials')).each(initTestimonialsCarousel);
96	}
97
98	$(function() {
99		$('body').buildTestimonialsCarousel();
100		$('body').updateTestimonialsCarousel();
101		$('.gem_tab').on('tab-update', function() {
102			$(this).updateTestimonialsCarousel();
103		});
104	});
105
106})(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.